stm32g0_staging/stm32g0b0/mod.rs
1/*!Peripheral access API for STM32G0B0 microcontrollers (generated using svd2rust v0.35.0 (c94dc77 2025-01-15))
2
3You can find an overview of the generated API [here].
4
5API features to be included in the [next]
6svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.
7
8[here]: https://docs.rs/svd2rust/0.35.0/svd2rust/#peripheral-api
9[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased
10[repository]: https://github.com/rust-embedded/svd2rust*/
11use core::marker::PhantomData;
12use core::ops::Deref;
13///Number available in the NVIC for configuring priority
14pub const NVIC_PRIO_BITS: u8 = 2;
15#[cfg(feature = "rt")]
16pub use self::Interrupt as interrupt;
17pub use cortex_m::peripheral::Peripherals as CorePeripherals;
18pub use cortex_m::peripheral::{
19 CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU,
20};
21#[cfg(feature = "rt")]
22pub use cortex_m_rt::interrupt;
23#[cfg(feature = "rt")]
24extern "C" {
25 fn WWDG();
26 fn RTC_STAMP();
27 fn FLASH();
28 fn RCC();
29 fn EXTI0_1();
30 fn EXTI2_3();
31 fn EXTI4_15();
32 fn DMA1_CHANNEL1();
33 fn DMA1_CHANNEL2_3();
34 fn DMA1_CHANNEL4_5_6_7_DMAMUX_DMA2_CHANNEL1_2_3_4_5();
35 fn ADC();
36 fn TIM1_BRK_UP_TRG_COM();
37 fn TIM1_CC();
38 fn TIM3_TIM4();
39 fn TIM6_DAC();
40 fn TIM7();
41 fn TIM14();
42 fn TIM15();
43 fn TIM16();
44 fn TIM17();
45 fn I2C1();
46 fn I2C2();
47 fn SPI1();
48 fn SPI2_SPI3();
49 fn USART1();
50 fn USART2();
51 fn USART3_USART4_USART5_USART6_LPUART1();
52}
53#[doc(hidden)]
54#[repr(C)]
55pub union Vector {
56 _handler: unsafe extern "C" fn(),
57 _reserved: u32,
58}
59#[cfg(feature = "rt")]
60#[doc(hidden)]
61#[link_section = ".vector_table.interrupts"]
62#[no_mangle]
63pub static __INTERRUPTS: [Vector; 30] = [
64 Vector { _handler: WWDG },
65 Vector { _reserved: 0 },
66 Vector { _handler: RTC_STAMP },
67 Vector { _handler: FLASH },
68 Vector { _handler: RCC },
69 Vector { _handler: EXTI0_1 },
70 Vector { _handler: EXTI2_3 },
71 Vector { _handler: EXTI4_15 },
72 Vector { _reserved: 0 },
73 Vector { _handler: DMA1_CHANNEL1 },
74 Vector {
75 _handler: DMA1_CHANNEL2_3,
76 },
77 Vector {
78 _handler: DMA1_CHANNEL4_5_6_7_DMAMUX_DMA2_CHANNEL1_2_3_4_5,
79 },
80 Vector { _handler: ADC },
81 Vector {
82 _handler: TIM1_BRK_UP_TRG_COM,
83 },
84 Vector { _handler: TIM1_CC },
85 Vector { _reserved: 0 },
86 Vector { _handler: TIM3_TIM4 },
87 Vector { _handler: TIM6_DAC },
88 Vector { _handler: TIM7 },
89 Vector { _handler: TIM14 },
90 Vector { _handler: TIM15 },
91 Vector { _handler: TIM16 },
92 Vector { _handler: TIM17 },
93 Vector { _handler: I2C1 },
94 Vector { _handler: I2C2 },
95 Vector { _handler: SPI1 },
96 Vector { _handler: SPI2_SPI3 },
97 Vector { _handler: USART1 },
98 Vector { _handler: USART2 },
99 Vector {
100 _handler: USART3_USART4_USART5_USART6_LPUART1,
101 },
102];
103///Enumeration of all the interrupts.
104#[cfg_attr(feature = "defmt", derive(defmt::Format))]
105#[derive(Copy, Clone, Debug, PartialEq, Eq)]
106#[repr(u16)]
107pub enum Interrupt {
108 ///0 - Window watchdog interrupt
109 WWDG = 0,
110 ///2 - RTC and TAMP interrupts
111 RTC_STAMP = 2,
112 ///3 - Flash global interrupt
113 FLASH = 3,
114 ///4 - RCC global interrupt
115 RCC = 4,
116 ///5 - EXTI line 0 and 1 interrupt
117 EXTI0_1 = 5,
118 ///6 - EXTI line 2 and 3 interrupt
119 EXTI2_3 = 6,
120 ///7 - EXTI line 4 to 15 interrupt
121 EXTI4_15 = 7,
122 ///9 - DMA channel 1 interrupt
123 DMA1_CHANNEL1 = 9,
124 ///10 - DMA channel 2 and 3 interrupts
125 DMA1_CHANNEL2_3 = 10,
126 ///11 - DMA channel 2 and 3 interrupts
127 DMA1_CHANNEL4_5_6_7_DMAMUX_DMA2_CHANNEL1_2_3_4_5 = 11,
128 ///12 - ADC interrupt (ADC combined with EXTI 17 and 18)
129 ADC = 12,
130 ///13 - TIM1 break, update, trigger and commutation interrupts
131 TIM1_BRK_UP_TRG_COM = 13,
132 ///14 - TIM1 Capture Compare interrupt
133 TIM1_CC = 14,
134 ///16 - TIM3 global interrupt
135 TIM3_TIM4 = 16,
136 ///17 - TIM6 + LPTIM1 and DAC global interrupt
137 TIM6_DAC = 17,
138 ///18 - TIM7 + LPTIM2 global interrupt
139 TIM7 = 18,
140 ///19 - TIM14 global interrupt
141 TIM14 = 19,
142 ///20 - Timer 15 global interrupt
143 TIM15 = 20,
144 ///21 - TIM16 global interrupt
145 TIM16 = 21,
146 ///22 - TIM17 global interrupt
147 TIM17 = 22,
148 ///23 - I2C1 global interrupt
149 I2C1 = 23,
150 ///24 - I2C2/I2C3 global interrupt
151 I2C2 = 24,
152 ///25 - SPI1 global interrupt
153 SPI1 = 25,
154 ///26 - SPI2/SPI3 global interrupt
155 SPI2_SPI3 = 26,
156 ///27 - USART1 global interrupt
157 USART1 = 27,
158 ///28 - USART2 global interrupt
159 USART2 = 28,
160 ///29 - USART3,4,5,6 global interrupt
161 USART3_USART4_USART5_USART6_LPUART1 = 29,
162}
163unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
164 #[inline(always)]
165 fn number(self) -> u16 {
166 self as u16
167 }
168}
169///Analog to Digital ConverteR
170///
171///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#ADC)
172pub struct ADC {
173 _marker: PhantomData<*const ()>,
174}
175unsafe impl Send for ADC {}
176impl ADC {
177 ///Pointer to the register block
178 pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
179 ///Return the pointer to the register block
180 #[inline(always)]
181 pub const fn ptr() -> *const adc::RegisterBlock {
182 Self::PTR
183 }
184 /// Steal an instance of this peripheral
185 ///
186 /// # Safety
187 ///
188 /// Ensure that the new instance of the peripheral cannot be used in a way
189 /// that may race with any existing instances, for example by only
190 /// accessing read-only or write-only registers, or by consuming the
191 /// original peripheral and using critical sections to coordinate
192 /// access between multiple new instances.
193 ///
194 /// Additionally, other software such as HALs may rely on only one
195 /// peripheral instance existing to ensure memory safety; ensure
196 /// no stolen instances are passed to such software.
197 pub unsafe fn steal() -> Self {
198 Self { _marker: PhantomData }
199 }
200}
201impl Deref for ADC {
202 type Target = adc::RegisterBlock;
203 #[inline(always)]
204 fn deref(&self) -> &Self::Target {
205 unsafe { &*Self::PTR }
206 }
207}
208impl core::fmt::Debug for ADC {
209 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
210 f.debug_struct("ADC").finish()
211 }
212}
213///Analog to Digital ConverteR
214pub mod adc;
215///Cyclic redundancy check calculation unit
216///
217///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#CRC)
218pub struct CRC {
219 _marker: PhantomData<*const ()>,
220}
221unsafe impl Send for CRC {}
222impl CRC {
223 ///Pointer to the register block
224 pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
225 ///Return the pointer to the register block
226 #[inline(always)]
227 pub const fn ptr() -> *const crc::RegisterBlock {
228 Self::PTR
229 }
230 /// Steal an instance of this peripheral
231 ///
232 /// # Safety
233 ///
234 /// Ensure that the new instance of the peripheral cannot be used in a way
235 /// that may race with any existing instances, for example by only
236 /// accessing read-only or write-only registers, or by consuming the
237 /// original peripheral and using critical sections to coordinate
238 /// access between multiple new instances.
239 ///
240 /// Additionally, other software such as HALs may rely on only one
241 /// peripheral instance existing to ensure memory safety; ensure
242 /// no stolen instances are passed to such software.
243 pub unsafe fn steal() -> Self {
244 Self { _marker: PhantomData }
245 }
246}
247impl Deref for CRC {
248 type Target = crc::RegisterBlock;
249 #[inline(always)]
250 fn deref(&self) -> &Self::Target {
251 unsafe { &*Self::PTR }
252 }
253}
254impl core::fmt::Debug for CRC {
255 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
256 f.debug_struct("CRC").finish()
257 }
258}
259///Cyclic redundancy check calculation unit
260pub mod crc;
261///Debug support
262///
263///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#DBG)
264pub struct DBG {
265 _marker: PhantomData<*const ()>,
266}
267unsafe impl Send for DBG {}
268impl DBG {
269 ///Pointer to the register block
270 pub const PTR: *const dbg::RegisterBlock = 0x4001_5800 as *const _;
271 ///Return the pointer to the register block
272 #[inline(always)]
273 pub const fn ptr() -> *const dbg::RegisterBlock {
274 Self::PTR
275 }
276 /// Steal an instance of this peripheral
277 ///
278 /// # Safety
279 ///
280 /// Ensure that the new instance of the peripheral cannot be used in a way
281 /// that may race with any existing instances, for example by only
282 /// accessing read-only or write-only registers, or by consuming the
283 /// original peripheral and using critical sections to coordinate
284 /// access between multiple new instances.
285 ///
286 /// Additionally, other software such as HALs may rely on only one
287 /// peripheral instance existing to ensure memory safety; ensure
288 /// no stolen instances are passed to such software.
289 pub unsafe fn steal() -> Self {
290 Self { _marker: PhantomData }
291 }
292}
293impl Deref for DBG {
294 type Target = dbg::RegisterBlock;
295 #[inline(always)]
296 fn deref(&self) -> &Self::Target {
297 unsafe { &*Self::PTR }
298 }
299}
300impl core::fmt::Debug for DBG {
301 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
302 f.debug_struct("DBG").finish()
303 }
304}
305///Debug support
306pub mod dbg;
307///DMA controller
308///
309///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#DMA1)
310pub struct DMA1 {
311 _marker: PhantomData<*const ()>,
312}
313unsafe impl Send for DMA1 {}
314impl DMA1 {
315 ///Pointer to the register block
316 pub const PTR: *const dma1::RegisterBlock = 0x4002_0000 as *const _;
317 ///Return the pointer to the register block
318 #[inline(always)]
319 pub const fn ptr() -> *const dma1::RegisterBlock {
320 Self::PTR
321 }
322 /// Steal an instance of this peripheral
323 ///
324 /// # Safety
325 ///
326 /// Ensure that the new instance of the peripheral cannot be used in a way
327 /// that may race with any existing instances, for example by only
328 /// accessing read-only or write-only registers, or by consuming the
329 /// original peripheral and using critical sections to coordinate
330 /// access between multiple new instances.
331 ///
332 /// Additionally, other software such as HALs may rely on only one
333 /// peripheral instance existing to ensure memory safety; ensure
334 /// no stolen instances are passed to such software.
335 pub unsafe fn steal() -> Self {
336 Self { _marker: PhantomData }
337 }
338}
339impl Deref for DMA1 {
340 type Target = dma1::RegisterBlock;
341 #[inline(always)]
342 fn deref(&self) -> &Self::Target {
343 unsafe { &*Self::PTR }
344 }
345}
346impl core::fmt::Debug for DMA1 {
347 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
348 f.debug_struct("DMA1").finish()
349 }
350}
351///DMA controller
352pub mod dma1;
353///DMA controller
354///
355///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#DMA2)
356pub struct DMA2 {
357 _marker: PhantomData<*const ()>,
358}
359unsafe impl Send for DMA2 {}
360impl DMA2 {
361 ///Pointer to the register block
362 pub const PTR: *const dma2::RegisterBlock = 0x4002_0400 as *const _;
363 ///Return the pointer to the register block
364 #[inline(always)]
365 pub const fn ptr() -> *const dma2::RegisterBlock {
366 Self::PTR
367 }
368 /// Steal an instance of this peripheral
369 ///
370 /// # Safety
371 ///
372 /// Ensure that the new instance of the peripheral cannot be used in a way
373 /// that may race with any existing instances, for example by only
374 /// accessing read-only or write-only registers, or by consuming the
375 /// original peripheral and using critical sections to coordinate
376 /// access between multiple new instances.
377 ///
378 /// Additionally, other software such as HALs may rely on only one
379 /// peripheral instance existing to ensure memory safety; ensure
380 /// no stolen instances are passed to such software.
381 pub unsafe fn steal() -> Self {
382 Self { _marker: PhantomData }
383 }
384}
385impl Deref for DMA2 {
386 type Target = dma2::RegisterBlock;
387 #[inline(always)]
388 fn deref(&self) -> &Self::Target {
389 unsafe { &*Self::PTR }
390 }
391}
392impl core::fmt::Debug for DMA2 {
393 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
394 f.debug_struct("DMA2").finish()
395 }
396}
397///DMA controller
398pub mod dma2;
399///DMAMUX
400///
401///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#DMAMUX)
402pub struct DMAMUX {
403 _marker: PhantomData<*const ()>,
404}
405unsafe impl Send for DMAMUX {}
406impl DMAMUX {
407 ///Pointer to the register block
408 pub const PTR: *const dmamux::RegisterBlock = 0x4002_0800 as *const _;
409 ///Return the pointer to the register block
410 #[inline(always)]
411 pub const fn ptr() -> *const dmamux::RegisterBlock {
412 Self::PTR
413 }
414 /// Steal an instance of this peripheral
415 ///
416 /// # Safety
417 ///
418 /// Ensure that the new instance of the peripheral cannot be used in a way
419 /// that may race with any existing instances, for example by only
420 /// accessing read-only or write-only registers, or by consuming the
421 /// original peripheral and using critical sections to coordinate
422 /// access between multiple new instances.
423 ///
424 /// Additionally, other software such as HALs may rely on only one
425 /// peripheral instance existing to ensure memory safety; ensure
426 /// no stolen instances are passed to such software.
427 pub unsafe fn steal() -> Self {
428 Self { _marker: PhantomData }
429 }
430}
431impl Deref for DMAMUX {
432 type Target = dmamux::RegisterBlock;
433 #[inline(always)]
434 fn deref(&self) -> &Self::Target {
435 unsafe { &*Self::PTR }
436 }
437}
438impl core::fmt::Debug for DMAMUX {
439 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
440 f.debug_struct("DMAMUX").finish()
441 }
442}
443///DMAMUX
444pub mod dmamux;
445///External interrupt/event controller
446///
447///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#EXTI)
448pub struct EXTI {
449 _marker: PhantomData<*const ()>,
450}
451unsafe impl Send for EXTI {}
452impl EXTI {
453 ///Pointer to the register block
454 pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
455 ///Return the pointer to the register block
456 #[inline(always)]
457 pub const fn ptr() -> *const exti::RegisterBlock {
458 Self::PTR
459 }
460 /// Steal an instance of this peripheral
461 ///
462 /// # Safety
463 ///
464 /// Ensure that the new instance of the peripheral cannot be used in a way
465 /// that may race with any existing instances, for example by only
466 /// accessing read-only or write-only registers, or by consuming the
467 /// original peripheral and using critical sections to coordinate
468 /// access between multiple new instances.
469 ///
470 /// Additionally, other software such as HALs may rely on only one
471 /// peripheral instance existing to ensure memory safety; ensure
472 /// no stolen instances are passed to such software.
473 pub unsafe fn steal() -> Self {
474 Self { _marker: PhantomData }
475 }
476}
477impl Deref for EXTI {
478 type Target = exti::RegisterBlock;
479 #[inline(always)]
480 fn deref(&self) -> &Self::Target {
481 unsafe { &*Self::PTR }
482 }
483}
484impl core::fmt::Debug for EXTI {
485 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
486 f.debug_struct("EXTI").finish()
487 }
488}
489///External interrupt/event controller
490pub mod exti;
491///Flash
492///
493///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#FLASH)
494pub struct FLASH {
495 _marker: PhantomData<*const ()>,
496}
497unsafe impl Send for FLASH {}
498impl FLASH {
499 ///Pointer to the register block
500 pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
501 ///Return the pointer to the register block
502 #[inline(always)]
503 pub const fn ptr() -> *const flash::RegisterBlock {
504 Self::PTR
505 }
506 /// Steal an instance of this peripheral
507 ///
508 /// # Safety
509 ///
510 /// Ensure that the new instance of the peripheral cannot be used in a way
511 /// that may race with any existing instances, for example by only
512 /// accessing read-only or write-only registers, or by consuming the
513 /// original peripheral and using critical sections to coordinate
514 /// access between multiple new instances.
515 ///
516 /// Additionally, other software such as HALs may rely on only one
517 /// peripheral instance existing to ensure memory safety; ensure
518 /// no stolen instances are passed to such software.
519 pub unsafe fn steal() -> Self {
520 Self { _marker: PhantomData }
521 }
522}
523impl Deref for FLASH {
524 type Target = flash::RegisterBlock;
525 #[inline(always)]
526 fn deref(&self) -> &Self::Target {
527 unsafe { &*Self::PTR }
528 }
529}
530impl core::fmt::Debug for FLASH {
531 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
532 f.debug_struct("FLASH").finish()
533 }
534}
535///Flash
536pub mod flash;
537///General-purpose I/Os
538///
539///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#GPIOA)
540pub struct GPIOA {
541 _marker: PhantomData<*const ()>,
542}
543unsafe impl Send for GPIOA {}
544impl GPIOA {
545 ///Pointer to the register block
546 pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
547 ///Return the pointer to the register block
548 #[inline(always)]
549 pub const fn ptr() -> *const gpioa::RegisterBlock {
550 Self::PTR
551 }
552 /// Steal an instance of this peripheral
553 ///
554 /// # Safety
555 ///
556 /// Ensure that the new instance of the peripheral cannot be used in a way
557 /// that may race with any existing instances, for example by only
558 /// accessing read-only or write-only registers, or by consuming the
559 /// original peripheral and using critical sections to coordinate
560 /// access between multiple new instances.
561 ///
562 /// Additionally, other software such as HALs may rely on only one
563 /// peripheral instance existing to ensure memory safety; ensure
564 /// no stolen instances are passed to such software.
565 pub unsafe fn steal() -> Self {
566 Self { _marker: PhantomData }
567 }
568}
569impl Deref for GPIOA {
570 type Target = gpioa::RegisterBlock;
571 #[inline(always)]
572 fn deref(&self) -> &Self::Target {
573 unsafe { &*Self::PTR }
574 }
575}
576impl core::fmt::Debug for GPIOA {
577 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
578 f.debug_struct("GPIOA").finish()
579 }
580}
581///General-purpose I/Os
582pub mod gpioa;
583///General-purpose I/Os
584///
585///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#GPIOB)
586pub struct GPIOB {
587 _marker: PhantomData<*const ()>,
588}
589unsafe impl Send for GPIOB {}
590impl GPIOB {
591 ///Pointer to the register block
592 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
593 ///Return the pointer to the register block
594 #[inline(always)]
595 pub const fn ptr() -> *const gpiob::RegisterBlock {
596 Self::PTR
597 }
598 /// Steal an instance of this peripheral
599 ///
600 /// # Safety
601 ///
602 /// Ensure that the new instance of the peripheral cannot be used in a way
603 /// that may race with any existing instances, for example by only
604 /// accessing read-only or write-only registers, or by consuming the
605 /// original peripheral and using critical sections to coordinate
606 /// access between multiple new instances.
607 ///
608 /// Additionally, other software such as HALs may rely on only one
609 /// peripheral instance existing to ensure memory safety; ensure
610 /// no stolen instances are passed to such software.
611 pub unsafe fn steal() -> Self {
612 Self { _marker: PhantomData }
613 }
614}
615impl Deref for GPIOB {
616 type Target = gpiob::RegisterBlock;
617 #[inline(always)]
618 fn deref(&self) -> &Self::Target {
619 unsafe { &*Self::PTR }
620 }
621}
622impl core::fmt::Debug for GPIOB {
623 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
624 f.debug_struct("GPIOB").finish()
625 }
626}
627///General-purpose I/Os
628pub mod gpiob;
629///General-purpose I/Os
630///
631///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#GPIOB)
632pub struct GPIOC {
633 _marker: PhantomData<*const ()>,
634}
635unsafe impl Send for GPIOC {}
636impl GPIOC {
637 ///Pointer to the register block
638 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0800 as *const _;
639 ///Return the pointer to the register block
640 #[inline(always)]
641 pub const fn ptr() -> *const gpiob::RegisterBlock {
642 Self::PTR
643 }
644 /// Steal an instance of this peripheral
645 ///
646 /// # Safety
647 ///
648 /// Ensure that the new instance of the peripheral cannot be used in a way
649 /// that may race with any existing instances, for example by only
650 /// accessing read-only or write-only registers, or by consuming the
651 /// original peripheral and using critical sections to coordinate
652 /// access between multiple new instances.
653 ///
654 /// Additionally, other software such as HALs may rely on only one
655 /// peripheral instance existing to ensure memory safety; ensure
656 /// no stolen instances are passed to such software.
657 pub unsafe fn steal() -> Self {
658 Self { _marker: PhantomData }
659 }
660}
661impl Deref for GPIOC {
662 type Target = gpiob::RegisterBlock;
663 #[inline(always)]
664 fn deref(&self) -> &Self::Target {
665 unsafe { &*Self::PTR }
666 }
667}
668impl core::fmt::Debug for GPIOC {
669 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
670 f.debug_struct("GPIOC").finish()
671 }
672}
673///General-purpose I/Os
674pub use self::gpiob as gpioc;
675///General-purpose I/Os
676///
677///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#GPIOB)
678pub struct GPIOD {
679 _marker: PhantomData<*const ()>,
680}
681unsafe impl Send for GPIOD {}
682impl GPIOD {
683 ///Pointer to the register block
684 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0c00 as *const _;
685 ///Return the pointer to the register block
686 #[inline(always)]
687 pub const fn ptr() -> *const gpiob::RegisterBlock {
688 Self::PTR
689 }
690 /// Steal an instance of this peripheral
691 ///
692 /// # Safety
693 ///
694 /// Ensure that the new instance of the peripheral cannot be used in a way
695 /// that may race with any existing instances, for example by only
696 /// accessing read-only or write-only registers, or by consuming the
697 /// original peripheral and using critical sections to coordinate
698 /// access between multiple new instances.
699 ///
700 /// Additionally, other software such as HALs may rely on only one
701 /// peripheral instance existing to ensure memory safety; ensure
702 /// no stolen instances are passed to such software.
703 pub unsafe fn steal() -> Self {
704 Self { _marker: PhantomData }
705 }
706}
707impl Deref for GPIOD {
708 type Target = gpiob::RegisterBlock;
709 #[inline(always)]
710 fn deref(&self) -> &Self::Target {
711 unsafe { &*Self::PTR }
712 }
713}
714impl core::fmt::Debug for GPIOD {
715 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
716 f.debug_struct("GPIOD").finish()
717 }
718}
719///General-purpose I/Os
720pub use self::gpiob as gpiod;
721///General-purpose I/Os
722///
723///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#GPIOB)
724pub struct GPIOE {
725 _marker: PhantomData<*const ()>,
726}
727unsafe impl Send for GPIOE {}
728impl GPIOE {
729 ///Pointer to the register block
730 pub const PTR: *const gpiob::RegisterBlock = 0x5000_1000 as *const _;
731 ///Return the pointer to the register block
732 #[inline(always)]
733 pub const fn ptr() -> *const gpiob::RegisterBlock {
734 Self::PTR
735 }
736 /// Steal an instance of this peripheral
737 ///
738 /// # Safety
739 ///
740 /// Ensure that the new instance of the peripheral cannot be used in a way
741 /// that may race with any existing instances, for example by only
742 /// accessing read-only or write-only registers, or by consuming the
743 /// original peripheral and using critical sections to coordinate
744 /// access between multiple new instances.
745 ///
746 /// Additionally, other software such as HALs may rely on only one
747 /// peripheral instance existing to ensure memory safety; ensure
748 /// no stolen instances are passed to such software.
749 pub unsafe fn steal() -> Self {
750 Self { _marker: PhantomData }
751 }
752}
753impl Deref for GPIOE {
754 type Target = gpiob::RegisterBlock;
755 #[inline(always)]
756 fn deref(&self) -> &Self::Target {
757 unsafe { &*Self::PTR }
758 }
759}
760impl core::fmt::Debug for GPIOE {
761 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
762 f.debug_struct("GPIOE").finish()
763 }
764}
765///General-purpose I/Os
766pub use self::gpiob as gpioe;
767///General-purpose I/Os
768///
769///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#GPIOB)
770pub struct GPIOF {
771 _marker: PhantomData<*const ()>,
772}
773unsafe impl Send for GPIOF {}
774impl GPIOF {
775 ///Pointer to the register block
776 pub const PTR: *const gpiob::RegisterBlock = 0x5000_1400 as *const _;
777 ///Return the pointer to the register block
778 #[inline(always)]
779 pub const fn ptr() -> *const gpiob::RegisterBlock {
780 Self::PTR
781 }
782 /// Steal an instance of this peripheral
783 ///
784 /// # Safety
785 ///
786 /// Ensure that the new instance of the peripheral cannot be used in a way
787 /// that may race with any existing instances, for example by only
788 /// accessing read-only or write-only registers, or by consuming the
789 /// original peripheral and using critical sections to coordinate
790 /// access between multiple new instances.
791 ///
792 /// Additionally, other software such as HALs may rely on only one
793 /// peripheral instance existing to ensure memory safety; ensure
794 /// no stolen instances are passed to such software.
795 pub unsafe fn steal() -> Self {
796 Self { _marker: PhantomData }
797 }
798}
799impl Deref for GPIOF {
800 type Target = gpiob::RegisterBlock;
801 #[inline(always)]
802 fn deref(&self) -> &Self::Target {
803 unsafe { &*Self::PTR }
804 }
805}
806impl core::fmt::Debug for GPIOF {
807 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
808 f.debug_struct("GPIOF").finish()
809 }
810}
811///General-purpose I/Os
812pub use self::gpiob as gpiof;
813///Inter-integrated circuit
814///
815///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#I2C1)
816pub struct I2C1 {
817 _marker: PhantomData<*const ()>,
818}
819unsafe impl Send for I2C1 {}
820impl I2C1 {
821 ///Pointer to the register block
822 pub const PTR: *const i2c1::RegisterBlock = 0x4000_5400 as *const _;
823 ///Return the pointer to the register block
824 #[inline(always)]
825 pub const fn ptr() -> *const i2c1::RegisterBlock {
826 Self::PTR
827 }
828 /// Steal an instance of this peripheral
829 ///
830 /// # Safety
831 ///
832 /// Ensure that the new instance of the peripheral cannot be used in a way
833 /// that may race with any existing instances, for example by only
834 /// accessing read-only or write-only registers, or by consuming the
835 /// original peripheral and using critical sections to coordinate
836 /// access between multiple new instances.
837 ///
838 /// Additionally, other software such as HALs may rely on only one
839 /// peripheral instance existing to ensure memory safety; ensure
840 /// no stolen instances are passed to such software.
841 pub unsafe fn steal() -> Self {
842 Self { _marker: PhantomData }
843 }
844}
845impl Deref for I2C1 {
846 type Target = i2c1::RegisterBlock;
847 #[inline(always)]
848 fn deref(&self) -> &Self::Target {
849 unsafe { &*Self::PTR }
850 }
851}
852impl core::fmt::Debug for I2C1 {
853 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
854 f.debug_struct("I2C1").finish()
855 }
856}
857///Inter-integrated circuit
858pub mod i2c1;
859///Inter-integrated circuit
860///
861///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#I2C1)
862pub struct I2C2 {
863 _marker: PhantomData<*const ()>,
864}
865unsafe impl Send for I2C2 {}
866impl I2C2 {
867 ///Pointer to the register block
868 pub const PTR: *const i2c1::RegisterBlock = 0x4000_5800 as *const _;
869 ///Return the pointer to the register block
870 #[inline(always)]
871 pub const fn ptr() -> *const i2c1::RegisterBlock {
872 Self::PTR
873 }
874 /// Steal an instance of this peripheral
875 ///
876 /// # Safety
877 ///
878 /// Ensure that the new instance of the peripheral cannot be used in a way
879 /// that may race with any existing instances, for example by only
880 /// accessing read-only or write-only registers, or by consuming the
881 /// original peripheral and using critical sections to coordinate
882 /// access between multiple new instances.
883 ///
884 /// Additionally, other software such as HALs may rely on only one
885 /// peripheral instance existing to ensure memory safety; ensure
886 /// no stolen instances are passed to such software.
887 pub unsafe fn steal() -> Self {
888 Self { _marker: PhantomData }
889 }
890}
891impl Deref for I2C2 {
892 type Target = i2c1::RegisterBlock;
893 #[inline(always)]
894 fn deref(&self) -> &Self::Target {
895 unsafe { &*Self::PTR }
896 }
897}
898impl core::fmt::Debug for I2C2 {
899 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
900 f.debug_struct("I2C2").finish()
901 }
902}
903///Inter-integrated circuit
904pub use self::i2c1 as i2c2;
905///Inter-integrated circuit
906///
907///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#I2C1)
908pub struct I2C3 {
909 _marker: PhantomData<*const ()>,
910}
911unsafe impl Send for I2C3 {}
912impl I2C3 {
913 ///Pointer to the register block
914 pub const PTR: *const i2c1::RegisterBlock = 0x4000_8800 as *const _;
915 ///Return the pointer to the register block
916 #[inline(always)]
917 pub const fn ptr() -> *const i2c1::RegisterBlock {
918 Self::PTR
919 }
920 /// Steal an instance of this peripheral
921 ///
922 /// # Safety
923 ///
924 /// Ensure that the new instance of the peripheral cannot be used in a way
925 /// that may race with any existing instances, for example by only
926 /// accessing read-only or write-only registers, or by consuming the
927 /// original peripheral and using critical sections to coordinate
928 /// access between multiple new instances.
929 ///
930 /// Additionally, other software such as HALs may rely on only one
931 /// peripheral instance existing to ensure memory safety; ensure
932 /// no stolen instances are passed to such software.
933 pub unsafe fn steal() -> Self {
934 Self { _marker: PhantomData }
935 }
936}
937impl Deref for I2C3 {
938 type Target = i2c1::RegisterBlock;
939 #[inline(always)]
940 fn deref(&self) -> &Self::Target {
941 unsafe { &*Self::PTR }
942 }
943}
944impl core::fmt::Debug for I2C3 {
945 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
946 f.debug_struct("I2C3").finish()
947 }
948}
949///Inter-integrated circuit
950pub use self::i2c1 as i2c3;
951///Independent watchdog
952///
953///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#IWDG)
954pub struct IWDG {
955 _marker: PhantomData<*const ()>,
956}
957unsafe impl Send for IWDG {}
958impl IWDG {
959 ///Pointer to the register block
960 pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
961 ///Return the pointer to the register block
962 #[inline(always)]
963 pub const fn ptr() -> *const iwdg::RegisterBlock {
964 Self::PTR
965 }
966 /// Steal an instance of this peripheral
967 ///
968 /// # Safety
969 ///
970 /// Ensure that the new instance of the peripheral cannot be used in a way
971 /// that may race with any existing instances, for example by only
972 /// accessing read-only or write-only registers, or by consuming the
973 /// original peripheral and using critical sections to coordinate
974 /// access between multiple new instances.
975 ///
976 /// Additionally, other software such as HALs may rely on only one
977 /// peripheral instance existing to ensure memory safety; ensure
978 /// no stolen instances are passed to such software.
979 pub unsafe fn steal() -> Self {
980 Self { _marker: PhantomData }
981 }
982}
983impl Deref for IWDG {
984 type Target = iwdg::RegisterBlock;
985 #[inline(always)]
986 fn deref(&self) -> &Self::Target {
987 unsafe { &*Self::PTR }
988 }
989}
990impl core::fmt::Debug for IWDG {
991 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
992 f.debug_struct("IWDG").finish()
993 }
994}
995///Independent watchdog
996pub mod iwdg;
997///Power control
998///
999///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#PWR)
1000pub struct PWR {
1001 _marker: PhantomData<*const ()>,
1002}
1003unsafe impl Send for PWR {}
1004impl PWR {
1005 ///Pointer to the register block
1006 pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
1007 ///Return the pointer to the register block
1008 #[inline(always)]
1009 pub const fn ptr() -> *const pwr::RegisterBlock {
1010 Self::PTR
1011 }
1012 /// Steal an instance of this peripheral
1013 ///
1014 /// # Safety
1015 ///
1016 /// Ensure that the new instance of the peripheral cannot be used in a way
1017 /// that may race with any existing instances, for example by only
1018 /// accessing read-only or write-only registers, or by consuming the
1019 /// original peripheral and using critical sections to coordinate
1020 /// access between multiple new instances.
1021 ///
1022 /// Additionally, other software such as HALs may rely on only one
1023 /// peripheral instance existing to ensure memory safety; ensure
1024 /// no stolen instances are passed to such software.
1025 pub unsafe fn steal() -> Self {
1026 Self { _marker: PhantomData }
1027 }
1028}
1029impl Deref for PWR {
1030 type Target = pwr::RegisterBlock;
1031 #[inline(always)]
1032 fn deref(&self) -> &Self::Target {
1033 unsafe { &*Self::PTR }
1034 }
1035}
1036impl core::fmt::Debug for PWR {
1037 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1038 f.debug_struct("PWR").finish()
1039 }
1040}
1041///Power control
1042pub mod pwr;
1043///Reset and clock control
1044///
1045///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#RCC)
1046pub struct RCC {
1047 _marker: PhantomData<*const ()>,
1048}
1049unsafe impl Send for RCC {}
1050impl RCC {
1051 ///Pointer to the register block
1052 pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
1053 ///Return the pointer to the register block
1054 #[inline(always)]
1055 pub const fn ptr() -> *const rcc::RegisterBlock {
1056 Self::PTR
1057 }
1058 /// Steal an instance of this peripheral
1059 ///
1060 /// # Safety
1061 ///
1062 /// Ensure that the new instance of the peripheral cannot be used in a way
1063 /// that may race with any existing instances, for example by only
1064 /// accessing read-only or write-only registers, or by consuming the
1065 /// original peripheral and using critical sections to coordinate
1066 /// access between multiple new instances.
1067 ///
1068 /// Additionally, other software such as HALs may rely on only one
1069 /// peripheral instance existing to ensure memory safety; ensure
1070 /// no stolen instances are passed to such software.
1071 pub unsafe fn steal() -> Self {
1072 Self { _marker: PhantomData }
1073 }
1074}
1075impl Deref for RCC {
1076 type Target = rcc::RegisterBlock;
1077 #[inline(always)]
1078 fn deref(&self) -> &Self::Target {
1079 unsafe { &*Self::PTR }
1080 }
1081}
1082impl core::fmt::Debug for RCC {
1083 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1084 f.debug_struct("RCC").finish()
1085 }
1086}
1087///Reset and clock control
1088pub mod rcc;
1089///Real-time clock
1090///
1091///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#RTC)
1092pub struct RTC {
1093 _marker: PhantomData<*const ()>,
1094}
1095unsafe impl Send for RTC {}
1096impl RTC {
1097 ///Pointer to the register block
1098 pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
1099 ///Return the pointer to the register block
1100 #[inline(always)]
1101 pub const fn ptr() -> *const rtc::RegisterBlock {
1102 Self::PTR
1103 }
1104 /// Steal an instance of this peripheral
1105 ///
1106 /// # Safety
1107 ///
1108 /// Ensure that the new instance of the peripheral cannot be used in a way
1109 /// that may race with any existing instances, for example by only
1110 /// accessing read-only or write-only registers, or by consuming the
1111 /// original peripheral and using critical sections to coordinate
1112 /// access between multiple new instances.
1113 ///
1114 /// Additionally, other software such as HALs may rely on only one
1115 /// peripheral instance existing to ensure memory safety; ensure
1116 /// no stolen instances are passed to such software.
1117 pub unsafe fn steal() -> Self {
1118 Self { _marker: PhantomData }
1119 }
1120}
1121impl Deref for RTC {
1122 type Target = rtc::RegisterBlock;
1123 #[inline(always)]
1124 fn deref(&self) -> &Self::Target {
1125 unsafe { &*Self::PTR }
1126 }
1127}
1128impl core::fmt::Debug for RTC {
1129 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1130 f.debug_struct("RTC").finish()
1131 }
1132}
1133///Real-time clock
1134pub mod rtc;
1135///Serial peripheral interface/Inter-IC sound
1136///
1137///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#SPI1)
1138pub struct SPI1 {
1139 _marker: PhantomData<*const ()>,
1140}
1141unsafe impl Send for SPI1 {}
1142impl SPI1 {
1143 ///Pointer to the register block
1144 pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
1145 ///Return the pointer to the register block
1146 #[inline(always)]
1147 pub const fn ptr() -> *const spi1::RegisterBlock {
1148 Self::PTR
1149 }
1150 /// Steal an instance of this peripheral
1151 ///
1152 /// # Safety
1153 ///
1154 /// Ensure that the new instance of the peripheral cannot be used in a way
1155 /// that may race with any existing instances, for example by only
1156 /// accessing read-only or write-only registers, or by consuming the
1157 /// original peripheral and using critical sections to coordinate
1158 /// access between multiple new instances.
1159 ///
1160 /// Additionally, other software such as HALs may rely on only one
1161 /// peripheral instance existing to ensure memory safety; ensure
1162 /// no stolen instances are passed to such software.
1163 pub unsafe fn steal() -> Self {
1164 Self { _marker: PhantomData }
1165 }
1166}
1167impl Deref for SPI1 {
1168 type Target = spi1::RegisterBlock;
1169 #[inline(always)]
1170 fn deref(&self) -> &Self::Target {
1171 unsafe { &*Self::PTR }
1172 }
1173}
1174impl core::fmt::Debug for SPI1 {
1175 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1176 f.debug_struct("SPI1").finish()
1177 }
1178}
1179///Serial peripheral interface/Inter-IC sound
1180pub mod spi1;
1181///Serial peripheral interface/Inter-IC sound
1182///
1183///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#SPI1)
1184pub struct SPI2 {
1185 _marker: PhantomData<*const ()>,
1186}
1187unsafe impl Send for SPI2 {}
1188impl SPI2 {
1189 ///Pointer to the register block
1190 pub const PTR: *const spi1::RegisterBlock = 0x4000_3800 as *const _;
1191 ///Return the pointer to the register block
1192 #[inline(always)]
1193 pub const fn ptr() -> *const spi1::RegisterBlock {
1194 Self::PTR
1195 }
1196 /// Steal an instance of this peripheral
1197 ///
1198 /// # Safety
1199 ///
1200 /// Ensure that the new instance of the peripheral cannot be used in a way
1201 /// that may race with any existing instances, for example by only
1202 /// accessing read-only or write-only registers, or by consuming the
1203 /// original peripheral and using critical sections to coordinate
1204 /// access between multiple new instances.
1205 ///
1206 /// Additionally, other software such as HALs may rely on only one
1207 /// peripheral instance existing to ensure memory safety; ensure
1208 /// no stolen instances are passed to such software.
1209 pub unsafe fn steal() -> Self {
1210 Self { _marker: PhantomData }
1211 }
1212}
1213impl Deref for SPI2 {
1214 type Target = spi1::RegisterBlock;
1215 #[inline(always)]
1216 fn deref(&self) -> &Self::Target {
1217 unsafe { &*Self::PTR }
1218 }
1219}
1220impl core::fmt::Debug for SPI2 {
1221 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1222 f.debug_struct("SPI2").finish()
1223 }
1224}
1225///Serial peripheral interface/Inter-IC sound
1226pub use self::spi1 as spi2;
1227///Serial peripheral interface/Inter-IC sound
1228///
1229///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#SPI1)
1230pub struct SPI3 {
1231 _marker: PhantomData<*const ()>,
1232}
1233unsafe impl Send for SPI3 {}
1234impl SPI3 {
1235 ///Pointer to the register block
1236 pub const PTR: *const spi1::RegisterBlock = 0x4000_3c00 as *const _;
1237 ///Return the pointer to the register block
1238 #[inline(always)]
1239 pub const fn ptr() -> *const spi1::RegisterBlock {
1240 Self::PTR
1241 }
1242 /// Steal an instance of this peripheral
1243 ///
1244 /// # Safety
1245 ///
1246 /// Ensure that the new instance of the peripheral cannot be used in a way
1247 /// that may race with any existing instances, for example by only
1248 /// accessing read-only or write-only registers, or by consuming the
1249 /// original peripheral and using critical sections to coordinate
1250 /// access between multiple new instances.
1251 ///
1252 /// Additionally, other software such as HALs may rely on only one
1253 /// peripheral instance existing to ensure memory safety; ensure
1254 /// no stolen instances are passed to such software.
1255 pub unsafe fn steal() -> Self {
1256 Self { _marker: PhantomData }
1257 }
1258}
1259impl Deref for SPI3 {
1260 type Target = spi1::RegisterBlock;
1261 #[inline(always)]
1262 fn deref(&self) -> &Self::Target {
1263 unsafe { &*Self::PTR }
1264 }
1265}
1266impl core::fmt::Debug for SPI3 {
1267 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1268 f.debug_struct("SPI3").finish()
1269 }
1270}
1271///Serial peripheral interface/Inter-IC sound
1272pub use self::spi1 as spi3;
1273///System configuration controller
1274///
1275///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#SYSCFG)
1276pub struct SYSCFG {
1277 _marker: PhantomData<*const ()>,
1278}
1279unsafe impl Send for SYSCFG {}
1280impl SYSCFG {
1281 ///Pointer to the register block
1282 pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
1283 ///Return the pointer to the register block
1284 #[inline(always)]
1285 pub const fn ptr() -> *const syscfg::RegisterBlock {
1286 Self::PTR
1287 }
1288 /// Steal an instance of this peripheral
1289 ///
1290 /// # Safety
1291 ///
1292 /// Ensure that the new instance of the peripheral cannot be used in a way
1293 /// that may race with any existing instances, for example by only
1294 /// accessing read-only or write-only registers, or by consuming the
1295 /// original peripheral and using critical sections to coordinate
1296 /// access between multiple new instances.
1297 ///
1298 /// Additionally, other software such as HALs may rely on only one
1299 /// peripheral instance existing to ensure memory safety; ensure
1300 /// no stolen instances are passed to such software.
1301 pub unsafe fn steal() -> Self {
1302 Self { _marker: PhantomData }
1303 }
1304}
1305impl Deref for SYSCFG {
1306 type Target = syscfg::RegisterBlock;
1307 #[inline(always)]
1308 fn deref(&self) -> &Self::Target {
1309 unsafe { &*Self::PTR }
1310 }
1311}
1312impl core::fmt::Debug for SYSCFG {
1313 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1314 f.debug_struct("SYSCFG").finish()
1315 }
1316}
1317///System configuration controller
1318pub mod syscfg;
1319///Tamper and backup registers
1320///
1321///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TAMP)
1322pub struct TAMP {
1323 _marker: PhantomData<*const ()>,
1324}
1325unsafe impl Send for TAMP {}
1326impl TAMP {
1327 ///Pointer to the register block
1328 pub const PTR: *const tamp::RegisterBlock = 0x4000_b000 as *const _;
1329 ///Return the pointer to the register block
1330 #[inline(always)]
1331 pub const fn ptr() -> *const tamp::RegisterBlock {
1332 Self::PTR
1333 }
1334 /// Steal an instance of this peripheral
1335 ///
1336 /// # Safety
1337 ///
1338 /// Ensure that the new instance of the peripheral cannot be used in a way
1339 /// that may race with any existing instances, for example by only
1340 /// accessing read-only or write-only registers, or by consuming the
1341 /// original peripheral and using critical sections to coordinate
1342 /// access between multiple new instances.
1343 ///
1344 /// Additionally, other software such as HALs may rely on only one
1345 /// peripheral instance existing to ensure memory safety; ensure
1346 /// no stolen instances are passed to such software.
1347 pub unsafe fn steal() -> Self {
1348 Self { _marker: PhantomData }
1349 }
1350}
1351impl Deref for TAMP {
1352 type Target = tamp::RegisterBlock;
1353 #[inline(always)]
1354 fn deref(&self) -> &Self::Target {
1355 unsafe { &*Self::PTR }
1356 }
1357}
1358impl core::fmt::Debug for TAMP {
1359 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1360 f.debug_struct("TAMP").finish()
1361 }
1362}
1363///Tamper and backup registers
1364pub mod tamp;
1365///Advanced-timers
1366///
1367///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM1)
1368pub struct TIM1 {
1369 _marker: PhantomData<*const ()>,
1370}
1371unsafe impl Send for TIM1 {}
1372impl TIM1 {
1373 ///Pointer to the register block
1374 pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
1375 ///Return the pointer to the register block
1376 #[inline(always)]
1377 pub const fn ptr() -> *const tim1::RegisterBlock {
1378 Self::PTR
1379 }
1380 /// Steal an instance of this peripheral
1381 ///
1382 /// # Safety
1383 ///
1384 /// Ensure that the new instance of the peripheral cannot be used in a way
1385 /// that may race with any existing instances, for example by only
1386 /// accessing read-only or write-only registers, or by consuming the
1387 /// original peripheral and using critical sections to coordinate
1388 /// access between multiple new instances.
1389 ///
1390 /// Additionally, other software such as HALs may rely on only one
1391 /// peripheral instance existing to ensure memory safety; ensure
1392 /// no stolen instances are passed to such software.
1393 pub unsafe fn steal() -> Self {
1394 Self { _marker: PhantomData }
1395 }
1396}
1397impl Deref for TIM1 {
1398 type Target = tim1::RegisterBlock;
1399 #[inline(always)]
1400 fn deref(&self) -> &Self::Target {
1401 unsafe { &*Self::PTR }
1402 }
1403}
1404impl core::fmt::Debug for TIM1 {
1405 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1406 f.debug_struct("TIM1").finish()
1407 }
1408}
1409///Advanced-timers
1410pub mod tim1;
1411///General-purpose-timers
1412///
1413///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM3)
1414pub struct TIM3 {
1415 _marker: PhantomData<*const ()>,
1416}
1417unsafe impl Send for TIM3 {}
1418impl TIM3 {
1419 ///Pointer to the register block
1420 pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
1421 ///Return the pointer to the register block
1422 #[inline(always)]
1423 pub const fn ptr() -> *const tim3::RegisterBlock {
1424 Self::PTR
1425 }
1426 /// Steal an instance of this peripheral
1427 ///
1428 /// # Safety
1429 ///
1430 /// Ensure that the new instance of the peripheral cannot be used in a way
1431 /// that may race with any existing instances, for example by only
1432 /// accessing read-only or write-only registers, or by consuming the
1433 /// original peripheral and using critical sections to coordinate
1434 /// access between multiple new instances.
1435 ///
1436 /// Additionally, other software such as HALs may rely on only one
1437 /// peripheral instance existing to ensure memory safety; ensure
1438 /// no stolen instances are passed to such software.
1439 pub unsafe fn steal() -> Self {
1440 Self { _marker: PhantomData }
1441 }
1442}
1443impl Deref for TIM3 {
1444 type Target = tim3::RegisterBlock;
1445 #[inline(always)]
1446 fn deref(&self) -> &Self::Target {
1447 unsafe { &*Self::PTR }
1448 }
1449}
1450impl core::fmt::Debug for TIM3 {
1451 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1452 f.debug_struct("TIM3").finish()
1453 }
1454}
1455///General-purpose-timers
1456pub mod tim3;
1457///General-purpose-timers
1458///
1459///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM3)
1460pub struct TIM4 {
1461 _marker: PhantomData<*const ()>,
1462}
1463unsafe impl Send for TIM4 {}
1464impl TIM4 {
1465 ///Pointer to the register block
1466 pub const PTR: *const tim3::RegisterBlock = 0x4000_0800 as *const _;
1467 ///Return the pointer to the register block
1468 #[inline(always)]
1469 pub const fn ptr() -> *const tim3::RegisterBlock {
1470 Self::PTR
1471 }
1472 /// Steal an instance of this peripheral
1473 ///
1474 /// # Safety
1475 ///
1476 /// Ensure that the new instance of the peripheral cannot be used in a way
1477 /// that may race with any existing instances, for example by only
1478 /// accessing read-only or write-only registers, or by consuming the
1479 /// original peripheral and using critical sections to coordinate
1480 /// access between multiple new instances.
1481 ///
1482 /// Additionally, other software such as HALs may rely on only one
1483 /// peripheral instance existing to ensure memory safety; ensure
1484 /// no stolen instances are passed to such software.
1485 pub unsafe fn steal() -> Self {
1486 Self { _marker: PhantomData }
1487 }
1488}
1489impl Deref for TIM4 {
1490 type Target = tim3::RegisterBlock;
1491 #[inline(always)]
1492 fn deref(&self) -> &Self::Target {
1493 unsafe { &*Self::PTR }
1494 }
1495}
1496impl core::fmt::Debug for TIM4 {
1497 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1498 f.debug_struct("TIM4").finish()
1499 }
1500}
1501///General-purpose-timers
1502pub use self::tim3 as tim4;
1503///Basic timers
1504///
1505///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM6)
1506pub struct TIM6 {
1507 _marker: PhantomData<*const ()>,
1508}
1509unsafe impl Send for TIM6 {}
1510impl TIM6 {
1511 ///Pointer to the register block
1512 pub const PTR: *const tim6::RegisterBlock = 0x4000_1000 as *const _;
1513 ///Return the pointer to the register block
1514 #[inline(always)]
1515 pub const fn ptr() -> *const tim6::RegisterBlock {
1516 Self::PTR
1517 }
1518 /// Steal an instance of this peripheral
1519 ///
1520 /// # Safety
1521 ///
1522 /// Ensure that the new instance of the peripheral cannot be used in a way
1523 /// that may race with any existing instances, for example by only
1524 /// accessing read-only or write-only registers, or by consuming the
1525 /// original peripheral and using critical sections to coordinate
1526 /// access between multiple new instances.
1527 ///
1528 /// Additionally, other software such as HALs may rely on only one
1529 /// peripheral instance existing to ensure memory safety; ensure
1530 /// no stolen instances are passed to such software.
1531 pub unsafe fn steal() -> Self {
1532 Self { _marker: PhantomData }
1533 }
1534}
1535impl Deref for TIM6 {
1536 type Target = tim6::RegisterBlock;
1537 #[inline(always)]
1538 fn deref(&self) -> &Self::Target {
1539 unsafe { &*Self::PTR }
1540 }
1541}
1542impl core::fmt::Debug for TIM6 {
1543 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1544 f.debug_struct("TIM6").finish()
1545 }
1546}
1547///Basic timers
1548pub mod tim6;
1549///Basic timers
1550///
1551///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM6)
1552pub struct TIM7 {
1553 _marker: PhantomData<*const ()>,
1554}
1555unsafe impl Send for TIM7 {}
1556impl TIM7 {
1557 ///Pointer to the register block
1558 pub const PTR: *const tim6::RegisterBlock = 0x4000_1400 as *const _;
1559 ///Return the pointer to the register block
1560 #[inline(always)]
1561 pub const fn ptr() -> *const tim6::RegisterBlock {
1562 Self::PTR
1563 }
1564 /// Steal an instance of this peripheral
1565 ///
1566 /// # Safety
1567 ///
1568 /// Ensure that the new instance of the peripheral cannot be used in a way
1569 /// that may race with any existing instances, for example by only
1570 /// accessing read-only or write-only registers, or by consuming the
1571 /// original peripheral and using critical sections to coordinate
1572 /// access between multiple new instances.
1573 ///
1574 /// Additionally, other software such as HALs may rely on only one
1575 /// peripheral instance existing to ensure memory safety; ensure
1576 /// no stolen instances are passed to such software.
1577 pub unsafe fn steal() -> Self {
1578 Self { _marker: PhantomData }
1579 }
1580}
1581impl Deref for TIM7 {
1582 type Target = tim6::RegisterBlock;
1583 #[inline(always)]
1584 fn deref(&self) -> &Self::Target {
1585 unsafe { &*Self::PTR }
1586 }
1587}
1588impl core::fmt::Debug for TIM7 {
1589 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1590 f.debug_struct("TIM7").finish()
1591 }
1592}
1593///Basic timers
1594pub use self::tim6 as tim7;
1595///General purpose timers
1596///
1597///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM14)
1598pub struct TIM14 {
1599 _marker: PhantomData<*const ()>,
1600}
1601unsafe impl Send for TIM14 {}
1602impl TIM14 {
1603 ///Pointer to the register block
1604 pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
1605 ///Return the pointer to the register block
1606 #[inline(always)]
1607 pub const fn ptr() -> *const tim14::RegisterBlock {
1608 Self::PTR
1609 }
1610 /// Steal an instance of this peripheral
1611 ///
1612 /// # Safety
1613 ///
1614 /// Ensure that the new instance of the peripheral cannot be used in a way
1615 /// that may race with any existing instances, for example by only
1616 /// accessing read-only or write-only registers, or by consuming the
1617 /// original peripheral and using critical sections to coordinate
1618 /// access between multiple new instances.
1619 ///
1620 /// Additionally, other software such as HALs may rely on only one
1621 /// peripheral instance existing to ensure memory safety; ensure
1622 /// no stolen instances are passed to such software.
1623 pub unsafe fn steal() -> Self {
1624 Self { _marker: PhantomData }
1625 }
1626}
1627impl Deref for TIM14 {
1628 type Target = tim14::RegisterBlock;
1629 #[inline(always)]
1630 fn deref(&self) -> &Self::Target {
1631 unsafe { &*Self::PTR }
1632 }
1633}
1634impl core::fmt::Debug for TIM14 {
1635 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1636 f.debug_struct("TIM14").finish()
1637 }
1638}
1639///General purpose timers
1640pub mod tim14;
1641///General purpose timers
1642///
1643///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM15)
1644pub struct TIM15 {
1645 _marker: PhantomData<*const ()>,
1646}
1647unsafe impl Send for TIM15 {}
1648impl TIM15 {
1649 ///Pointer to the register block
1650 pub const PTR: *const tim15::RegisterBlock = 0x4001_4000 as *const _;
1651 ///Return the pointer to the register block
1652 #[inline(always)]
1653 pub const fn ptr() -> *const tim15::RegisterBlock {
1654 Self::PTR
1655 }
1656 /// Steal an instance of this peripheral
1657 ///
1658 /// # Safety
1659 ///
1660 /// Ensure that the new instance of the peripheral cannot be used in a way
1661 /// that may race with any existing instances, for example by only
1662 /// accessing read-only or write-only registers, or by consuming the
1663 /// original peripheral and using critical sections to coordinate
1664 /// access between multiple new instances.
1665 ///
1666 /// Additionally, other software such as HALs may rely on only one
1667 /// peripheral instance existing to ensure memory safety; ensure
1668 /// no stolen instances are passed to such software.
1669 pub unsafe fn steal() -> Self {
1670 Self { _marker: PhantomData }
1671 }
1672}
1673impl Deref for TIM15 {
1674 type Target = tim15::RegisterBlock;
1675 #[inline(always)]
1676 fn deref(&self) -> &Self::Target {
1677 unsafe { &*Self::PTR }
1678 }
1679}
1680impl core::fmt::Debug for TIM15 {
1681 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1682 f.debug_struct("TIM15").finish()
1683 }
1684}
1685///General purpose timers
1686pub mod tim15;
1687///General purpose timers
1688///
1689///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM16)
1690pub struct TIM16 {
1691 _marker: PhantomData<*const ()>,
1692}
1693unsafe impl Send for TIM16 {}
1694impl TIM16 {
1695 ///Pointer to the register block
1696 pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
1697 ///Return the pointer to the register block
1698 #[inline(always)]
1699 pub const fn ptr() -> *const tim16::RegisterBlock {
1700 Self::PTR
1701 }
1702 /// Steal an instance of this peripheral
1703 ///
1704 /// # Safety
1705 ///
1706 /// Ensure that the new instance of the peripheral cannot be used in a way
1707 /// that may race with any existing instances, for example by only
1708 /// accessing read-only or write-only registers, or by consuming the
1709 /// original peripheral and using critical sections to coordinate
1710 /// access between multiple new instances.
1711 ///
1712 /// Additionally, other software such as HALs may rely on only one
1713 /// peripheral instance existing to ensure memory safety; ensure
1714 /// no stolen instances are passed to such software.
1715 pub unsafe fn steal() -> Self {
1716 Self { _marker: PhantomData }
1717 }
1718}
1719impl Deref for TIM16 {
1720 type Target = tim16::RegisterBlock;
1721 #[inline(always)]
1722 fn deref(&self) -> &Self::Target {
1723 unsafe { &*Self::PTR }
1724 }
1725}
1726impl core::fmt::Debug for TIM16 {
1727 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1728 f.debug_struct("TIM16").finish()
1729 }
1730}
1731///General purpose timers
1732pub mod tim16;
1733///General purpose timers
1734///
1735///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#TIM16)
1736pub struct TIM17 {
1737 _marker: PhantomData<*const ()>,
1738}
1739unsafe impl Send for TIM17 {}
1740impl TIM17 {
1741 ///Pointer to the register block
1742 pub const PTR: *const tim16::RegisterBlock = 0x4001_4800 as *const _;
1743 ///Return the pointer to the register block
1744 #[inline(always)]
1745 pub const fn ptr() -> *const tim16::RegisterBlock {
1746 Self::PTR
1747 }
1748 /// Steal an instance of this peripheral
1749 ///
1750 /// # Safety
1751 ///
1752 /// Ensure that the new instance of the peripheral cannot be used in a way
1753 /// that may race with any existing instances, for example by only
1754 /// accessing read-only or write-only registers, or by consuming the
1755 /// original peripheral and using critical sections to coordinate
1756 /// access between multiple new instances.
1757 ///
1758 /// Additionally, other software such as HALs may rely on only one
1759 /// peripheral instance existing to ensure memory safety; ensure
1760 /// no stolen instances are passed to such software.
1761 pub unsafe fn steal() -> Self {
1762 Self { _marker: PhantomData }
1763 }
1764}
1765impl Deref for TIM17 {
1766 type Target = tim16::RegisterBlock;
1767 #[inline(always)]
1768 fn deref(&self) -> &Self::Target {
1769 unsafe { &*Self::PTR }
1770 }
1771}
1772impl core::fmt::Debug for TIM17 {
1773 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1774 f.debug_struct("TIM17").finish()
1775 }
1776}
1777///General purpose timers
1778pub use self::tim16 as tim17;
1779///Universal synchronous asynchronous receiver transmitter
1780///
1781///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#USART1)
1782pub struct USART1 {
1783 _marker: PhantomData<*const ()>,
1784}
1785unsafe impl Send for USART1 {}
1786impl USART1 {
1787 ///Pointer to the register block
1788 pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
1789 ///Return the pointer to the register block
1790 #[inline(always)]
1791 pub const fn ptr() -> *const usart1::RegisterBlock {
1792 Self::PTR
1793 }
1794 /// Steal an instance of this peripheral
1795 ///
1796 /// # Safety
1797 ///
1798 /// Ensure that the new instance of the peripheral cannot be used in a way
1799 /// that may race with any existing instances, for example by only
1800 /// accessing read-only or write-only registers, or by consuming the
1801 /// original peripheral and using critical sections to coordinate
1802 /// access between multiple new instances.
1803 ///
1804 /// Additionally, other software such as HALs may rely on only one
1805 /// peripheral instance existing to ensure memory safety; ensure
1806 /// no stolen instances are passed to such software.
1807 pub unsafe fn steal() -> Self {
1808 Self { _marker: PhantomData }
1809 }
1810}
1811impl Deref for USART1 {
1812 type Target = usart1::RegisterBlock;
1813 #[inline(always)]
1814 fn deref(&self) -> &Self::Target {
1815 unsafe { &*Self::PTR }
1816 }
1817}
1818impl core::fmt::Debug for USART1 {
1819 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1820 f.debug_struct("USART1").finish()
1821 }
1822}
1823///Universal synchronous asynchronous receiver transmitter
1824pub mod usart1;
1825///Universal synchronous asynchronous receiver transmitter
1826///
1827///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#USART1)
1828pub struct USART2 {
1829 _marker: PhantomData<*const ()>,
1830}
1831unsafe impl Send for USART2 {}
1832impl USART2 {
1833 ///Pointer to the register block
1834 pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
1835 ///Return the pointer to the register block
1836 #[inline(always)]
1837 pub const fn ptr() -> *const usart1::RegisterBlock {
1838 Self::PTR
1839 }
1840 /// Steal an instance of this peripheral
1841 ///
1842 /// # Safety
1843 ///
1844 /// Ensure that the new instance of the peripheral cannot be used in a way
1845 /// that may race with any existing instances, for example by only
1846 /// accessing read-only or write-only registers, or by consuming the
1847 /// original peripheral and using critical sections to coordinate
1848 /// access between multiple new instances.
1849 ///
1850 /// Additionally, other software such as HALs may rely on only one
1851 /// peripheral instance existing to ensure memory safety; ensure
1852 /// no stolen instances are passed to such software.
1853 pub unsafe fn steal() -> Self {
1854 Self { _marker: PhantomData }
1855 }
1856}
1857impl Deref for USART2 {
1858 type Target = usart1::RegisterBlock;
1859 #[inline(always)]
1860 fn deref(&self) -> &Self::Target {
1861 unsafe { &*Self::PTR }
1862 }
1863}
1864impl core::fmt::Debug for USART2 {
1865 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1866 f.debug_struct("USART2").finish()
1867 }
1868}
1869///Universal synchronous asynchronous receiver transmitter
1870pub use self::usart1 as usart2;
1871///Universal synchronous asynchronous receiver transmitter
1872///
1873///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#USART1)
1874pub struct USART3 {
1875 _marker: PhantomData<*const ()>,
1876}
1877unsafe impl Send for USART3 {}
1878impl USART3 {
1879 ///Pointer to the register block
1880 pub const PTR: *const usart1::RegisterBlock = 0x4000_4800 as *const _;
1881 ///Return the pointer to the register block
1882 #[inline(always)]
1883 pub const fn ptr() -> *const usart1::RegisterBlock {
1884 Self::PTR
1885 }
1886 /// Steal an instance of this peripheral
1887 ///
1888 /// # Safety
1889 ///
1890 /// Ensure that the new instance of the peripheral cannot be used in a way
1891 /// that may race with any existing instances, for example by only
1892 /// accessing read-only or write-only registers, or by consuming the
1893 /// original peripheral and using critical sections to coordinate
1894 /// access between multiple new instances.
1895 ///
1896 /// Additionally, other software such as HALs may rely on only one
1897 /// peripheral instance existing to ensure memory safety; ensure
1898 /// no stolen instances are passed to such software.
1899 pub unsafe fn steal() -> Self {
1900 Self { _marker: PhantomData }
1901 }
1902}
1903impl Deref for USART3 {
1904 type Target = usart1::RegisterBlock;
1905 #[inline(always)]
1906 fn deref(&self) -> &Self::Target {
1907 unsafe { &*Self::PTR }
1908 }
1909}
1910impl core::fmt::Debug for USART3 {
1911 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1912 f.debug_struct("USART3").finish()
1913 }
1914}
1915///Universal synchronous asynchronous receiver transmitter
1916pub use self::usart1 as usart3;
1917///Universal synchronous asynchronous receiver transmitter
1918///
1919///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#USART1)
1920pub struct USART4 {
1921 _marker: PhantomData<*const ()>,
1922}
1923unsafe impl Send for USART4 {}
1924impl USART4 {
1925 ///Pointer to the register block
1926 pub const PTR: *const usart1::RegisterBlock = 0x4000_4c00 as *const _;
1927 ///Return the pointer to the register block
1928 #[inline(always)]
1929 pub const fn ptr() -> *const usart1::RegisterBlock {
1930 Self::PTR
1931 }
1932 /// Steal an instance of this peripheral
1933 ///
1934 /// # Safety
1935 ///
1936 /// Ensure that the new instance of the peripheral cannot be used in a way
1937 /// that may race with any existing instances, for example by only
1938 /// accessing read-only or write-only registers, or by consuming the
1939 /// original peripheral and using critical sections to coordinate
1940 /// access between multiple new instances.
1941 ///
1942 /// Additionally, other software such as HALs may rely on only one
1943 /// peripheral instance existing to ensure memory safety; ensure
1944 /// no stolen instances are passed to such software.
1945 pub unsafe fn steal() -> Self {
1946 Self { _marker: PhantomData }
1947 }
1948}
1949impl Deref for USART4 {
1950 type Target = usart1::RegisterBlock;
1951 #[inline(always)]
1952 fn deref(&self) -> &Self::Target {
1953 unsafe { &*Self::PTR }
1954 }
1955}
1956impl core::fmt::Debug for USART4 {
1957 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1958 f.debug_struct("USART4").finish()
1959 }
1960}
1961///Universal synchronous asynchronous receiver transmitter
1962pub use self::usart1 as usart4;
1963///Universal synchronous asynchronous receiver transmitter
1964///
1965///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#USART1)
1966pub struct USART5 {
1967 _marker: PhantomData<*const ()>,
1968}
1969unsafe impl Send for USART5 {}
1970impl USART5 {
1971 ///Pointer to the register block
1972 pub const PTR: *const usart1::RegisterBlock = 0x4000_5000 as *const _;
1973 ///Return the pointer to the register block
1974 #[inline(always)]
1975 pub const fn ptr() -> *const usart1::RegisterBlock {
1976 Self::PTR
1977 }
1978 /// Steal an instance of this peripheral
1979 ///
1980 /// # Safety
1981 ///
1982 /// Ensure that the new instance of the peripheral cannot be used in a way
1983 /// that may race with any existing instances, for example by only
1984 /// accessing read-only or write-only registers, or by consuming the
1985 /// original peripheral and using critical sections to coordinate
1986 /// access between multiple new instances.
1987 ///
1988 /// Additionally, other software such as HALs may rely on only one
1989 /// peripheral instance existing to ensure memory safety; ensure
1990 /// no stolen instances are passed to such software.
1991 pub unsafe fn steal() -> Self {
1992 Self { _marker: PhantomData }
1993 }
1994}
1995impl Deref for USART5 {
1996 type Target = usart1::RegisterBlock;
1997 #[inline(always)]
1998 fn deref(&self) -> &Self::Target {
1999 unsafe { &*Self::PTR }
2000 }
2001}
2002impl core::fmt::Debug for USART5 {
2003 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2004 f.debug_struct("USART5").finish()
2005 }
2006}
2007///Universal synchronous asynchronous receiver transmitter
2008pub use self::usart1 as usart5;
2009///Universal synchronous asynchronous receiver transmitter
2010///
2011///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#USART1)
2012pub struct USART6 {
2013 _marker: PhantomData<*const ()>,
2014}
2015unsafe impl Send for USART6 {}
2016impl USART6 {
2017 ///Pointer to the register block
2018 pub const PTR: *const usart1::RegisterBlock = 0x4001_3c00 as *const _;
2019 ///Return the pointer to the register block
2020 #[inline(always)]
2021 pub const fn ptr() -> *const usart1::RegisterBlock {
2022 Self::PTR
2023 }
2024 /// Steal an instance of this peripheral
2025 ///
2026 /// # Safety
2027 ///
2028 /// Ensure that the new instance of the peripheral cannot be used in a way
2029 /// that may race with any existing instances, for example by only
2030 /// accessing read-only or write-only registers, or by consuming the
2031 /// original peripheral and using critical sections to coordinate
2032 /// access between multiple new instances.
2033 ///
2034 /// Additionally, other software such as HALs may rely on only one
2035 /// peripheral instance existing to ensure memory safety; ensure
2036 /// no stolen instances are passed to such software.
2037 pub unsafe fn steal() -> Self {
2038 Self { _marker: PhantomData }
2039 }
2040}
2041impl Deref for USART6 {
2042 type Target = usart1::RegisterBlock;
2043 #[inline(always)]
2044 fn deref(&self) -> &Self::Target {
2045 unsafe { &*Self::PTR }
2046 }
2047}
2048impl core::fmt::Debug for USART6 {
2049 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2050 f.debug_struct("USART6").finish()
2051 }
2052}
2053///Universal synchronous asynchronous receiver transmitter
2054pub use self::usart1 as usart6;
2055///Universal serial bus full-speed host/device interface4
2056///
2057///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#USB)
2058pub struct USB {
2059 _marker: PhantomData<*const ()>,
2060}
2061unsafe impl Send for USB {}
2062impl USB {
2063 ///Pointer to the register block
2064 pub const PTR: *const usb::RegisterBlock = 0x4000_5c00 as *const _;
2065 ///Return the pointer to the register block
2066 #[inline(always)]
2067 pub const fn ptr() -> *const usb::RegisterBlock {
2068 Self::PTR
2069 }
2070 /// Steal an instance of this peripheral
2071 ///
2072 /// # Safety
2073 ///
2074 /// Ensure that the new instance of the peripheral cannot be used in a way
2075 /// that may race with any existing instances, for example by only
2076 /// accessing read-only or write-only registers, or by consuming the
2077 /// original peripheral and using critical sections to coordinate
2078 /// access between multiple new instances.
2079 ///
2080 /// Additionally, other software such as HALs may rely on only one
2081 /// peripheral instance existing to ensure memory safety; ensure
2082 /// no stolen instances are passed to such software.
2083 pub unsafe fn steal() -> Self {
2084 Self { _marker: PhantomData }
2085 }
2086}
2087impl Deref for USB {
2088 type Target = usb::RegisterBlock;
2089 #[inline(always)]
2090 fn deref(&self) -> &Self::Target {
2091 unsafe { &*Self::PTR }
2092 }
2093}
2094impl core::fmt::Debug for USB {
2095 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2096 f.debug_struct("USB").finish()
2097 }
2098}
2099///Universal serial bus full-speed host/device interface4
2100pub mod usb;
2101///System configuration controller
2102///
2103///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#VREFBUF)
2104pub struct VREFBUF {
2105 _marker: PhantomData<*const ()>,
2106}
2107unsafe impl Send for VREFBUF {}
2108impl VREFBUF {
2109 ///Pointer to the register block
2110 pub const PTR: *const vrefbuf::RegisterBlock = 0x4001_0030 as *const _;
2111 ///Return the pointer to the register block
2112 #[inline(always)]
2113 pub const fn ptr() -> *const vrefbuf::RegisterBlock {
2114 Self::PTR
2115 }
2116 /// Steal an instance of this peripheral
2117 ///
2118 /// # Safety
2119 ///
2120 /// Ensure that the new instance of the peripheral cannot be used in a way
2121 /// that may race with any existing instances, for example by only
2122 /// accessing read-only or write-only registers, or by consuming the
2123 /// original peripheral and using critical sections to coordinate
2124 /// access between multiple new instances.
2125 ///
2126 /// Additionally, other software such as HALs may rely on only one
2127 /// peripheral instance existing to ensure memory safety; ensure
2128 /// no stolen instances are passed to such software.
2129 pub unsafe fn steal() -> Self {
2130 Self { _marker: PhantomData }
2131 }
2132}
2133impl Deref for VREFBUF {
2134 type Target = vrefbuf::RegisterBlock;
2135 #[inline(always)]
2136 fn deref(&self) -> &Self::Target {
2137 unsafe { &*Self::PTR }
2138 }
2139}
2140impl core::fmt::Debug for VREFBUF {
2141 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2142 f.debug_struct("VREFBUF").finish()
2143 }
2144}
2145///System configuration controller
2146pub mod vrefbuf;
2147///System window watchdog
2148///
2149///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0B0.html#WWDG)
2150pub struct WWDG {
2151 _marker: PhantomData<*const ()>,
2152}
2153unsafe impl Send for WWDG {}
2154impl WWDG {
2155 ///Pointer to the register block
2156 pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
2157 ///Return the pointer to the register block
2158 #[inline(always)]
2159 pub const fn ptr() -> *const wwdg::RegisterBlock {
2160 Self::PTR
2161 }
2162 /// Steal an instance of this peripheral
2163 ///
2164 /// # Safety
2165 ///
2166 /// Ensure that the new instance of the peripheral cannot be used in a way
2167 /// that may race with any existing instances, for example by only
2168 /// accessing read-only or write-only registers, or by consuming the
2169 /// original peripheral and using critical sections to coordinate
2170 /// access between multiple new instances.
2171 ///
2172 /// Additionally, other software such as HALs may rely on only one
2173 /// peripheral instance existing to ensure memory safety; ensure
2174 /// no stolen instances are passed to such software.
2175 pub unsafe fn steal() -> Self {
2176 Self { _marker: PhantomData }
2177 }
2178}
2179impl Deref for WWDG {
2180 type Target = wwdg::RegisterBlock;
2181 #[inline(always)]
2182 fn deref(&self) -> &Self::Target {
2183 unsafe { &*Self::PTR }
2184 }
2185}
2186impl core::fmt::Debug for WWDG {
2187 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2188 f.debug_struct("WWDG").finish()
2189 }
2190}
2191///System window watchdog
2192pub mod wwdg;
2193#[no_mangle]
2194static mut DEVICE_PERIPHERALS: bool = false;
2195/// All the peripherals.
2196#[allow(non_snake_case)]
2197pub struct Peripherals {
2198 ///ADC
2199 pub ADC: ADC,
2200 ///CRC
2201 pub CRC: CRC,
2202 ///DBG
2203 pub DBG: DBG,
2204 ///DMA1
2205 pub DMA1: DMA1,
2206 ///DMA2
2207 pub DMA2: DMA2,
2208 ///DMAMUX
2209 pub DMAMUX: DMAMUX,
2210 ///EXTI
2211 pub EXTI: EXTI,
2212 ///FLASH
2213 pub FLASH: FLASH,
2214 ///GPIOA
2215 pub GPIOA: GPIOA,
2216 ///GPIOB
2217 pub GPIOB: GPIOB,
2218 ///GPIOC
2219 pub GPIOC: GPIOC,
2220 ///GPIOD
2221 pub GPIOD: GPIOD,
2222 ///GPIOE
2223 pub GPIOE: GPIOE,
2224 ///GPIOF
2225 pub GPIOF: GPIOF,
2226 ///I2C1
2227 pub I2C1: I2C1,
2228 ///I2C2
2229 pub I2C2: I2C2,
2230 ///I2C3
2231 pub I2C3: I2C3,
2232 ///IWDG
2233 pub IWDG: IWDG,
2234 ///PWR
2235 pub PWR: PWR,
2236 ///RCC
2237 pub RCC: RCC,
2238 ///RTC
2239 pub RTC: RTC,
2240 ///SPI1
2241 pub SPI1: SPI1,
2242 ///SPI2
2243 pub SPI2: SPI2,
2244 ///SPI3
2245 pub SPI3: SPI3,
2246 ///SYSCFG
2247 pub SYSCFG: SYSCFG,
2248 ///TAMP
2249 pub TAMP: TAMP,
2250 ///TIM1
2251 pub TIM1: TIM1,
2252 ///TIM3
2253 pub TIM3: TIM3,
2254 ///TIM4
2255 pub TIM4: TIM4,
2256 ///TIM6
2257 pub TIM6: TIM6,
2258 ///TIM7
2259 pub TIM7: TIM7,
2260 ///TIM14
2261 pub TIM14: TIM14,
2262 ///TIM15
2263 pub TIM15: TIM15,
2264 ///TIM16
2265 pub TIM16: TIM16,
2266 ///TIM17
2267 pub TIM17: TIM17,
2268 ///USART1
2269 pub USART1: USART1,
2270 ///USART2
2271 pub USART2: USART2,
2272 ///USART3
2273 pub USART3: USART3,
2274 ///USART4
2275 pub USART4: USART4,
2276 ///USART5
2277 pub USART5: USART5,
2278 ///USART6
2279 pub USART6: USART6,
2280 ///USB
2281 pub USB: USB,
2282 ///VREFBUF
2283 pub VREFBUF: VREFBUF,
2284 ///WWDG
2285 pub WWDG: WWDG,
2286}
2287impl Peripherals {
2288 /// Returns all the peripherals *once*.
2289 #[cfg(feature = "critical-section")]
2290 #[inline]
2291 pub fn take() -> Option<Self> {
2292 critical_section::with(|_| {
2293 if unsafe { DEVICE_PERIPHERALS } {
2294 return None;
2295 }
2296 Some(unsafe { Peripherals::steal() })
2297 })
2298 }
2299 /// Unchecked version of `Peripherals::take`.
2300 ///
2301 /// # Safety
2302 ///
2303 /// Each of the returned peripherals must be used at most once.
2304 #[inline]
2305 pub unsafe fn steal() -> Self {
2306 DEVICE_PERIPHERALS = true;
2307 Peripherals {
2308 ADC: ADC::steal(),
2309 CRC: CRC::steal(),
2310 DBG: DBG::steal(),
2311 DMA1: DMA1::steal(),
2312 DMA2: DMA2::steal(),
2313 DMAMUX: DMAMUX::steal(),
2314 EXTI: EXTI::steal(),
2315 FLASH: FLASH::steal(),
2316 GPIOA: GPIOA::steal(),
2317 GPIOB: GPIOB::steal(),
2318 GPIOC: GPIOC::steal(),
2319 GPIOD: GPIOD::steal(),
2320 GPIOE: GPIOE::steal(),
2321 GPIOF: GPIOF::steal(),
2322 I2C1: I2C1::steal(),
2323 I2C2: I2C2::steal(),
2324 I2C3: I2C3::steal(),
2325 IWDG: IWDG::steal(),
2326 PWR: PWR::steal(),
2327 RCC: RCC::steal(),
2328 RTC: RTC::steal(),
2329 SPI1: SPI1::steal(),
2330 SPI2: SPI2::steal(),
2331 SPI3: SPI3::steal(),
2332 SYSCFG: SYSCFG::steal(),
2333 TAMP: TAMP::steal(),
2334 TIM1: TIM1::steal(),
2335 TIM3: TIM3::steal(),
2336 TIM4: TIM4::steal(),
2337 TIM6: TIM6::steal(),
2338 TIM7: TIM7::steal(),
2339 TIM14: TIM14::steal(),
2340 TIM15: TIM15::steal(),
2341 TIM16: TIM16::steal(),
2342 TIM17: TIM17::steal(),
2343 USART1: USART1::steal(),
2344 USART2: USART2::steal(),
2345 USART3: USART3::steal(),
2346 USART4: USART4::steal(),
2347 USART5: USART5::steal(),
2348 USART6: USART6::steal(),
2349 USB: USB::steal(),
2350 VREFBUF: VREFBUF::steal(),
2351 WWDG: WWDG::steal(),
2352 }
2353 }
2354}