1pub const NVIC_PRIO_BITS: u8 = 4;
12#[cfg(feature = "rt")]
13pub use self::Interrupt as interrupt;
14pub use cortex_m::peripheral::Peripherals as CorePeripherals;
15pub use cortex_m::peripheral::{
16 CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU,
17};
18#[cfg(feature = "rt")]
19pub use cortex_m_rt::interrupt;
20#[cfg(feature = "rt")]
21extern "C" {
22 fn WWDG();
23 fn PVD();
24 fn TAMPER_STAMP();
25 fn RTC_WKUP();
26 fn FLASH();
27 fn RCC();
28 fn EXTI0();
29 fn EXTI1();
30 fn EXTI2();
31 fn EXTI3();
32 fn EXTI4();
33 fn DMA1_CHANNEL1();
34 fn DMA1_CHANNEL2();
35 fn DMA1_CHANNEL3();
36 fn DMA1_CHANNEL4();
37 fn DMA1_CHANNEL5();
38 fn DMA1_CHANNEL6();
39 fn DMA1_CHANNEL7();
40 fn ADC();
41 fn EXTI9_5();
42 fn TIM1_BRK_TIM15();
43 fn TIM1_UP_TIM16();
44 fn TIM1_TRG_COM_TIM17();
45 fn TIM1_CC();
46 fn TIM2();
47 fn TIM3();
48 fn TIM4();
49 fn I2C1_EV();
50 fn I2C1_ER();
51 fn I2C2_EV();
52 fn I2C2_ER();
53 fn SPI1();
54 fn SPI2();
55 fn USART1();
56 fn USART2();
57 fn USART3();
58 fn EXTI15_10();
59 fn RTCALARM();
60 fn CEC();
61 fn TIM12();
62 fn TIM13();
63 fn TIM14();
64 fn FSMC();
65 fn TIM5();
66 fn SPI3();
67 fn UART4();
68 fn UART5();
69 fn TIM6_DAC();
70 fn TIM7();
71 fn DMA2_CHANNEL1();
72 fn DMA2_CHANNEL2();
73 fn DMA2_CHANNEL3();
74 fn DMA2_CHANNEL4_5();
75}
76#[doc(hidden)]
77#[repr(C)]
78pub union Vector {
79 _handler: unsafe extern "C" fn(),
80 _reserved: u32,
81}
82#[cfg(feature = "rt")]
83#[doc(hidden)]
84#[link_section = ".vector_table.interrupts"]
85#[no_mangle]
86pub static __INTERRUPTS: [Vector; 60] = [
87 Vector { _handler: WWDG },
88 Vector { _handler: PVD },
89 Vector { _handler: TAMPER_STAMP },
90 Vector { _handler: RTC_WKUP },
91 Vector { _handler: FLASH },
92 Vector { _handler: RCC },
93 Vector { _handler: EXTI0 },
94 Vector { _handler: EXTI1 },
95 Vector { _handler: EXTI2 },
96 Vector { _handler: EXTI3 },
97 Vector { _handler: EXTI4 },
98 Vector { _handler: DMA1_CHANNEL1 },
99 Vector { _handler: DMA1_CHANNEL2 },
100 Vector { _handler: DMA1_CHANNEL3 },
101 Vector { _handler: DMA1_CHANNEL4 },
102 Vector { _handler: DMA1_CHANNEL5 },
103 Vector { _handler: DMA1_CHANNEL6 },
104 Vector { _handler: DMA1_CHANNEL7 },
105 Vector { _handler: ADC },
106 Vector { _reserved: 0 },
107 Vector { _reserved: 0 },
108 Vector { _reserved: 0 },
109 Vector { _reserved: 0 },
110 Vector { _handler: EXTI9_5 },
111 Vector { _handler: TIM1_BRK_TIM15 },
112 Vector { _handler: TIM1_UP_TIM16 },
113 Vector {
114 _handler: TIM1_TRG_COM_TIM17,
115 },
116 Vector { _handler: TIM1_CC },
117 Vector { _handler: TIM2 },
118 Vector { _handler: TIM3 },
119 Vector { _handler: TIM4 },
120 Vector { _handler: I2C1_EV },
121 Vector { _handler: I2C1_ER },
122 Vector { _handler: I2C2_EV },
123 Vector { _handler: I2C2_ER },
124 Vector { _handler: SPI1 },
125 Vector { _handler: SPI2 },
126 Vector { _handler: USART1 },
127 Vector { _handler: USART2 },
128 Vector { _handler: USART3 },
129 Vector { _handler: EXTI15_10 },
130 Vector { _handler: RTCALARM },
131 Vector { _handler: CEC },
132 Vector { _handler: TIM12 },
133 Vector { _handler: TIM13 },
134 Vector { _handler: TIM14 },
135 Vector { _reserved: 0 },
136 Vector { _reserved: 0 },
137 Vector { _handler: FSMC },
138 Vector { _reserved: 0 },
139 Vector { _handler: TIM5 },
140 Vector { _handler: SPI3 },
141 Vector { _handler: UART4 },
142 Vector { _handler: UART5 },
143 Vector { _handler: TIM6_DAC },
144 Vector { _handler: TIM7 },
145 Vector { _handler: DMA2_CHANNEL1 },
146 Vector { _handler: DMA2_CHANNEL2 },
147 Vector { _handler: DMA2_CHANNEL3 },
148 Vector {
149 _handler: DMA2_CHANNEL4_5,
150 },
151];
152#[cfg_attr(feature = "defmt", derive(defmt::Format))]
154#[derive(Copy, Clone, Debug, PartialEq, Eq)]
155#[repr(u16)]
156pub enum Interrupt {
157 WWDG = 0,
159 PVD = 1,
161 TAMPER_STAMP = 2,
163 RTC_WKUP = 3,
165 FLASH = 4,
167 RCC = 5,
169 EXTI0 = 6,
171 EXTI1 = 7,
173 EXTI2 = 8,
175 EXTI3 = 9,
177 EXTI4 = 10,
179 DMA1_CHANNEL1 = 11,
181 DMA1_CHANNEL2 = 12,
183 DMA1_CHANNEL3 = 13,
185 DMA1_CHANNEL4 = 14,
187 DMA1_CHANNEL5 = 15,
189 DMA1_CHANNEL6 = 16,
191 DMA1_CHANNEL7 = 17,
193 ADC = 18,
195 EXTI9_5 = 23,
197 TIM1_BRK_TIM15 = 24,
199 TIM1_UP_TIM16 = 25,
201 TIM1_TRG_COM_TIM17 = 26,
203 TIM1_CC = 27,
205 TIM2 = 28,
207 TIM3 = 29,
209 TIM4 = 30,
211 I2C1_EV = 31,
213 I2C1_ER = 32,
215 I2C2_EV = 33,
217 I2C2_ER = 34,
219 SPI1 = 35,
221 SPI2 = 36,
223 USART1 = 37,
225 USART2 = 38,
227 USART3 = 39,
229 EXTI15_10 = 40,
231 RTCALARM = 41,
233 CEC = 42,
235 TIM12 = 43,
237 TIM13 = 44,
239 TIM14 = 45,
241 FSMC = 48,
243 TIM5 = 50,
245 SPI3 = 51,
247 UART4 = 52,
249 UART5 = 53,
251 TIM6_DAC = 54,
253 TIM7 = 55,
255 DMA2_CHANNEL1 = 56,
257 DMA2_CHANNEL2 = 57,
259 DMA2_CHANNEL3 = 58,
261 DMA2_CHANNEL4_5 = 59,
263}
264unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
265 #[inline(always)]
266 fn number(self) -> u16 {
267 self as u16
268 }
269}
270pub type FSMC = crate::Periph<fsmc::RegisterBlock, 0xa000_0000>;
274impl core::fmt::Debug for FSMC {
275 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
276 f.debug_struct("FSMC").finish()
277 }
278}
279pub mod fsmc;
281pub type PWR = crate::Periph<pwr::RegisterBlock, 0x4000_7000>;
285impl core::fmt::Debug for PWR {
286 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
287 f.debug_struct("PWR").finish()
288 }
289}
290pub mod pwr;
292pub type RCC = crate::Periph<rcc::RegisterBlock, 0x4002_1000>;
296impl core::fmt::Debug for RCC {
297 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
298 f.debug_struct("RCC").finish()
299 }
300}
301pub mod rcc;
303pub type GPIOA = crate::Periph<gpioa::RegisterBlock, 0x4001_0800>;
307impl core::fmt::Debug for GPIOA {
308 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
309 f.debug_struct("GPIOA").finish()
310 }
311}
312pub mod gpioa;
314pub type GPIOB = crate::Periph<gpioa::RegisterBlock, 0x4001_0c00>;
318impl core::fmt::Debug for GPIOB {
319 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
320 f.debug_struct("GPIOB").finish()
321 }
322}
323pub use self::gpioa as gpiob;
325pub type GPIOC = crate::Periph<gpioa::RegisterBlock, 0x4001_1000>;
329impl core::fmt::Debug for GPIOC {
330 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
331 f.debug_struct("GPIOC").finish()
332 }
333}
334pub use self::gpioa as gpioc;
336pub type GPIOD = crate::Periph<gpioa::RegisterBlock, 0x4001_1400>;
340impl core::fmt::Debug for GPIOD {
341 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
342 f.debug_struct("GPIOD").finish()
343 }
344}
345pub use self::gpioa as gpiod;
347pub type GPIOE = crate::Periph<gpioa::RegisterBlock, 0x4001_1800>;
351impl core::fmt::Debug for GPIOE {
352 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
353 f.debug_struct("GPIOE").finish()
354 }
355}
356pub use self::gpioa as gpioe;
358pub type GPIOF = crate::Periph<gpioa::RegisterBlock, 0x4001_1c00>;
362impl core::fmt::Debug for GPIOF {
363 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
364 f.debug_struct("GPIOF").finish()
365 }
366}
367pub use self::gpioa as gpiof;
369pub type GPIOG = crate::Periph<gpioa::RegisterBlock, 0x4001_2000>;
373impl core::fmt::Debug for GPIOG {
374 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
375 f.debug_struct("GPIOG").finish()
376 }
377}
378pub use self::gpioa as gpiog;
380pub type AFIO = crate::Periph<afio::RegisterBlock, 0x4001_0000>;
384impl core::fmt::Debug for AFIO {
385 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
386 f.debug_struct("AFIO").finish()
387 }
388}
389pub mod afio;
391pub type EXTI = crate::Periph<exti::RegisterBlock, 0x4001_0400>;
395impl core::fmt::Debug for EXTI {
396 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
397 f.debug_struct("EXTI").finish()
398 }
399}
400pub mod exti;
402pub type DMA1 = crate::Periph<dma1::RegisterBlock, 0x4002_0000>;
406impl core::fmt::Debug for DMA1 {
407 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
408 f.debug_struct("DMA1").finish()
409 }
410}
411pub mod dma1;
413pub type DMA2 = crate::Periph<dma1::RegisterBlock, 0x4002_0400>;
417impl core::fmt::Debug for DMA2 {
418 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
419 f.debug_struct("DMA2").finish()
420 }
421}
422pub use self::dma1 as dma2;
424pub type RTC = crate::Periph<rtc::RegisterBlock, 0x4000_2800>;
428impl core::fmt::Debug for RTC {
429 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
430 f.debug_struct("RTC").finish()
431 }
432}
433pub mod rtc;
435pub type BKP = crate::Periph<bkp::RegisterBlock, 0x4000_6c04>;
439impl core::fmt::Debug for BKP {
440 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
441 f.debug_struct("BKP").finish()
442 }
443}
444pub mod bkp;
446pub type IWDG = crate::Periph<iwdg::RegisterBlock, 0x4000_3000>;
450impl core::fmt::Debug for IWDG {
451 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
452 f.debug_struct("IWDG").finish()
453 }
454}
455pub mod iwdg;
457pub type WWDG = crate::Periph<wwdg::RegisterBlock, 0x4000_2c00>;
461impl core::fmt::Debug for WWDG {
462 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
463 f.debug_struct("WWDG").finish()
464 }
465}
466pub mod wwdg;
468pub type TIM1 = crate::Periph<tim1::RegisterBlock, 0x4001_2c00>;
472impl core::fmt::Debug for TIM1 {
473 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
474 f.debug_struct("TIM1").finish()
475 }
476}
477pub mod tim1;
479pub type TIM2 = crate::Periph<tim2::RegisterBlock, 0x4000_0000>;
483impl core::fmt::Debug for TIM2 {
484 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
485 f.debug_struct("TIM2").finish()
486 }
487}
488pub mod tim2;
490pub type TIM3 = crate::Periph<tim2::RegisterBlock, 0x4000_0400>;
494impl core::fmt::Debug for TIM3 {
495 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
496 f.debug_struct("TIM3").finish()
497 }
498}
499pub use self::tim2 as tim3;
501pub type TIM4 = crate::Periph<tim2::RegisterBlock, 0x4000_0800>;
505impl core::fmt::Debug for TIM4 {
506 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
507 f.debug_struct("TIM4").finish()
508 }
509}
510pub use self::tim2 as tim4;
512pub type TIM5 = crate::Periph<tim2::RegisterBlock, 0x4000_0c00>;
516impl core::fmt::Debug for TIM5 {
517 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
518 f.debug_struct("TIM5").finish()
519 }
520}
521pub use self::tim2 as tim5;
523pub type TIM12 = crate::Periph<tim12::RegisterBlock, 0x4000_1800>;
527impl core::fmt::Debug for TIM12 {
528 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
529 f.debug_struct("TIM12").finish()
530 }
531}
532pub mod tim12;
534pub type TIM13 = crate::Periph<tim13::RegisterBlock, 0x4000_1c00>;
538impl core::fmt::Debug for TIM13 {
539 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
540 f.debug_struct("TIM13").finish()
541 }
542}
543pub mod tim13;
545pub type TIM14 = crate::Periph<tim13::RegisterBlock, 0x4000_2000>;
549impl core::fmt::Debug for TIM14 {
550 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
551 f.debug_struct("TIM14").finish()
552 }
553}
554pub use self::tim13 as tim14;
556pub type TIM6 = crate::Periph<tim6::RegisterBlock, 0x4000_1000>;
560impl core::fmt::Debug for TIM6 {
561 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
562 f.debug_struct("TIM6").finish()
563 }
564}
565pub mod tim6;
567pub type TIM7 = crate::Periph<tim6::RegisterBlock, 0x4000_1400>;
571impl core::fmt::Debug for TIM7 {
572 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
573 f.debug_struct("TIM7").finish()
574 }
575}
576pub use self::tim6 as tim7;
578pub type I2C1 = crate::Periph<i2c1::RegisterBlock, 0x4000_5400>;
582impl core::fmt::Debug for I2C1 {
583 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
584 f.debug_struct("I2C1").finish()
585 }
586}
587pub mod i2c1;
589pub type I2C2 = crate::Periph<i2c1::RegisterBlock, 0x4000_5800>;
593impl core::fmt::Debug for I2C2 {
594 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
595 f.debug_struct("I2C2").finish()
596 }
597}
598pub use self::i2c1 as i2c2;
600pub type SPI1 = crate::Periph<spi1::RegisterBlock, 0x4001_3000>;
604impl core::fmt::Debug for SPI1 {
605 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
606 f.debug_struct("SPI1").finish()
607 }
608}
609pub mod spi1;
611pub type SPI2 = crate::Periph<spi1::RegisterBlock, 0x4000_3800>;
615impl core::fmt::Debug for SPI2 {
616 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
617 f.debug_struct("SPI2").finish()
618 }
619}
620pub use self::spi1 as spi2;
622pub type SPI3 = crate::Periph<spi1::RegisterBlock, 0x4000_3c00>;
626impl core::fmt::Debug for SPI3 {
627 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
628 f.debug_struct("SPI3").finish()
629 }
630}
631pub use self::spi1 as spi3;
633pub type USART1 = crate::Periph<usart1::RegisterBlock, 0x4001_3800>;
637impl core::fmt::Debug for USART1 {
638 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
639 f.debug_struct("USART1").finish()
640 }
641}
642pub mod usart1;
644pub type USART2 = crate::Periph<usart1::RegisterBlock, 0x4000_4400>;
648impl core::fmt::Debug for USART2 {
649 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
650 f.debug_struct("USART2").finish()
651 }
652}
653pub use self::usart1 as usart2;
655pub type USART3 = crate::Periph<usart1::RegisterBlock, 0x4000_4800>;
659impl core::fmt::Debug for USART3 {
660 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
661 f.debug_struct("USART3").finish()
662 }
663}
664pub use self::usart1 as usart3;
666pub type ADC1 = crate::Periph<adc1::RegisterBlock, 0x4001_2400>;
670impl core::fmt::Debug for ADC1 {
671 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
672 f.debug_struct("ADC1").finish()
673 }
674}
675pub mod adc1;
677pub type DAC = crate::Periph<dac::RegisterBlock, 0x4000_7400>;
681impl core::fmt::Debug for DAC {
682 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
683 f.debug_struct("DAC").finish()
684 }
685}
686pub mod dac;
688pub type DBGMCU = crate::Periph<dbgmcu::RegisterBlock, 0xe004_2000>;
692impl core::fmt::Debug for DBGMCU {
693 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
694 f.debug_struct("DBGMCU").finish()
695 }
696}
697pub mod dbgmcu;
699pub type UART4 = crate::Periph<uart4::RegisterBlock, 0x4000_4c00>;
703impl core::fmt::Debug for UART4 {
704 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
705 f.debug_struct("UART4").finish()
706 }
707}
708pub mod uart4;
710pub type UART5 = crate::Periph<uart4::RegisterBlock, 0x4000_5000>;
714impl core::fmt::Debug for UART5 {
715 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
716 f.debug_struct("UART5").finish()
717 }
718}
719pub use self::uart4 as uart5;
721pub type CRC = crate::Periph<crc::RegisterBlock, 0x4002_3000>;
725impl core::fmt::Debug for CRC {
726 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
727 f.debug_struct("CRC").finish()
728 }
729}
730pub mod crc;
732pub type FLASH = crate::Periph<flash::RegisterBlock, 0x4002_2000>;
736impl core::fmt::Debug for FLASH {
737 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
738 f.debug_struct("FLASH").finish()
739 }
740}
741pub mod flash;
743pub type TIM15 = crate::Periph<tim15::RegisterBlock, 0x4001_4000>;
747impl core::fmt::Debug for TIM15 {
748 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
749 f.debug_struct("TIM15").finish()
750 }
751}
752pub mod tim15;
754pub type TIM16 = crate::Periph<tim16::RegisterBlock, 0x4001_4400>;
758impl core::fmt::Debug for TIM16 {
759 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
760 f.debug_struct("TIM16").finish()
761 }
762}
763pub mod tim16;
765pub type TIM17 = crate::Periph<tim16::RegisterBlock, 0x4001_4800>;
769impl core::fmt::Debug for TIM17 {
770 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
771 f.debug_struct("TIM17").finish()
772 }
773}
774pub use self::tim16 as tim17;
776pub type CEC = crate::Periph<cec::RegisterBlock, 0x4000_7800>;
780impl core::fmt::Debug for CEC {
781 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
782 f.debug_struct("CEC").finish()
783 }
784}
785pub mod cec;
787pub type SCB_ACTRL = crate::Periph<scb_actrl::RegisterBlock, 0xe000_e008>;
791impl core::fmt::Debug for SCB_ACTRL {
792 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
793 f.debug_struct("SCB_ACTRL").finish()
794 }
795}
796pub mod scb_actrl;
798pub type NVIC_STIR = crate::Periph<nvic_stir::RegisterBlock, 0xe000_ef00>;
802impl core::fmt::Debug for NVIC_STIR {
803 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
804 f.debug_struct("NVIC_STIR").finish()
805 }
806}
807pub mod nvic_stir;
809pub type STK = crate::Periph<stk::RegisterBlock, 0xe000_e010>;
813impl core::fmt::Debug for STK {
814 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
815 f.debug_struct("STK").finish()
816 }
817}
818pub mod stk;
820#[no_mangle]
821static mut DEVICE_PERIPHERALS: bool = false;
822#[allow(non_snake_case)]
824pub struct Peripherals {
825 pub FSMC: FSMC,
827 pub PWR: PWR,
829 pub RCC: RCC,
831 pub GPIOA: GPIOA,
833 pub GPIOB: GPIOB,
835 pub GPIOC: GPIOC,
837 pub GPIOD: GPIOD,
839 pub GPIOE: GPIOE,
841 pub GPIOF: GPIOF,
843 pub GPIOG: GPIOG,
845 pub AFIO: AFIO,
847 pub EXTI: EXTI,
849 pub DMA1: DMA1,
851 pub DMA2: DMA2,
853 pub RTC: RTC,
855 pub BKP: BKP,
857 pub IWDG: IWDG,
859 pub WWDG: WWDG,
861 pub TIM1: TIM1,
863 pub TIM2: TIM2,
865 pub TIM3: TIM3,
867 pub TIM4: TIM4,
869 pub TIM5: TIM5,
871 pub TIM12: TIM12,
873 pub TIM13: TIM13,
875 pub TIM14: TIM14,
877 pub TIM6: TIM6,
879 pub TIM7: TIM7,
881 pub I2C1: I2C1,
883 pub I2C2: I2C2,
885 pub SPI1: SPI1,
887 pub SPI2: SPI2,
889 pub SPI3: SPI3,
891 pub USART1: USART1,
893 pub USART2: USART2,
895 pub USART3: USART3,
897 pub ADC1: ADC1,
899 pub DAC: DAC,
901 pub DBGMCU: DBGMCU,
903 pub UART4: UART4,
905 pub UART5: UART5,
907 pub CRC: CRC,
909 pub FLASH: FLASH,
911 pub TIM15: TIM15,
913 pub TIM16: TIM16,
915 pub TIM17: TIM17,
917 pub CEC: CEC,
919 pub SCB_ACTRL: SCB_ACTRL,
921 pub NVIC_STIR: NVIC_STIR,
923 pub STK: STK,
925}
926impl Peripherals {
927 #[cfg(feature = "critical-section")]
929 #[inline]
930 pub fn take() -> Option<Self> {
931 critical_section::with(|_| {
932 if unsafe { DEVICE_PERIPHERALS } {
933 return None;
934 }
935 Some(unsafe { Peripherals::steal() })
936 })
937 }
938 #[inline]
944 pub unsafe fn steal() -> Self {
945 DEVICE_PERIPHERALS = true;
946 Peripherals {
947 FSMC: FSMC::steal(),
948 PWR: PWR::steal(),
949 RCC: RCC::steal(),
950 GPIOA: GPIOA::steal(),
951 GPIOB: GPIOB::steal(),
952 GPIOC: GPIOC::steal(),
953 GPIOD: GPIOD::steal(),
954 GPIOE: GPIOE::steal(),
955 GPIOF: GPIOF::steal(),
956 GPIOG: GPIOG::steal(),
957 AFIO: AFIO::steal(),
958 EXTI: EXTI::steal(),
959 DMA1: DMA1::steal(),
960 DMA2: DMA2::steal(),
961 RTC: RTC::steal(),
962 BKP: BKP::steal(),
963 IWDG: IWDG::steal(),
964 WWDG: WWDG::steal(),
965 TIM1: TIM1::steal(),
966 TIM2: TIM2::steal(),
967 TIM3: TIM3::steal(),
968 TIM4: TIM4::steal(),
969 TIM5: TIM5::steal(),
970 TIM12: TIM12::steal(),
971 TIM13: TIM13::steal(),
972 TIM14: TIM14::steal(),
973 TIM6: TIM6::steal(),
974 TIM7: TIM7::steal(),
975 I2C1: I2C1::steal(),
976 I2C2: I2C2::steal(),
977 SPI1: SPI1::steal(),
978 SPI2: SPI2::steal(),
979 SPI3: SPI3::steal(),
980 USART1: USART1::steal(),
981 USART2: USART2::steal(),
982 USART3: USART3::steal(),
983 ADC1: ADC1::steal(),
984 DAC: DAC::steal(),
985 DBGMCU: DBGMCU::steal(),
986 UART4: UART4::steal(),
987 UART5: UART5::steal(),
988 CRC: CRC::steal(),
989 FLASH: FLASH::steal(),
990 TIM15: TIM15::steal(),
991 TIM16: TIM16::steal(),
992 TIM17: TIM17::steal(),
993 CEC: CEC::steal(),
994 SCB_ACTRL: SCB_ACTRL::steal(),
995 NVIC_STIR: NVIC_STIR::steal(),
996 STK: STK::steal(),
997 }
998 }
999}