PY32f002axx_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 FLASH();
38    fn RCC();
39    fn EXTI0_1();
40    fn EXTI2_3();
41    fn EXTI4_15();
42    fn ADC_COMP();
43    fn TIM1_BRK_UP_TRG_COM();
44    fn TIM1_CC();
45    fn TIM16();
46    fn I2C1();
47    fn SPI1();
48    fn USART1();
49}
50#[doc(hidden)]
51pub union Vector {
52    _handler: unsafe extern "C" fn(),
53    _reserved: u32,
54}
55#[cfg(feature = "rt")]
56#[doc(hidden)]
57#[link_section = ".vector_table.interrupts"]
58#[no_mangle]
59pub static __INTERRUPTS: [Vector; 28] = [
60    Vector { _reserved: 0 },
61    Vector { _reserved: 0 },
62    Vector { _reserved: 0 },
63    Vector { _handler: FLASH },
64    Vector { _handler: RCC },
65    Vector { _handler: EXTI0_1 },
66    Vector { _handler: EXTI2_3 },
67    Vector { _handler: EXTI4_15 },
68    Vector { _reserved: 0 },
69    Vector { _reserved: 0 },
70    Vector { _reserved: 0 },
71    Vector { _reserved: 0 },
72    Vector { _handler: ADC_COMP },
73    Vector {
74        _handler: TIM1_BRK_UP_TRG_COM,
75    },
76    Vector { _handler: TIM1_CC },
77    Vector { _reserved: 0 },
78    Vector { _reserved: 0 },
79    Vector { _reserved: 0 },
80    Vector { _reserved: 0 },
81    Vector { _reserved: 0 },
82    Vector { _reserved: 0 },
83    Vector { _handler: TIM16 },
84    Vector { _reserved: 0 },
85    Vector { _handler: I2C1 },
86    Vector { _reserved: 0 },
87    Vector { _handler: SPI1 },
88    Vector { _reserved: 0 },
89    Vector { _handler: USART1 },
90];
91#[doc = r"Enumeration of all the interrupts."]
92#[derive(Copy, Clone, Debug, PartialEq, Eq)]
93#[repr(u16)]
94pub enum Interrupt {
95    #[doc = "3 - FLASH global Interrupt"]
96    FLASH = 3,
97    #[doc = "4 - RCC global Interrupt"]
98    RCC = 4,
99    #[doc = "5 - EXTI Line 0 and 1 Interrupt"]
100    EXTI0_1 = 5,
101    #[doc = "6 - EXTI Line 2 and 3 Interrupt"]
102    EXTI2_3 = 6,
103    #[doc = "7 - EXTI Line 4 to 15 Interrupt"]
104    EXTI4_15 = 7,
105    #[doc = "12 - ADC and COMP Interrupt through EXTI Lines 17 and 18"]
106    ADC_COMP = 12,
107    #[doc = "13 - TIM1 Break, Update, Trigger and Commutation Interrupt"]
108    TIM1_BRK_UP_TRG_COM = 13,
109    #[doc = "14 - TIM1 Capture Compare Interrupt"]
110    TIM1_CC = 14,
111    #[doc = "21 - TIM16 global Interrupt"]
112    TIM16 = 21,
113    #[doc = "23 - I2C1 global Interrupt"]
114    I2C1 = 23,
115    #[doc = "25 - SPI1 global Interrupt"]
116    SPI1 = 25,
117    #[doc = "27 - USART1 global Interrupt"]
118    USART1 = 27,
119}
120unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
121    #[inline(always)]
122    fn number(self) -> u16 {
123        self as u16
124    }
125}
126#[doc = "Analog to Digital Converter"]
127pub struct ADC {
128    _marker: PhantomData<*const ()>,
129}
130unsafe impl Send for ADC {}
131impl ADC {
132    #[doc = r"Pointer to the register block"]
133    pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
134    #[doc = r"Return the pointer to the register block"]
135    #[inline(always)]
136    pub const fn ptr() -> *const adc::RegisterBlock {
137        Self::PTR
138    }
139}
140impl Deref for ADC {
141    type Target = adc::RegisterBlock;
142    #[inline(always)]
143    fn deref(&self) -> &Self::Target {
144        unsafe { &*Self::PTR }
145    }
146}
147impl core::fmt::Debug for ADC {
148    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
149        f.debug_struct("ADC").finish()
150    }
151}
152#[doc = "Analog to Digital Converter"]
153pub mod adc;
154#[doc = "Comparator"]
155pub struct COMP1 {
156    _marker: PhantomData<*const ()>,
157}
158unsafe impl Send for COMP1 {}
159impl COMP1 {
160    #[doc = r"Pointer to the register block"]
161    pub const PTR: *const comp1::RegisterBlock = 0x4001_0200 as *const _;
162    #[doc = r"Return the pointer to the register block"]
163    #[inline(always)]
164    pub const fn ptr() -> *const comp1::RegisterBlock {
165        Self::PTR
166    }
167}
168impl Deref for COMP1 {
169    type Target = comp1::RegisterBlock;
170    #[inline(always)]
171    fn deref(&self) -> &Self::Target {
172        unsafe { &*Self::PTR }
173    }
174}
175impl core::fmt::Debug for COMP1 {
176    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
177        f.debug_struct("COMP1").finish()
178    }
179}
180#[doc = "Comparator"]
181pub mod comp1;
182#[doc = "Comparator"]
183pub struct COMP2 {
184    _marker: PhantomData<*const ()>,
185}
186unsafe impl Send for COMP2 {}
187impl COMP2 {
188    #[doc = r"Pointer to the register block"]
189    pub const PTR: *const comp2::RegisterBlock = 0x4001_0210 as *const _;
190    #[doc = r"Return the pointer to the register block"]
191    #[inline(always)]
192    pub const fn ptr() -> *const comp2::RegisterBlock {
193        Self::PTR
194    }
195}
196impl Deref for COMP2 {
197    type Target = comp2::RegisterBlock;
198    #[inline(always)]
199    fn deref(&self) -> &Self::Target {
200        unsafe { &*Self::PTR }
201    }
202}
203impl core::fmt::Debug for COMP2 {
204    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
205        f.debug_struct("COMP2").finish()
206    }
207}
208#[doc = "Comparator"]
209pub mod comp2;
210#[doc = "Reset and clock control"]
211pub struct RCC {
212    _marker: PhantomData<*const ()>,
213}
214unsafe impl Send for RCC {}
215impl RCC {
216    #[doc = r"Pointer to the register block"]
217    pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
218    #[doc = r"Return the pointer to the register block"]
219    #[inline(always)]
220    pub const fn ptr() -> *const rcc::RegisterBlock {
221        Self::PTR
222    }
223}
224impl Deref for RCC {
225    type Target = rcc::RegisterBlock;
226    #[inline(always)]
227    fn deref(&self) -> &Self::Target {
228        unsafe { &*Self::PTR }
229    }
230}
231impl core::fmt::Debug for RCC {
232    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
233        f.debug_struct("RCC").finish()
234    }
235}
236#[doc = "Reset and clock control"]
237pub mod rcc;
238#[doc = "General-purpose I/Os"]
239pub struct GPIOA {
240    _marker: PhantomData<*const ()>,
241}
242unsafe impl Send for GPIOA {}
243impl GPIOA {
244    #[doc = r"Pointer to the register block"]
245    pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
246    #[doc = r"Return the pointer to the register block"]
247    #[inline(always)]
248    pub const fn ptr() -> *const gpioa::RegisterBlock {
249        Self::PTR
250    }
251}
252impl Deref for GPIOA {
253    type Target = gpioa::RegisterBlock;
254    #[inline(always)]
255    fn deref(&self) -> &Self::Target {
256        unsafe { &*Self::PTR }
257    }
258}
259impl core::fmt::Debug for GPIOA {
260    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
261        f.debug_struct("GPIOA").finish()
262    }
263}
264#[doc = "General-purpose I/Os"]
265pub mod gpioa;
266#[doc = "General-purpose I/Os"]
267pub struct GPIOB {
268    _marker: PhantomData<*const ()>,
269}
270unsafe impl Send for GPIOB {}
271impl GPIOB {
272    #[doc = r"Pointer to the register block"]
273    pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
274    #[doc = r"Return the pointer to the register block"]
275    #[inline(always)]
276    pub const fn ptr() -> *const gpiob::RegisterBlock {
277        Self::PTR
278    }
279}
280impl Deref for GPIOB {
281    type Target = gpiob::RegisterBlock;
282    #[inline(always)]
283    fn deref(&self) -> &Self::Target {
284        unsafe { &*Self::PTR }
285    }
286}
287impl core::fmt::Debug for GPIOB {
288    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
289        f.debug_struct("GPIOB").finish()
290    }
291}
292#[doc = "General-purpose I/Os"]
293pub mod gpiob;
294#[doc = "General-purpose I/Os"]
295pub struct GPIOF {
296    _marker: PhantomData<*const ()>,
297}
298unsafe impl Send for GPIOF {}
299impl GPIOF {
300    #[doc = r"Pointer to the register block"]
301    pub const PTR: *const gpiob::RegisterBlock = 0x5000_1400 as *const _;
302    #[doc = r"Return the pointer to the register block"]
303    #[inline(always)]
304    pub const fn ptr() -> *const gpiob::RegisterBlock {
305        Self::PTR
306    }
307}
308impl Deref for GPIOF {
309    type Target = gpiob::RegisterBlock;
310    #[inline(always)]
311    fn deref(&self) -> &Self::Target {
312        unsafe { &*Self::PTR }
313    }
314}
315impl core::fmt::Debug for GPIOF {
316    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
317        f.debug_struct("GPIOF").finish()
318    }
319}
320#[doc = "General-purpose I/Os"]
321pub use gpiob as gpiof;
322#[doc = "External interrupt/event controller"]
323pub struct EXTI {
324    _marker: PhantomData<*const ()>,
325}
326unsafe impl Send for EXTI {}
327impl EXTI {
328    #[doc = r"Pointer to the register block"]
329    pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
330    #[doc = r"Return the pointer to the register block"]
331    #[inline(always)]
332    pub const fn ptr() -> *const exti::RegisterBlock {
333        Self::PTR
334    }
335}
336impl Deref for EXTI {
337    type Target = exti::RegisterBlock;
338    #[inline(always)]
339    fn deref(&self) -> &Self::Target {
340        unsafe { &*Self::PTR }
341    }
342}
343impl core::fmt::Debug for EXTI {
344    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
345        f.debug_struct("EXTI").finish()
346    }
347}
348#[doc = "External interrupt/event controller"]
349pub mod exti;
350#[doc = "Low power timer"]
351pub struct LPTIM {
352    _marker: PhantomData<*const ()>,
353}
354unsafe impl Send for LPTIM {}
355impl LPTIM {
356    #[doc = r"Pointer to the register block"]
357    pub const PTR: *const lptim::RegisterBlock = 0x4000_7c00 as *const _;
358    #[doc = r"Return the pointer to the register block"]
359    #[inline(always)]
360    pub const fn ptr() -> *const lptim::RegisterBlock {
361        Self::PTR
362    }
363}
364impl Deref for LPTIM {
365    type Target = lptim::RegisterBlock;
366    #[inline(always)]
367    fn deref(&self) -> &Self::Target {
368        unsafe { &*Self::PTR }
369    }
370}
371impl core::fmt::Debug for LPTIM {
372    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
373        f.debug_struct("LPTIM").finish()
374    }
375}
376#[doc = "Low power timer"]
377pub mod lptim;
378#[doc = "Universal synchronous asynchronous receiver transmitter"]
379pub struct USART1 {
380    _marker: PhantomData<*const ()>,
381}
382unsafe impl Send for USART1 {}
383impl USART1 {
384    #[doc = r"Pointer to the register block"]
385    pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
386    #[doc = r"Return the pointer to the register block"]
387    #[inline(always)]
388    pub const fn ptr() -> *const usart1::RegisterBlock {
389        Self::PTR
390    }
391}
392impl Deref for USART1 {
393    type Target = usart1::RegisterBlock;
394    #[inline(always)]
395    fn deref(&self) -> &Self::Target {
396        unsafe { &*Self::PTR }
397    }
398}
399impl core::fmt::Debug for USART1 {
400    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
401        f.debug_struct("USART1").finish()
402    }
403}
404#[doc = "Universal synchronous asynchronous receiver transmitter"]
405pub mod usart1;
406#[doc = "Independent watchdog"]
407pub struct IWDG {
408    _marker: PhantomData<*const ()>,
409}
410unsafe impl Send for IWDG {}
411impl IWDG {
412    #[doc = r"Pointer to the register block"]
413    pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
414    #[doc = r"Return the pointer to the register block"]
415    #[inline(always)]
416    pub const fn ptr() -> *const iwdg::RegisterBlock {
417        Self::PTR
418    }
419}
420impl Deref for IWDG {
421    type Target = iwdg::RegisterBlock;
422    #[inline(always)]
423    fn deref(&self) -> &Self::Target {
424        unsafe { &*Self::PTR }
425    }
426}
427impl core::fmt::Debug for IWDG {
428    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
429        f.debug_struct("IWDG").finish()
430    }
431}
432#[doc = "Independent watchdog"]
433pub mod iwdg;
434#[doc = "Advanced timer"]
435pub struct TIM1 {
436    _marker: PhantomData<*const ()>,
437}
438unsafe impl Send for TIM1 {}
439impl TIM1 {
440    #[doc = r"Pointer to the register block"]
441    pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
442    #[doc = r"Return the pointer to the register block"]
443    #[inline(always)]
444    pub const fn ptr() -> *const tim1::RegisterBlock {
445        Self::PTR
446    }
447}
448impl Deref for TIM1 {
449    type Target = tim1::RegisterBlock;
450    #[inline(always)]
451    fn deref(&self) -> &Self::Target {
452        unsafe { &*Self::PTR }
453    }
454}
455impl core::fmt::Debug for TIM1 {
456    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
457        f.debug_struct("TIM1").finish()
458    }
459}
460#[doc = "Advanced timer"]
461pub mod tim1;
462#[doc = "General purpose timer"]
463pub struct TIM16 {
464    _marker: PhantomData<*const ()>,
465}
466unsafe impl Send for TIM16 {}
467impl TIM16 {
468    #[doc = r"Pointer to the register block"]
469    pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
470    #[doc = r"Return the pointer to the register block"]
471    #[inline(always)]
472    pub const fn ptr() -> *const tim16::RegisterBlock {
473        Self::PTR
474    }
475}
476impl Deref for TIM16 {
477    type Target = tim16::RegisterBlock;
478    #[inline(always)]
479    fn deref(&self) -> &Self::Target {
480        unsafe { &*Self::PTR }
481    }
482}
483impl core::fmt::Debug for TIM16 {
484    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
485        f.debug_struct("TIM16").finish()
486    }
487}
488#[doc = "General purpose timer"]
489pub mod tim16;
490#[doc = "System configuration controller"]
491pub struct SYSCFG {
492    _marker: PhantomData<*const ()>,
493}
494unsafe impl Send for SYSCFG {}
495impl SYSCFG {
496    #[doc = r"Pointer to the register block"]
497    pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
498    #[doc = r"Return the pointer to the register block"]
499    #[inline(always)]
500    pub const fn ptr() -> *const syscfg::RegisterBlock {
501        Self::PTR
502    }
503}
504impl Deref for SYSCFG {
505    type Target = syscfg::RegisterBlock;
506    #[inline(always)]
507    fn deref(&self) -> &Self::Target {
508        unsafe { &*Self::PTR }
509    }
510}
511impl core::fmt::Debug for SYSCFG {
512    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
513        f.debug_struct("SYSCFG").finish()
514    }
515}
516#[doc = "System configuration controller"]
517pub mod syscfg;
518#[doc = "Flash"]
519pub struct FLASH {
520    _marker: PhantomData<*const ()>,
521}
522unsafe impl Send for FLASH {}
523impl FLASH {
524    #[doc = r"Pointer to the register block"]
525    pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
526    #[doc = r"Return the pointer to the register block"]
527    #[inline(always)]
528    pub const fn ptr() -> *const flash::RegisterBlock {
529        Self::PTR
530    }
531}
532impl Deref for FLASH {
533    type Target = flash::RegisterBlock;
534    #[inline(always)]
535    fn deref(&self) -> &Self::Target {
536        unsafe { &*Self::PTR }
537    }
538}
539impl core::fmt::Debug for FLASH {
540    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
541        f.debug_struct("FLASH").finish()
542    }
543}
544#[doc = "Flash"]
545pub mod flash;
546#[doc = "CRC calculation unit"]
547pub struct CRC {
548    _marker: PhantomData<*const ()>,
549}
550unsafe impl Send for CRC {}
551impl CRC {
552    #[doc = r"Pointer to the register block"]
553    pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
554    #[doc = r"Return the pointer to the register block"]
555    #[inline(always)]
556    pub const fn ptr() -> *const crc::RegisterBlock {
557        Self::PTR
558    }
559}
560impl Deref for CRC {
561    type Target = crc::RegisterBlock;
562    #[inline(always)]
563    fn deref(&self) -> &Self::Target {
564        unsafe { &*Self::PTR }
565    }
566}
567impl core::fmt::Debug for CRC {
568    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
569        f.debug_struct("CRC").finish()
570    }
571}
572#[doc = "CRC calculation unit"]
573pub mod crc;
574#[doc = "Serial peripheral interface"]
575pub struct SPI1 {
576    _marker: PhantomData<*const ()>,
577}
578unsafe impl Send for SPI1 {}
579impl SPI1 {
580    #[doc = r"Pointer to the register block"]
581    pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
582    #[doc = r"Return the pointer to the register block"]
583    #[inline(always)]
584    pub const fn ptr() -> *const spi1::RegisterBlock {
585        Self::PTR
586    }
587}
588impl Deref for SPI1 {
589    type Target = spi1::RegisterBlock;
590    #[inline(always)]
591    fn deref(&self) -> &Self::Target {
592        unsafe { &*Self::PTR }
593    }
594}
595impl core::fmt::Debug for SPI1 {
596    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
597        f.debug_struct("SPI1").finish()
598    }
599}
600#[doc = "Serial peripheral interface"]
601pub mod spi1;
602#[doc = "Inter integrated circuit"]
603pub struct I2C {
604    _marker: PhantomData<*const ()>,
605}
606unsafe impl Send for I2C {}
607impl I2C {
608    #[doc = r"Pointer to the register block"]
609    pub const PTR: *const i2c::RegisterBlock = 0x4000_5400 as *const _;
610    #[doc = r"Return the pointer to the register block"]
611    #[inline(always)]
612    pub const fn ptr() -> *const i2c::RegisterBlock {
613        Self::PTR
614    }
615}
616impl Deref for I2C {
617    type Target = i2c::RegisterBlock;
618    #[inline(always)]
619    fn deref(&self) -> &Self::Target {
620        unsafe { &*Self::PTR }
621    }
622}
623impl core::fmt::Debug for I2C {
624    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
625        f.debug_struct("I2C").finish()
626    }
627}
628#[doc = "Inter integrated circuit"]
629pub mod i2c;
630#[doc = "Debug support"]
631pub struct DBGMCU {
632    _marker: PhantomData<*const ()>,
633}
634unsafe impl Send for DBGMCU {}
635impl DBGMCU {
636    #[doc = r"Pointer to the register block"]
637    pub const PTR: *const dbgmcu::RegisterBlock = 0x4001_5800 as *const _;
638    #[doc = r"Return the pointer to the register block"]
639    #[inline(always)]
640    pub const fn ptr() -> *const dbgmcu::RegisterBlock {
641        Self::PTR
642    }
643}
644impl Deref for DBGMCU {
645    type Target = dbgmcu::RegisterBlock;
646    #[inline(always)]
647    fn deref(&self) -> &Self::Target {
648        unsafe { &*Self::PTR }
649    }
650}
651impl core::fmt::Debug for DBGMCU {
652    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
653        f.debug_struct("DBGMCU").finish()
654    }
655}
656#[doc = "Debug support"]
657pub mod dbgmcu;
658#[no_mangle]
659static mut DEVICE_PERIPHERALS: bool = false;
660#[doc = r"All the peripherals"]
661#[allow(non_snake_case)]
662pub struct Peripherals {
663    #[doc = "ADC"]
664    pub ADC: ADC,
665    #[doc = "COMP1"]
666    pub COMP1: COMP1,
667    #[doc = "COMP2"]
668    pub COMP2: COMP2,
669    #[doc = "RCC"]
670    pub RCC: RCC,
671    #[doc = "GPIOA"]
672    pub GPIOA: GPIOA,
673    #[doc = "GPIOB"]
674    pub GPIOB: GPIOB,
675    #[doc = "GPIOF"]
676    pub GPIOF: GPIOF,
677    #[doc = "EXTI"]
678    pub EXTI: EXTI,
679    #[doc = "LPTIM"]
680    pub LPTIM: LPTIM,
681    #[doc = "USART1"]
682    pub USART1: USART1,
683    #[doc = "IWDG"]
684    pub IWDG: IWDG,
685    #[doc = "TIM1"]
686    pub TIM1: TIM1,
687    #[doc = "TIM16"]
688    pub TIM16: TIM16,
689    #[doc = "SYSCFG"]
690    pub SYSCFG: SYSCFG,
691    #[doc = "FLASH"]
692    pub FLASH: FLASH,
693    #[doc = "CRC"]
694    pub CRC: CRC,
695    #[doc = "SPI1"]
696    pub SPI1: SPI1,
697    #[doc = "I2C"]
698    pub I2C: I2C,
699    #[doc = "DBGMCU"]
700    pub DBGMCU: DBGMCU,
701}
702impl Peripherals {
703    #[doc = r"Returns all the peripherals *once*"]
704    #[inline]
705    pub fn take() -> Option<Self> {
706        cortex_m::interrupt::free(|_| {
707            if unsafe { DEVICE_PERIPHERALS } {
708                None
709            } else {
710                Some(unsafe { Peripherals::steal() })
711            }
712        })
713    }
714    #[doc = r"Unchecked version of `Peripherals::take`"]
715    #[inline]
716    pub unsafe fn steal() -> Self {
717        DEVICE_PERIPHERALS = true;
718        Peripherals {
719            ADC: ADC {
720                _marker: PhantomData,
721            },
722            COMP1: COMP1 {
723                _marker: PhantomData,
724            },
725            COMP2: COMP2 {
726                _marker: PhantomData,
727            },
728            RCC: RCC {
729                _marker: PhantomData,
730            },
731            GPIOA: GPIOA {
732                _marker: PhantomData,
733            },
734            GPIOB: GPIOB {
735                _marker: PhantomData,
736            },
737            GPIOF: GPIOF {
738                _marker: PhantomData,
739            },
740            EXTI: EXTI {
741                _marker: PhantomData,
742            },
743            LPTIM: LPTIM {
744                _marker: PhantomData,
745            },
746            USART1: USART1 {
747                _marker: PhantomData,
748            },
749            IWDG: IWDG {
750                _marker: PhantomData,
751            },
752            TIM1: TIM1 {
753                _marker: PhantomData,
754            },
755            TIM16: TIM16 {
756                _marker: PhantomData,
757            },
758            SYSCFG: SYSCFG {
759                _marker: PhantomData,
760            },
761            FLASH: FLASH {
762                _marker: PhantomData,
763            },
764            CRC: CRC {
765                _marker: PhantomData,
766            },
767            SPI1: SPI1 {
768                _marker: PhantomData,
769            },
770            I2C: I2C {
771                _marker: PhantomData,
772            },
773            DBGMCU: DBGMCU {
774                _marker: PhantomData,
775            },
776        }
777    }
778}