stm32g0_staging/stm32g081/
mod.rs

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