PY32f030xx_pac/
lib.rs

1#![doc = "Peripheral access API for PY32F0XX_DFP microcontrollers (generated using svd2rust v0.25.1 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next]
2svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.25.1/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"]
3#![deny(const_err)]
4#![deny(dead_code)]
5#![deny(improper_ctypes)]
6#![deny(missing_docs)]
7#![deny(no_mangle_generic_items)]
8#![deny(non_shorthand_field_patterns)]
9#![deny(overflowing_literals)]
10#![deny(path_statements)]
11#![deny(patterns_in_fns_without_body)]
12#![deny(private_in_public)]
13#![deny(unconditional_recursion)]
14#![deny(unused_allocation)]
15#![deny(unused_comparisons)]
16#![deny(unused_parens)]
17#![deny(while_true)]
18#![allow(non_camel_case_types)]
19#![allow(non_snake_case)]
20#![no_std]
21use core::marker::PhantomData;
22use core::ops::Deref;
23#[doc = r"Number available in the NVIC for configuring priority"]
24pub const NVIC_PRIO_BITS: u8 = 4;
25#[cfg(feature = "rt")]
26pub use self::Interrupt as interrupt;
27pub use cortex_m::peripheral::Peripherals as CorePeripherals;
28pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
29#[cfg(feature = "rt")]
30pub use cortex_m_rt::interrupt;
31#[allow(unused_imports)]
32use generic::*;
33#[doc = r"Common register and bit access and modify traits"]
34pub mod generic;
35#[cfg(feature = "rt")]
36extern "C" {
37    fn WWDG();
38    fn PVD();
39    fn RTC();
40    fn FLASH();
41    fn RCC();
42    fn EXTI0_1();
43    fn EXTI2_3();
44    fn EXTI4_15();
45    fn DMA_CHANNEL1();
46    fn DMA_CHANNEL2_3();
47    fn ADC_COMP();
48    fn TIM1_BRK_UP_TRG_COM();
49    fn TIM1_CC();
50    fn TIM3();
51    fn TIM14();
52    fn TIM16();
53    fn TIM17();
54    fn I2C1();
55    fn SPI1();
56    fn SPI2();
57    fn USART1();
58    fn USART2();
59    fn LED();
60}
61#[doc(hidden)]
62pub union Vector {
63    _handler: unsafe extern "C" fn(),
64    _reserved: u32,
65}
66#[cfg(feature = "rt")]
67#[doc(hidden)]
68#[link_section = ".vector_table.interrupts"]
69#[no_mangle]
70pub static __INTERRUPTS: [Vector; 31] = [
71    Vector { _handler: WWDG },
72    Vector { _handler: PVD },
73    Vector { _handler: RTC },
74    Vector { _handler: FLASH },
75    Vector { _handler: RCC },
76    Vector { _handler: EXTI0_1 },
77    Vector { _handler: EXTI2_3 },
78    Vector { _handler: EXTI4_15 },
79    Vector { _reserved: 0 },
80    Vector {
81        _handler: DMA_CHANNEL1,
82    },
83    Vector {
84        _handler: DMA_CHANNEL2_3,
85    },
86    Vector { _reserved: 0 },
87    Vector { _handler: ADC_COMP },
88    Vector {
89        _handler: TIM1_BRK_UP_TRG_COM,
90    },
91    Vector { _handler: TIM1_CC },
92    Vector { _reserved: 0 },
93    Vector { _handler: TIM3 },
94    Vector { _reserved: 0 },
95    Vector { _reserved: 0 },
96    Vector { _handler: TIM14 },
97    Vector { _reserved: 0 },
98    Vector { _handler: TIM16 },
99    Vector { _handler: TIM17 },
100    Vector { _handler: I2C1 },
101    Vector { _reserved: 0 },
102    Vector { _handler: SPI1 },
103    Vector { _handler: SPI2 },
104    Vector { _handler: USART1 },
105    Vector { _handler: USART2 },
106    Vector { _reserved: 0 },
107    Vector { _handler: LED },
108];
109#[doc = r"Enumeration of all the interrupts."]
110#[derive(Copy, Clone, Debug, PartialEq, Eq)]
111#[repr(u16)]
112pub enum Interrupt {
113    #[doc = "0 - Window WatchDog Interrupt"]
114    WWDG = 0,
115    #[doc = "1 - PVD Interrupt through EXTI Lines 16"]
116    PVD = 1,
117    #[doc = "2 - RTC Interrupt through EXTI Lines 19"]
118    RTC = 2,
119    #[doc = "3 - FLASH global Interrupt"]
120    FLASH = 3,
121    #[doc = "4 - RCC global Interrupt"]
122    RCC = 4,
123    #[doc = "5 - EXTI Line 0 and 1 Interrupt"]
124    EXTI0_1 = 5,
125    #[doc = "6 - EXTI Line 2 and 3 Interrupt"]
126    EXTI2_3 = 6,
127    #[doc = "7 - EXTI Line 4 to 15 Interrupt"]
128    EXTI4_15 = 7,
129    #[doc = "9 - DMA Channel 1 Interrupt"]
130    DMA_CHANNEL1 = 9,
131    #[doc = "10 - DMA Channel 2 and Channel 3 Interrupt"]
132    DMA_CHANNEL2_3 = 10,
133    #[doc = "12 - ADC and COMP Interrupt through EXTI Lines 17 and 18"]
134    ADC_COMP = 12,
135    #[doc = "13 - TIM1 Break, Update, Trigger and Commutation Interrupt"]
136    TIM1_BRK_UP_TRG_COM = 13,
137    #[doc = "14 - TIM1 Capture Compare Interrupt"]
138    TIM1_CC = 14,
139    #[doc = "16 - TIM3 global Interrupt"]
140    TIM3 = 16,
141    #[doc = "19 - TIM14 global Interrupt"]
142    TIM14 = 19,
143    #[doc = "21 - TIM16 global Interrupt"]
144    TIM16 = 21,
145    #[doc = "22 - TIM17 global Interrupt"]
146    TIM17 = 22,
147    #[doc = "23 - I2C1 global Interrupt"]
148    I2C1 = 23,
149    #[doc = "25 - SPI1 global Interrupt"]
150    SPI1 = 25,
151    #[doc = "26 - SPI2 global Interrupt"]
152    SPI2 = 26,
153    #[doc = "27 - USART1 global Interrupt"]
154    USART1 = 27,
155    #[doc = "28 - USART2 global Interrupt"]
156    USART2 = 28,
157    #[doc = "30 - LED global Interrupt"]
158    LED = 30,
159}
160unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
161    #[inline(always)]
162    fn number(self) -> u16 {
163        self as u16
164    }
165}
166#[doc = "Analog to Digital Converter"]
167pub struct ADC {
168    _marker: PhantomData<*const ()>,
169}
170unsafe impl Send for ADC {}
171impl ADC {
172    #[doc = r"Pointer to the register block"]
173    pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
174    #[doc = r"Return the pointer to the register block"]
175    #[inline(always)]
176    pub const fn ptr() -> *const adc::RegisterBlock {
177        Self::PTR
178    }
179}
180impl Deref for ADC {
181    type Target = adc::RegisterBlock;
182    #[inline(always)]
183    fn deref(&self) -> &Self::Target {
184        unsafe { &*Self::PTR }
185    }
186}
187impl core::fmt::Debug for ADC {
188    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
189        f.debug_struct("ADC").finish()
190    }
191}
192#[doc = "Analog to Digital Converter"]
193pub mod adc;
194#[doc = "Comparator"]
195pub struct COMP1 {
196    _marker: PhantomData<*const ()>,
197}
198unsafe impl Send for COMP1 {}
199impl COMP1 {
200    #[doc = r"Pointer to the register block"]
201    pub const PTR: *const comp1::RegisterBlock = 0x4001_0200 as *const _;
202    #[doc = r"Return the pointer to the register block"]
203    #[inline(always)]
204    pub const fn ptr() -> *const comp1::RegisterBlock {
205        Self::PTR
206    }
207}
208impl Deref for COMP1 {
209    type Target = comp1::RegisterBlock;
210    #[inline(always)]
211    fn deref(&self) -> &Self::Target {
212        unsafe { &*Self::PTR }
213    }
214}
215impl core::fmt::Debug for COMP1 {
216    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
217        f.debug_struct("COMP1").finish()
218    }
219}
220#[doc = "Comparator"]
221pub mod comp1;
222#[doc = "Comparator"]
223pub struct COMP2 {
224    _marker: PhantomData<*const ()>,
225}
226unsafe impl Send for COMP2 {}
227impl COMP2 {
228    #[doc = r"Pointer to the register block"]
229    pub const PTR: *const comp2::RegisterBlock = 0x4001_0210 as *const _;
230    #[doc = r"Return the pointer to the register block"]
231    #[inline(always)]
232    pub const fn ptr() -> *const comp2::RegisterBlock {
233        Self::PTR
234    }
235}
236impl Deref for COMP2 {
237    type Target = comp2::RegisterBlock;
238    #[inline(always)]
239    fn deref(&self) -> &Self::Target {
240        unsafe { &*Self::PTR }
241    }
242}
243impl core::fmt::Debug for COMP2 {
244    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
245        f.debug_struct("COMP2").finish()
246    }
247}
248#[doc = "Comparator"]
249pub mod comp2;
250#[doc = "Reset and clock control"]
251pub struct RCC {
252    _marker: PhantomData<*const ()>,
253}
254unsafe impl Send for RCC {}
255impl RCC {
256    #[doc = r"Pointer to the register block"]
257    pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
258    #[doc = r"Return the pointer to the register block"]
259    #[inline(always)]
260    pub const fn ptr() -> *const rcc::RegisterBlock {
261        Self::PTR
262    }
263}
264impl Deref for RCC {
265    type Target = rcc::RegisterBlock;
266    #[inline(always)]
267    fn deref(&self) -> &Self::Target {
268        unsafe { &*Self::PTR }
269    }
270}
271impl core::fmt::Debug for RCC {
272    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
273        f.debug_struct("RCC").finish()
274    }
275}
276#[doc = "Reset and clock control"]
277pub mod rcc;
278#[doc = "Power control"]
279pub struct PWR {
280    _marker: PhantomData<*const ()>,
281}
282unsafe impl Send for PWR {}
283impl PWR {
284    #[doc = r"Pointer to the register block"]
285    pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
286    #[doc = r"Return the pointer to the register block"]
287    #[inline(always)]
288    pub const fn ptr() -> *const pwr::RegisterBlock {
289        Self::PTR
290    }
291}
292impl Deref for PWR {
293    type Target = pwr::RegisterBlock;
294    #[inline(always)]
295    fn deref(&self) -> &Self::Target {
296        unsafe { &*Self::PTR }
297    }
298}
299impl core::fmt::Debug for PWR {
300    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
301        f.debug_struct("PWR").finish()
302    }
303}
304#[doc = "Power control"]
305pub mod pwr;
306#[doc = "General-purpose I/Os"]
307pub struct GPIOA {
308    _marker: PhantomData<*const ()>,
309}
310unsafe impl Send for GPIOA {}
311impl GPIOA {
312    #[doc = r"Pointer to the register block"]
313    pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
314    #[doc = r"Return the pointer to the register block"]
315    #[inline(always)]
316    pub const fn ptr() -> *const gpioa::RegisterBlock {
317        Self::PTR
318    }
319}
320impl Deref for GPIOA {
321    type Target = gpioa::RegisterBlock;
322    #[inline(always)]
323    fn deref(&self) -> &Self::Target {
324        unsafe { &*Self::PTR }
325    }
326}
327impl core::fmt::Debug for GPIOA {
328    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
329        f.debug_struct("GPIOA").finish()
330    }
331}
332#[doc = "General-purpose I/Os"]
333pub mod gpioa;
334#[doc = "General-purpose I/Os"]
335pub struct GPIOB {
336    _marker: PhantomData<*const ()>,
337}
338unsafe impl Send for GPIOB {}
339impl GPIOB {
340    #[doc = r"Pointer to the register block"]
341    pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
342    #[doc = r"Return the pointer to the register block"]
343    #[inline(always)]
344    pub const fn ptr() -> *const gpiob::RegisterBlock {
345        Self::PTR
346    }
347}
348impl Deref for GPIOB {
349    type Target = gpiob::RegisterBlock;
350    #[inline(always)]
351    fn deref(&self) -> &Self::Target {
352        unsafe { &*Self::PTR }
353    }
354}
355impl core::fmt::Debug for GPIOB {
356    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
357        f.debug_struct("GPIOB").finish()
358    }
359}
360#[doc = "General-purpose I/Os"]
361pub mod gpiob;
362#[doc = "General-purpose I/Os"]
363pub struct GPIOF {
364    _marker: PhantomData<*const ()>,
365}
366unsafe impl Send for GPIOF {}
367impl GPIOF {
368    #[doc = r"Pointer to the register block"]
369    pub const PTR: *const gpiob::RegisterBlock = 0x5000_1400 as *const _;
370    #[doc = r"Return the pointer to the register block"]
371    #[inline(always)]
372    pub const fn ptr() -> *const gpiob::RegisterBlock {
373        Self::PTR
374    }
375}
376impl Deref for GPIOF {
377    type Target = gpiob::RegisterBlock;
378    #[inline(always)]
379    fn deref(&self) -> &Self::Target {
380        unsafe { &*Self::PTR }
381    }
382}
383impl core::fmt::Debug for GPIOF {
384    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
385        f.debug_struct("GPIOF").finish()
386    }
387}
388#[doc = "General-purpose I/Os"]
389pub use gpiob as gpiof;
390#[doc = "External interrupt/event controller"]
391pub struct EXTI {
392    _marker: PhantomData<*const ()>,
393}
394unsafe impl Send for EXTI {}
395impl EXTI {
396    #[doc = r"Pointer to the register block"]
397    pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
398    #[doc = r"Return the pointer to the register block"]
399    #[inline(always)]
400    pub const fn ptr() -> *const exti::RegisterBlock {
401        Self::PTR
402    }
403}
404impl Deref for EXTI {
405    type Target = exti::RegisterBlock;
406    #[inline(always)]
407    fn deref(&self) -> &Self::Target {
408        unsafe { &*Self::PTR }
409    }
410}
411impl core::fmt::Debug for EXTI {
412    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
413        f.debug_struct("EXTI").finish()
414    }
415}
416#[doc = "External interrupt/event controller"]
417pub mod exti;
418#[doc = "Low power timer"]
419pub struct LPTIM {
420    _marker: PhantomData<*const ()>,
421}
422unsafe impl Send for LPTIM {}
423impl LPTIM {
424    #[doc = r"Pointer to the register block"]
425    pub const PTR: *const lptim::RegisterBlock = 0x4000_7c00 as *const _;
426    #[doc = r"Return the pointer to the register block"]
427    #[inline(always)]
428    pub const fn ptr() -> *const lptim::RegisterBlock {
429        Self::PTR
430    }
431}
432impl Deref for LPTIM {
433    type Target = lptim::RegisterBlock;
434    #[inline(always)]
435    fn deref(&self) -> &Self::Target {
436        unsafe { &*Self::PTR }
437    }
438}
439impl core::fmt::Debug for LPTIM {
440    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
441        f.debug_struct("LPTIM").finish()
442    }
443}
444#[doc = "Low power timer"]
445pub mod lptim;
446#[doc = "Universal synchronous asynchronous receiver transmitter"]
447pub struct USART1 {
448    _marker: PhantomData<*const ()>,
449}
450unsafe impl Send for USART1 {}
451impl USART1 {
452    #[doc = r"Pointer to the register block"]
453    pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
454    #[doc = r"Return the pointer to the register block"]
455    #[inline(always)]
456    pub const fn ptr() -> *const usart1::RegisterBlock {
457        Self::PTR
458    }
459}
460impl Deref for USART1 {
461    type Target = usart1::RegisterBlock;
462    #[inline(always)]
463    fn deref(&self) -> &Self::Target {
464        unsafe { &*Self::PTR }
465    }
466}
467impl core::fmt::Debug for USART1 {
468    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
469        f.debug_struct("USART1").finish()
470    }
471}
472#[doc = "Universal synchronous asynchronous receiver transmitter"]
473pub mod usart1;
474#[doc = "Universal synchronous asynchronous receiver transmitter"]
475pub struct USART2 {
476    _marker: PhantomData<*const ()>,
477}
478unsafe impl Send for USART2 {}
479impl USART2 {
480    #[doc = r"Pointer to the register block"]
481    pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
482    #[doc = r"Return the pointer to the register block"]
483    #[inline(always)]
484    pub const fn ptr() -> *const usart1::RegisterBlock {
485        Self::PTR
486    }
487}
488impl Deref for USART2 {
489    type Target = usart1::RegisterBlock;
490    #[inline(always)]
491    fn deref(&self) -> &Self::Target {
492        unsafe { &*Self::PTR }
493    }
494}
495impl core::fmt::Debug for USART2 {
496    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
497        f.debug_struct("USART2").finish()
498    }
499}
500#[doc = "Universal synchronous asynchronous receiver transmitter"]
501pub use usart1 as usart2;
502#[doc = "Real time clock"]
503pub struct RTC {
504    _marker: PhantomData<*const ()>,
505}
506unsafe impl Send for RTC {}
507impl RTC {
508    #[doc = r"Pointer to the register block"]
509    pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
510    #[doc = r"Return the pointer to the register block"]
511    #[inline(always)]
512    pub const fn ptr() -> *const rtc::RegisterBlock {
513        Self::PTR
514    }
515}
516impl Deref for RTC {
517    type Target = rtc::RegisterBlock;
518    #[inline(always)]
519    fn deref(&self) -> &Self::Target {
520        unsafe { &*Self::PTR }
521    }
522}
523impl core::fmt::Debug for RTC {
524    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
525        f.debug_struct("RTC").finish()
526    }
527}
528#[doc = "Real time clock"]
529pub mod rtc;
530#[doc = "Independent watchdog"]
531pub struct IWDG {
532    _marker: PhantomData<*const ()>,
533}
534unsafe impl Send for IWDG {}
535impl IWDG {
536    #[doc = r"Pointer to the register block"]
537    pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
538    #[doc = r"Return the pointer to the register block"]
539    #[inline(always)]
540    pub const fn ptr() -> *const iwdg::RegisterBlock {
541        Self::PTR
542    }
543}
544impl Deref for IWDG {
545    type Target = iwdg::RegisterBlock;
546    #[inline(always)]
547    fn deref(&self) -> &Self::Target {
548        unsafe { &*Self::PTR }
549    }
550}
551impl core::fmt::Debug for IWDG {
552    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
553        f.debug_struct("IWDG").finish()
554    }
555}
556#[doc = "Independent watchdog"]
557pub mod iwdg;
558#[doc = "Window watchdog"]
559pub struct WWDG {
560    _marker: PhantomData<*const ()>,
561}
562unsafe impl Send for WWDG {}
563impl WWDG {
564    #[doc = r"Pointer to the register block"]
565    pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
566    #[doc = r"Return the pointer to the register block"]
567    #[inline(always)]
568    pub const fn ptr() -> *const wwdg::RegisterBlock {
569        Self::PTR
570    }
571}
572impl Deref for WWDG {
573    type Target = wwdg::RegisterBlock;
574    #[inline(always)]
575    fn deref(&self) -> &Self::Target {
576        unsafe { &*Self::PTR }
577    }
578}
579impl core::fmt::Debug for WWDG {
580    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
581        f.debug_struct("WWDG").finish()
582    }
583}
584#[doc = "Window watchdog"]
585pub mod wwdg;
586#[doc = "Advanced timer"]
587pub struct TIM1 {
588    _marker: PhantomData<*const ()>,
589}
590unsafe impl Send for TIM1 {}
591impl TIM1 {
592    #[doc = r"Pointer to the register block"]
593    pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
594    #[doc = r"Return the pointer to the register block"]
595    #[inline(always)]
596    pub const fn ptr() -> *const tim1::RegisterBlock {
597        Self::PTR
598    }
599}
600impl Deref for TIM1 {
601    type Target = tim1::RegisterBlock;
602    #[inline(always)]
603    fn deref(&self) -> &Self::Target {
604        unsafe { &*Self::PTR }
605    }
606}
607impl core::fmt::Debug for TIM1 {
608    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
609        f.debug_struct("TIM1").finish()
610    }
611}
612#[doc = "Advanced timer"]
613pub mod tim1;
614#[doc = "General purpose timer"]
615pub struct TIM3 {
616    _marker: PhantomData<*const ()>,
617}
618unsafe impl Send for TIM3 {}
619impl TIM3 {
620    #[doc = r"Pointer to the register block"]
621    pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
622    #[doc = r"Return the pointer to the register block"]
623    #[inline(always)]
624    pub const fn ptr() -> *const tim3::RegisterBlock {
625        Self::PTR
626    }
627}
628impl Deref for TIM3 {
629    type Target = tim3::RegisterBlock;
630    #[inline(always)]
631    fn deref(&self) -> &Self::Target {
632        unsafe { &*Self::PTR }
633    }
634}
635impl core::fmt::Debug for TIM3 {
636    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
637        f.debug_struct("TIM3").finish()
638    }
639}
640#[doc = "General purpose timer"]
641pub mod tim3;
642#[doc = "General purpose timer"]
643pub struct TIM14 {
644    _marker: PhantomData<*const ()>,
645}
646unsafe impl Send for TIM14 {}
647impl TIM14 {
648    #[doc = r"Pointer to the register block"]
649    pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
650    #[doc = r"Return the pointer to the register block"]
651    #[inline(always)]
652    pub const fn ptr() -> *const tim14::RegisterBlock {
653        Self::PTR
654    }
655}
656impl Deref for TIM14 {
657    type Target = tim14::RegisterBlock;
658    #[inline(always)]
659    fn deref(&self) -> &Self::Target {
660        unsafe { &*Self::PTR }
661    }
662}
663impl core::fmt::Debug for TIM14 {
664    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
665        f.debug_struct("TIM14").finish()
666    }
667}
668#[doc = "General purpose timer"]
669pub mod tim14;
670#[doc = "General purpose timer"]
671pub struct TIM16 {
672    _marker: PhantomData<*const ()>,
673}
674unsafe impl Send for TIM16 {}
675impl TIM16 {
676    #[doc = r"Pointer to the register block"]
677    pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
678    #[doc = r"Return the pointer to the register block"]
679    #[inline(always)]
680    pub const fn ptr() -> *const tim16::RegisterBlock {
681        Self::PTR
682    }
683}
684impl Deref for TIM16 {
685    type Target = tim16::RegisterBlock;
686    #[inline(always)]
687    fn deref(&self) -> &Self::Target {
688        unsafe { &*Self::PTR }
689    }
690}
691impl core::fmt::Debug for TIM16 {
692    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
693        f.debug_struct("TIM16").finish()
694    }
695}
696#[doc = "General purpose timer"]
697pub mod tim16;
698#[doc = "General purpose timer"]
699pub struct TIM17 {
700    _marker: PhantomData<*const ()>,
701}
702unsafe impl Send for TIM17 {}
703impl TIM17 {
704    #[doc = r"Pointer to the register block"]
705    pub const PTR: *const tim16::RegisterBlock = 0x4001_4800 as *const _;
706    #[doc = r"Return the pointer to the register block"]
707    #[inline(always)]
708    pub const fn ptr() -> *const tim16::RegisterBlock {
709        Self::PTR
710    }
711}
712impl Deref for TIM17 {
713    type Target = tim16::RegisterBlock;
714    #[inline(always)]
715    fn deref(&self) -> &Self::Target {
716        unsafe { &*Self::PTR }
717    }
718}
719impl core::fmt::Debug for TIM17 {
720    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
721        f.debug_struct("TIM17").finish()
722    }
723}
724#[doc = "General purpose timer"]
725pub use tim16 as tim17;
726#[doc = "System configuration controller"]
727pub struct SYSCFG {
728    _marker: PhantomData<*const ()>,
729}
730unsafe impl Send for SYSCFG {}
731impl SYSCFG {
732    #[doc = r"Pointer to the register block"]
733    pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
734    #[doc = r"Return the pointer to the register block"]
735    #[inline(always)]
736    pub const fn ptr() -> *const syscfg::RegisterBlock {
737        Self::PTR
738    }
739}
740impl Deref for SYSCFG {
741    type Target = syscfg::RegisterBlock;
742    #[inline(always)]
743    fn deref(&self) -> &Self::Target {
744        unsafe { &*Self::PTR }
745    }
746}
747impl core::fmt::Debug for SYSCFG {
748    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
749        f.debug_struct("SYSCFG").finish()
750    }
751}
752#[doc = "System configuration controller"]
753pub mod syscfg;
754#[doc = "Direct memory access"]
755pub struct DMA {
756    _marker: PhantomData<*const ()>,
757}
758unsafe impl Send for DMA {}
759impl DMA {
760    #[doc = r"Pointer to the register block"]
761    pub const PTR: *const dma::RegisterBlock = 0x4002_0000 as *const _;
762    #[doc = r"Return the pointer to the register block"]
763    #[inline(always)]
764    pub const fn ptr() -> *const dma::RegisterBlock {
765        Self::PTR
766    }
767}
768impl Deref for DMA {
769    type Target = dma::RegisterBlock;
770    #[inline(always)]
771    fn deref(&self) -> &Self::Target {
772        unsafe { &*Self::PTR }
773    }
774}
775impl core::fmt::Debug for DMA {
776    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
777        f.debug_struct("DMA").finish()
778    }
779}
780#[doc = "Direct memory access"]
781pub mod dma;
782#[doc = "Flash"]
783pub struct FLASH {
784    _marker: PhantomData<*const ()>,
785}
786unsafe impl Send for FLASH {}
787impl FLASH {
788    #[doc = r"Pointer to the register block"]
789    pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
790    #[doc = r"Return the pointer to the register block"]
791    #[inline(always)]
792    pub const fn ptr() -> *const flash::RegisterBlock {
793        Self::PTR
794    }
795}
796impl Deref for FLASH {
797    type Target = flash::RegisterBlock;
798    #[inline(always)]
799    fn deref(&self) -> &Self::Target {
800        unsafe { &*Self::PTR }
801    }
802}
803impl core::fmt::Debug for FLASH {
804    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
805        f.debug_struct("FLASH").finish()
806    }
807}
808#[doc = "Flash"]
809pub mod flash;
810#[doc = "CRC calculation unit"]
811pub struct CRC {
812    _marker: PhantomData<*const ()>,
813}
814unsafe impl Send for CRC {}
815impl CRC {
816    #[doc = r"Pointer to the register block"]
817    pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
818    #[doc = r"Return the pointer to the register block"]
819    #[inline(always)]
820    pub const fn ptr() -> *const crc::RegisterBlock {
821        Self::PTR
822    }
823}
824impl Deref for CRC {
825    type Target = crc::RegisterBlock;
826    #[inline(always)]
827    fn deref(&self) -> &Self::Target {
828        unsafe { &*Self::PTR }
829    }
830}
831impl core::fmt::Debug for CRC {
832    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
833        f.debug_struct("CRC").finish()
834    }
835}
836#[doc = "CRC calculation unit"]
837pub mod crc;
838#[doc = "Serial peripheral interface"]
839pub struct SPI1 {
840    _marker: PhantomData<*const ()>,
841}
842unsafe impl Send for SPI1 {}
843impl SPI1 {
844    #[doc = r"Pointer to the register block"]
845    pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
846    #[doc = r"Return the pointer to the register block"]
847    #[inline(always)]
848    pub const fn ptr() -> *const spi1::RegisterBlock {
849        Self::PTR
850    }
851}
852impl Deref for SPI1 {
853    type Target = spi1::RegisterBlock;
854    #[inline(always)]
855    fn deref(&self) -> &Self::Target {
856        unsafe { &*Self::PTR }
857    }
858}
859impl core::fmt::Debug for SPI1 {
860    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
861        f.debug_struct("SPI1").finish()
862    }
863}
864#[doc = "Serial peripheral interface"]
865pub mod spi1;
866#[doc = "Serial peripheral interface"]
867pub struct SPI2 {
868    _marker: PhantomData<*const ()>,
869}
870unsafe impl Send for SPI2 {}
871impl SPI2 {
872    #[doc = r"Pointer to the register block"]
873    pub const PTR: *const spi1::RegisterBlock = 0x4000_3800 as *const _;
874    #[doc = r"Return the pointer to the register block"]
875    #[inline(always)]
876    pub const fn ptr() -> *const spi1::RegisterBlock {
877        Self::PTR
878    }
879}
880impl Deref for SPI2 {
881    type Target = spi1::RegisterBlock;
882    #[inline(always)]
883    fn deref(&self) -> &Self::Target {
884        unsafe { &*Self::PTR }
885    }
886}
887impl core::fmt::Debug for SPI2 {
888    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
889        f.debug_struct("SPI2").finish()
890    }
891}
892#[doc = "Serial peripheral interface"]
893pub use spi1 as spi2;
894#[doc = "Inter integrated circuit"]
895pub struct I2C {
896    _marker: PhantomData<*const ()>,
897}
898unsafe impl Send for I2C {}
899impl I2C {
900    #[doc = r"Pointer to the register block"]
901    pub const PTR: *const i2c::RegisterBlock = 0x4000_5400 as *const _;
902    #[doc = r"Return the pointer to the register block"]
903    #[inline(always)]
904    pub const fn ptr() -> *const i2c::RegisterBlock {
905        Self::PTR
906    }
907}
908impl Deref for I2C {
909    type Target = i2c::RegisterBlock;
910    #[inline(always)]
911    fn deref(&self) -> &Self::Target {
912        unsafe { &*Self::PTR }
913    }
914}
915impl core::fmt::Debug for I2C {
916    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
917        f.debug_struct("I2C").finish()
918    }
919}
920#[doc = "Inter integrated circuit"]
921pub mod i2c;
922#[doc = "LED CONTROLLER"]
923pub struct LED {
924    _marker: PhantomData<*const ()>,
925}
926unsafe impl Send for LED {}
927impl LED {
928    #[doc = r"Pointer to the register block"]
929    pub const PTR: *const led::RegisterBlock = 0x4000_2400 as *const _;
930    #[doc = r"Return the pointer to the register block"]
931    #[inline(always)]
932    pub const fn ptr() -> *const led::RegisterBlock {
933        Self::PTR
934    }
935}
936impl Deref for LED {
937    type Target = led::RegisterBlock;
938    #[inline(always)]
939    fn deref(&self) -> &Self::Target {
940        unsafe { &*Self::PTR }
941    }
942}
943impl core::fmt::Debug for LED {
944    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
945        f.debug_struct("LED").finish()
946    }
947}
948#[doc = "LED CONTROLLER"]
949pub mod led;
950#[doc = "Debug support"]
951pub struct DBGMCU {
952    _marker: PhantomData<*const ()>,
953}
954unsafe impl Send for DBGMCU {}
955impl DBGMCU {
956    #[doc = r"Pointer to the register block"]
957    pub const PTR: *const dbgmcu::RegisterBlock = 0x4001_5800 as *const _;
958    #[doc = r"Return the pointer to the register block"]
959    #[inline(always)]
960    pub const fn ptr() -> *const dbgmcu::RegisterBlock {
961        Self::PTR
962    }
963}
964impl Deref for DBGMCU {
965    type Target = dbgmcu::RegisterBlock;
966    #[inline(always)]
967    fn deref(&self) -> &Self::Target {
968        unsafe { &*Self::PTR }
969    }
970}
971impl core::fmt::Debug for DBGMCU {
972    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
973        f.debug_struct("DBGMCU").finish()
974    }
975}
976#[doc = "Debug support"]
977pub mod dbgmcu;
978#[no_mangle]
979static mut DEVICE_PERIPHERALS: bool = false;
980#[doc = r"All the peripherals"]
981#[allow(non_snake_case)]
982pub struct Peripherals {
983    #[doc = "ADC"]
984    pub ADC: ADC,
985    #[doc = "COMP1"]
986    pub COMP1: COMP1,
987    #[doc = "COMP2"]
988    pub COMP2: COMP2,
989    #[doc = "RCC"]
990    pub RCC: RCC,
991    #[doc = "PWR"]
992    pub PWR: PWR,
993    #[doc = "GPIOA"]
994    pub GPIOA: GPIOA,
995    #[doc = "GPIOB"]
996    pub GPIOB: GPIOB,
997    #[doc = "GPIOF"]
998    pub GPIOF: GPIOF,
999    #[doc = "EXTI"]
1000    pub EXTI: EXTI,
1001    #[doc = "LPTIM"]
1002    pub LPTIM: LPTIM,
1003    #[doc = "USART1"]
1004    pub USART1: USART1,
1005    #[doc = "USART2"]
1006    pub USART2: USART2,
1007    #[doc = "RTC"]
1008    pub RTC: RTC,
1009    #[doc = "IWDG"]
1010    pub IWDG: IWDG,
1011    #[doc = "WWDG"]
1012    pub WWDG: WWDG,
1013    #[doc = "TIM1"]
1014    pub TIM1: TIM1,
1015    #[doc = "TIM3"]
1016    pub TIM3: TIM3,
1017    #[doc = "TIM14"]
1018    pub TIM14: TIM14,
1019    #[doc = "TIM16"]
1020    pub TIM16: TIM16,
1021    #[doc = "TIM17"]
1022    pub TIM17: TIM17,
1023    #[doc = "SYSCFG"]
1024    pub SYSCFG: SYSCFG,
1025    #[doc = "DMA"]
1026    pub DMA: DMA,
1027    #[doc = "FLASH"]
1028    pub FLASH: FLASH,
1029    #[doc = "CRC"]
1030    pub CRC: CRC,
1031    #[doc = "SPI1"]
1032    pub SPI1: SPI1,
1033    #[doc = "SPI2"]
1034    pub SPI2: SPI2,
1035    #[doc = "I2C"]
1036    pub I2C: I2C,
1037    #[doc = "LED"]
1038    pub LED: LED,
1039    #[doc = "DBGMCU"]
1040    pub DBGMCU: DBGMCU,
1041}
1042impl Peripherals {
1043    #[doc = r"Returns all the peripherals *once*"]
1044    #[inline]
1045    pub fn take() -> Option<Self> {
1046        cortex_m::interrupt::free(|_| {
1047            if unsafe { DEVICE_PERIPHERALS } {
1048                None
1049            } else {
1050                Some(unsafe { Peripherals::steal() })
1051            }
1052        })
1053    }
1054    #[doc = r"Unchecked version of `Peripherals::take`"]
1055    #[inline]
1056    pub unsafe fn steal() -> Self {
1057        DEVICE_PERIPHERALS = true;
1058        Peripherals {
1059            ADC: ADC {
1060                _marker: PhantomData,
1061            },
1062            COMP1: COMP1 {
1063                _marker: PhantomData,
1064            },
1065            COMP2: COMP2 {
1066                _marker: PhantomData,
1067            },
1068            RCC: RCC {
1069                _marker: PhantomData,
1070            },
1071            PWR: PWR {
1072                _marker: PhantomData,
1073            },
1074            GPIOA: GPIOA {
1075                _marker: PhantomData,
1076            },
1077            GPIOB: GPIOB {
1078                _marker: PhantomData,
1079            },
1080            GPIOF: GPIOF {
1081                _marker: PhantomData,
1082            },
1083            EXTI: EXTI {
1084                _marker: PhantomData,
1085            },
1086            LPTIM: LPTIM {
1087                _marker: PhantomData,
1088            },
1089            USART1: USART1 {
1090                _marker: PhantomData,
1091            },
1092            USART2: USART2 {
1093                _marker: PhantomData,
1094            },
1095            RTC: RTC {
1096                _marker: PhantomData,
1097            },
1098            IWDG: IWDG {
1099                _marker: PhantomData,
1100            },
1101            WWDG: WWDG {
1102                _marker: PhantomData,
1103            },
1104            TIM1: TIM1 {
1105                _marker: PhantomData,
1106            },
1107            TIM3: TIM3 {
1108                _marker: PhantomData,
1109            },
1110            TIM14: TIM14 {
1111                _marker: PhantomData,
1112            },
1113            TIM16: TIM16 {
1114                _marker: PhantomData,
1115            },
1116            TIM17: TIM17 {
1117                _marker: PhantomData,
1118            },
1119            SYSCFG: SYSCFG {
1120                _marker: PhantomData,
1121            },
1122            DMA: DMA {
1123                _marker: PhantomData,
1124            },
1125            FLASH: FLASH {
1126                _marker: PhantomData,
1127            },
1128            CRC: CRC {
1129                _marker: PhantomData,
1130            },
1131            SPI1: SPI1 {
1132                _marker: PhantomData,
1133            },
1134            SPI2: SPI2 {
1135                _marker: PhantomData,
1136            },
1137            I2C: I2C {
1138                _marker: PhantomData,
1139            },
1140            LED: LED {
1141                _marker: PhantomData,
1142            },
1143            DBGMCU: DBGMCU {
1144                _marker: PhantomData,
1145            },
1146        }
1147    }
1148}