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::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
16#[cfg(feature = "rt")]
17pub use cortex_m_rt::interrupt;
18#[cfg(feature = "rt")]
19extern "C" {
20 fn WWDG();
21 fn PVD();
22 fn TAMPER();
23 fn RTC();
24 fn FLASH();
25 fn RCC();
26 fn EXTI0();
27 fn EXTI1();
28 fn EXTI2();
29 fn EXTI3();
30 fn EXTI4();
31 fn DMA1_CHANNEL1();
32 fn DMA1_CHANNEL2();
33 fn DMA1_CHANNEL3();
34 fn DMA1_CHANNEL4();
35 fn DMA1_CHANNEL5();
36 fn DMA1_CHANNEL6();
37 fn DMA1_CHANNEL7();
38 fn ADC1_2();
39 fn USB_HP_CAN_TX();
40 fn USB_LP_CAN_RX0();
41 fn EXTI9_5();
42 fn TIM1_BRK();
43 fn TIM1_UP();
44 fn TIM1_TRG_COM();
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 USBWAKEUP();
61 fn TIM8_BRK();
62 fn TIM8_UP();
63 fn TIM8_TRG_COM();
64 fn TIM8_CC();
65 fn ADC3();
66 fn FSMC();
67 fn SDIO();
68 fn TIM5();
69 fn SPI3();
70 fn UART4();
71 fn UART5();
72 fn TIM6();
73 fn TIM7();
74 fn DMA2_CHANNEL1();
75 fn DMA2_CHANNEL2();
76 fn DMA2_CHANNEL3();
77 fn DMA2_CHANNEL4_5();
78}
79#[doc(hidden)]
80#[repr(C)]
81pub union Vector {
82 _handler: unsafe extern "C" fn(),
83 _reserved: u32,
84}
85#[cfg(feature = "rt")]
86#[doc(hidden)]
87#[link_section = ".vector_table.interrupts"]
88#[no_mangle]
89pub static __INTERRUPTS: [Vector; 60] = [
90 Vector { _handler: WWDG },
91 Vector { _handler: PVD },
92 Vector { _handler: TAMPER },
93 Vector { _handler: RTC },
94 Vector { _handler: FLASH },
95 Vector { _handler: RCC },
96 Vector { _handler: EXTI0 },
97 Vector { _handler: EXTI1 },
98 Vector { _handler: EXTI2 },
99 Vector { _handler: EXTI3 },
100 Vector { _handler: EXTI4 },
101 Vector {
102 _handler: DMA1_CHANNEL1,
103 },
104 Vector {
105 _handler: DMA1_CHANNEL2,
106 },
107 Vector {
108 _handler: DMA1_CHANNEL3,
109 },
110 Vector {
111 _handler: DMA1_CHANNEL4,
112 },
113 Vector {
114 _handler: DMA1_CHANNEL5,
115 },
116 Vector {
117 _handler: DMA1_CHANNEL6,
118 },
119 Vector {
120 _handler: DMA1_CHANNEL7,
121 },
122 Vector { _handler: ADC1_2 },
123 Vector {
124 _handler: USB_HP_CAN_TX,
125 },
126 Vector {
127 _handler: USB_LP_CAN_RX0,
128 },
129 Vector { _reserved: 0 },
130 Vector { _reserved: 0 },
131 Vector { _handler: EXTI9_5 },
132 Vector { _handler: TIM1_BRK },
133 Vector { _handler: TIM1_UP },
134 Vector {
135 _handler: TIM1_TRG_COM,
136 },
137 Vector { _handler: TIM1_CC },
138 Vector { _handler: TIM2 },
139 Vector { _handler: TIM3 },
140 Vector { _handler: TIM4 },
141 Vector { _handler: I2C1_EV },
142 Vector { _handler: I2C1_ER },
143 Vector { _handler: I2C2_EV },
144 Vector { _handler: I2C2_ER },
145 Vector { _handler: SPI1 },
146 Vector { _handler: SPI2 },
147 Vector { _handler: USART1 },
148 Vector { _handler: USART2 },
149 Vector { _handler: USART3 },
150 Vector {
151 _handler: EXTI15_10,
152 },
153 Vector { _handler: RTCALARM },
154 Vector {
155 _handler: USBWAKEUP,
156 },
157 Vector { _handler: TIM8_BRK },
158 Vector { _handler: TIM8_UP },
159 Vector {
160 _handler: TIM8_TRG_COM,
161 },
162 Vector { _handler: TIM8_CC },
163 Vector { _handler: ADC3 },
164 Vector { _handler: FSMC },
165 Vector { _handler: SDIO },
166 Vector { _handler: TIM5 },
167 Vector { _handler: SPI3 },
168 Vector { _handler: UART4 },
169 Vector { _handler: UART5 },
170 Vector { _handler: TIM6 },
171 Vector { _handler: TIM7 },
172 Vector {
173 _handler: DMA2_CHANNEL1,
174 },
175 Vector {
176 _handler: DMA2_CHANNEL2,
177 },
178 Vector {
179 _handler: DMA2_CHANNEL3,
180 },
181 Vector {
182 _handler: DMA2_CHANNEL4_5,
183 },
184];
185#[cfg_attr(feature = "defmt", derive(defmt::Format))]
187#[derive(Copy, Clone, Debug, PartialEq, Eq)]
188#[repr(u16)]
189pub enum Interrupt {
190 WWDG = 0,
192 PVD = 1,
194 TAMPER = 2,
196 RTC = 3,
198 FLASH = 4,
200 RCC = 5,
202 EXTI0 = 6,
204 EXTI1 = 7,
206 EXTI2 = 8,
208 EXTI3 = 9,
210 EXTI4 = 10,
212 DMA1_CHANNEL1 = 11,
214 DMA1_CHANNEL2 = 12,
216 DMA1_CHANNEL3 = 13,
218 DMA1_CHANNEL4 = 14,
220 DMA1_CHANNEL5 = 15,
222 DMA1_CHANNEL6 = 16,
224 DMA1_CHANNEL7 = 17,
226 ADC1_2 = 18,
228 USB_HP_CAN_TX = 19,
230 USB_LP_CAN_RX0 = 20,
232 EXTI9_5 = 23,
234 TIM1_BRK = 24,
236 TIM1_UP = 25,
238 TIM1_TRG_COM = 26,
240 TIM1_CC = 27,
242 TIM2 = 28,
244 TIM3 = 29,
246 TIM4 = 30,
248 I2C1_EV = 31,
250 I2C1_ER = 32,
252 I2C2_EV = 33,
254 I2C2_ER = 34,
256 SPI1 = 35,
258 SPI2 = 36,
260 USART1 = 37,
262 USART2 = 38,
264 USART3 = 39,
266 EXTI15_10 = 40,
268 RTCALARM = 41,
270 USBWAKEUP = 42,
272 TIM8_BRK = 43,
274 TIM8_UP = 44,
276 TIM8_TRG_COM = 45,
278 TIM8_CC = 46,
280 ADC3 = 47,
282 FSMC = 48,
284 SDIO = 49,
286 TIM5 = 50,
288 SPI3 = 51,
290 UART4 = 52,
292 UART5 = 53,
294 TIM6 = 54,
296 TIM7 = 55,
298 DMA2_CHANNEL1 = 56,
300 DMA2_CHANNEL2 = 57,
302 DMA2_CHANNEL3 = 58,
304 DMA2_CHANNEL4_5 = 59,
306}
307unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
308 #[inline(always)]
309 fn number(self) -> u16 {
310 self as u16
311 }
312}
313pub type PWR = crate::Periph<pwr::RegisterBlock, 0x4000_7000>;
317impl core::fmt::Debug for PWR {
318 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
319 f.debug_struct("PWR").finish()
320 }
321}
322pub mod pwr;
324pub type RCC = crate::Periph<rcc::RegisterBlock, 0x4002_1000>;
328impl core::fmt::Debug for RCC {
329 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
330 f.debug_struct("RCC").finish()
331 }
332}
333pub mod rcc;
335pub type GPIOA = crate::Periph<gpioa::RegisterBlock, 0x4001_0800>;
339impl core::fmt::Debug for GPIOA {
340 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
341 f.debug_struct("GPIOA").finish()
342 }
343}
344pub mod gpioa;
346pub type GPIOB = crate::Periph<gpioa::RegisterBlock, 0x4001_0c00>;
350impl core::fmt::Debug for GPIOB {
351 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
352 f.debug_struct("GPIOB").finish()
353 }
354}
355pub use self::gpioa as gpiob;
357pub type GPIOC = crate::Periph<gpioa::RegisterBlock, 0x4001_1000>;
361impl core::fmt::Debug for GPIOC {
362 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
363 f.debug_struct("GPIOC").finish()
364 }
365}
366pub use self::gpioa as gpioc;
368pub type GPIOD = crate::Periph<gpioa::RegisterBlock, 0x4001_1400>;
372impl core::fmt::Debug for GPIOD {
373 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
374 f.debug_struct("GPIOD").finish()
375 }
376}
377pub use self::gpioa as gpiod;
379pub type GPIOE = crate::Periph<gpioa::RegisterBlock, 0x4001_1800>;
383impl core::fmt::Debug for GPIOE {
384 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
385 f.debug_struct("GPIOE").finish()
386 }
387}
388pub use self::gpioa as gpioe;
390pub type GPIOF = crate::Periph<gpioa::RegisterBlock, 0x4001_1c00>;
394impl core::fmt::Debug for GPIOF {
395 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
396 f.debug_struct("GPIOF").finish()
397 }
398}
399pub use self::gpioa as gpiof;
401pub type GPIOG = crate::Periph<gpioa::RegisterBlock, 0x4001_2000>;
405impl core::fmt::Debug for GPIOG {
406 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
407 f.debug_struct("GPIOG").finish()
408 }
409}
410pub use self::gpioa as gpiog;
412pub type AFIO = crate::Periph<afio::RegisterBlock, 0x4001_0000>;
416impl core::fmt::Debug for AFIO {
417 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
418 f.debug_struct("AFIO").finish()
419 }
420}
421pub mod afio;
423pub type EXTI = crate::Periph<exti::RegisterBlock, 0x4001_0400>;
427impl core::fmt::Debug for EXTI {
428 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
429 f.debug_struct("EXTI").finish()
430 }
431}
432pub mod exti;
434pub type DMA1 = crate::Periph<dma1::RegisterBlock, 0x4002_0000>;
438impl core::fmt::Debug for DMA1 {
439 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
440 f.debug_struct("DMA1").finish()
441 }
442}
443pub mod dma1;
445pub type DMA2 = crate::Periph<dma1::RegisterBlock, 0x4002_0400>;
449impl core::fmt::Debug for DMA2 {
450 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
451 f.debug_struct("DMA2").finish()
452 }
453}
454pub use self::dma1 as dma2;
456pub type RTC = crate::Periph<rtc::RegisterBlock, 0x4000_2800>;
460impl core::fmt::Debug for RTC {
461 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
462 f.debug_struct("RTC").finish()
463 }
464}
465pub mod rtc;
467pub type IWDG = crate::Periph<iwdg::RegisterBlock, 0x4000_3000>;
471impl core::fmt::Debug for IWDG {
472 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
473 f.debug_struct("IWDG").finish()
474 }
475}
476pub mod iwdg;
478pub type WWDG = crate::Periph<wwdg::RegisterBlock, 0x4000_2c00>;
482impl core::fmt::Debug for WWDG {
483 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
484 f.debug_struct("WWDG").finish()
485 }
486}
487pub mod wwdg;
489pub type TIM2 = crate::Periph<tim2::RegisterBlock, 0x4000_0000>;
493impl core::fmt::Debug for TIM2 {
494 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
495 f.debug_struct("TIM2").finish()
496 }
497}
498pub mod tim2;
500pub type TIM3 = crate::Periph<tim2::RegisterBlock, 0x4000_0400>;
504impl core::fmt::Debug for TIM3 {
505 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
506 f.debug_struct("TIM3").finish()
507 }
508}
509pub use self::tim2 as tim3;
511pub type I2C1 = crate::Periph<i2c1::RegisterBlock, 0x4000_5400>;
515impl core::fmt::Debug for I2C1 {
516 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
517 f.debug_struct("I2C1").finish()
518 }
519}
520pub mod i2c1;
522pub type I2C2 = crate::Periph<i2c1::RegisterBlock, 0x4000_5800>;
526impl core::fmt::Debug for I2C2 {
527 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
528 f.debug_struct("I2C2").finish()
529 }
530}
531pub use self::i2c1 as i2c2;
533pub type SPI1 = crate::Periph<spi1::RegisterBlock, 0x4001_3000>;
537impl core::fmt::Debug for SPI1 {
538 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
539 f.debug_struct("SPI1").finish()
540 }
541}
542pub mod spi1;
544pub type USART1 = crate::Periph<usart1::RegisterBlock, 0x4001_3800>;
548impl core::fmt::Debug for USART1 {
549 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
550 f.debug_struct("USART1").finish()
551 }
552}
553pub mod usart1;
555pub type USART2 = crate::Periph<usart1::RegisterBlock, 0x4000_4400>;
559impl core::fmt::Debug for USART2 {
560 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
561 f.debug_struct("USART2").finish()
562 }
563}
564pub use self::usart1 as usart2;
566pub type USART3 = crate::Periph<usart1::RegisterBlock, 0x4000_4800>;
570impl core::fmt::Debug for USART3 {
571 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
572 f.debug_struct("USART3").finish()
573 }
574}
575pub use self::usart1 as usart3;
577pub type ADC1 = crate::Periph<adc1::RegisterBlock, 0x4001_2400>;
581impl core::fmt::Debug for ADC1 {
582 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
583 f.debug_struct("ADC1").finish()
584 }
585}
586pub mod adc1;
588pub type ADC3 = crate::Periph<adc3::RegisterBlock, 0x4001_3c00>;
592impl core::fmt::Debug for ADC3 {
593 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
594 f.debug_struct("ADC3").finish()
595 }
596}
597pub mod adc3;
599pub type CRC = crate::Periph<crc::RegisterBlock, 0x4002_3000>;
603impl core::fmt::Debug for CRC {
604 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
605 f.debug_struct("CRC").finish()
606 }
607}
608pub mod crc;
610pub type FLASH = crate::Periph<flash::RegisterBlock, 0x4002_2000>;
614impl core::fmt::Debug for FLASH {
615 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
616 f.debug_struct("FLASH").finish()
617 }
618}
619pub mod flash;
621pub type DBGMCU = crate::Periph<dbgmcu::RegisterBlock, 0xe004_2000>;
625impl core::fmt::Debug for DBGMCU {
626 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
627 f.debug_struct("DBGMCU").finish()
628 }
629}
630pub mod dbgmcu;
632pub type BKP = crate::Periph<bkp::RegisterBlock, 0x4000_6c04>;
636impl core::fmt::Debug for BKP {
637 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
638 f.debug_struct("BKP").finish()
639 }
640}
641pub mod bkp;
643pub type FSMC = crate::Periph<fsmc::RegisterBlock, 0xa000_0000>;
647impl core::fmt::Debug for FSMC {
648 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
649 f.debug_struct("FSMC").finish()
650 }
651}
652pub mod fsmc;
654pub type OTG_FS_DEVICE = crate::Periph<otg_fs_device::RegisterBlock, 0x5000_0800>;
658impl core::fmt::Debug for OTG_FS_DEVICE {
659 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
660 f.debug_struct("OTG_FS_DEVICE").finish()
661 }
662}
663pub mod otg_fs_device;
665pub type OTG_FS_GLOBAL = crate::Periph<otg_fs_global::RegisterBlock, 0x5000_0000>;
669impl core::fmt::Debug for OTG_FS_GLOBAL {
670 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
671 f.debug_struct("OTG_FS_GLOBAL").finish()
672 }
673}
674pub mod otg_fs_global;
676pub type OTG_FS_HOST = crate::Periph<otg_fs_host::RegisterBlock, 0x5000_0400>;
680impl core::fmt::Debug for OTG_FS_HOST {
681 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
682 f.debug_struct("OTG_FS_HOST").finish()
683 }
684}
685pub mod otg_fs_host;
687pub type OTG_FS_PWRCLK = crate::Periph<otg_fs_pwrclk::RegisterBlock, 0x5000_0e00>;
691impl core::fmt::Debug for OTG_FS_PWRCLK {
692 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
693 f.debug_struct("OTG_FS_PWRCLK").finish()
694 }
695}
696pub mod otg_fs_pwrclk;
698pub type SDIO = crate::Periph<sdio::RegisterBlock, 0x4001_8000>;
702impl core::fmt::Debug for SDIO {
703 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
704 f.debug_struct("SDIO").finish()
705 }
706}
707pub mod sdio;
709pub type TIM13 = crate::Periph<tim13::RegisterBlock, 0x4000_1c00>;
713impl core::fmt::Debug for TIM13 {
714 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
715 f.debug_struct("TIM13").finish()
716 }
717}
718pub mod tim13;
720pub type TIM10 = crate::Periph<tim13::RegisterBlock, 0x4001_5000>;
724impl core::fmt::Debug for TIM10 {
725 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
726 f.debug_struct("TIM10").finish()
727 }
728}
729pub use self::tim13 as tim10;
731pub type TIM11 = crate::Periph<tim13::RegisterBlock, 0x4001_5400>;
735impl core::fmt::Debug for TIM11 {
736 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
737 f.debug_struct("TIM11").finish()
738 }
739}
740pub use self::tim13 as tim11;
742pub type TIM9 = crate::Periph<tim9::RegisterBlock, 0x4001_4c00>;
746impl core::fmt::Debug for TIM9 {
747 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
748 f.debug_struct("TIM9").finish()
749 }
750}
751pub mod tim9;
753pub type TIM12 = crate::Periph<tim9::RegisterBlock, 0x4000_1800>;
757impl core::fmt::Debug for TIM12 {
758 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
759 f.debug_struct("TIM12").finish()
760 }
761}
762pub use self::tim9 as tim12;
764pub type TIM8 = crate::Periph<tim8::RegisterBlock, 0x4001_3400>;
768impl core::fmt::Debug for TIM8 {
769 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
770 f.debug_struct("TIM8").finish()
771 }
772}
773pub mod tim8;
775pub type TIM1 = crate::Periph<tim8::RegisterBlock, 0x4001_2c00>;
779impl core::fmt::Debug for TIM1 {
780 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
781 f.debug_struct("TIM1").finish()
782 }
783}
784pub use self::tim8 as tim1;
786pub type ADC2 = crate::Periph<adc2::RegisterBlock, 0x4001_2800>;
790impl core::fmt::Debug for ADC2 {
791 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
792 f.debug_struct("ADC2").finish()
793 }
794}
795pub mod adc2;
797pub type DAC = crate::Periph<dac::RegisterBlock, 0x4000_7400>;
801impl core::fmt::Debug for DAC {
802 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
803 f.debug_struct("DAC").finish()
804 }
805}
806pub mod dac;
808pub type USB = crate::Periph<usb::RegisterBlock, 0x4000_5c00>;
812impl core::fmt::Debug for USB {
813 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
814 f.debug_struct("USB").finish()
815 }
816}
817pub mod usb;
819pub type UART4 = crate::Periph<uart4::RegisterBlock, 0x4000_4c00>;
823impl core::fmt::Debug for UART4 {
824 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
825 f.debug_struct("UART4").finish()
826 }
827}
828pub mod uart4;
830pub type UART5 = crate::Periph<uart4::RegisterBlock, 0x4000_5000>;
834impl core::fmt::Debug for UART5 {
835 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
836 f.debug_struct("UART5").finish()
837 }
838}
839pub use self::uart4 as uart5;
841pub type SPI2 = crate::Periph<spi2::RegisterBlock, 0x4000_3800>;
845impl core::fmt::Debug for SPI2 {
846 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
847 f.debug_struct("SPI2").finish()
848 }
849}
850pub mod spi2;
852pub type SPI3 = crate::Periph<spi2::RegisterBlock, 0x4000_3c00>;
856impl core::fmt::Debug for SPI3 {
857 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
858 f.debug_struct("SPI3").finish()
859 }
860}
861pub use self::spi2 as spi3;
863pub type TIM4 = crate::Periph<tim2::RegisterBlock, 0x4000_0800>;
867impl core::fmt::Debug for TIM4 {
868 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
869 f.debug_struct("TIM4").finish()
870 }
871}
872pub use self::tim2 as tim4;
874pub type TIM5 = crate::Periph<tim2::RegisterBlock, 0x4000_0c00>;
878impl core::fmt::Debug for TIM5 {
879 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
880 f.debug_struct("TIM5").finish()
881 }
882}
883pub use self::tim2 as tim5;
885pub type TIM6 = crate::Periph<tim6::RegisterBlock, 0x4000_1000>;
889impl core::fmt::Debug for TIM6 {
890 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
891 f.debug_struct("TIM6").finish()
892 }
893}
894pub mod tim6;
896pub type TIM7 = crate::Periph<tim6::RegisterBlock, 0x4000_1400>;
900impl core::fmt::Debug for TIM7 {
901 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
902 f.debug_struct("TIM7").finish()
903 }
904}
905pub use self::tim6 as tim7;
907pub type TIM14 = crate::Periph<tim13::RegisterBlock, 0x4000_2000>;
911impl core::fmt::Debug for TIM14 {
912 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
913 f.debug_struct("TIM14").finish()
914 }
915}
916pub use self::tim13 as tim14;
918pub type SCB_ACTRL = crate::Periph<scb_actrl::RegisterBlock, 0xe000_e008>;
922impl core::fmt::Debug for SCB_ACTRL {
923 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
924 f.debug_struct("SCB_ACTRL").finish()
925 }
926}
927pub mod scb_actrl;
929pub type NVIC_STIR = crate::Periph<nvic_stir::RegisterBlock, 0xe000_ef00>;
933impl core::fmt::Debug for NVIC_STIR {
934 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
935 f.debug_struct("NVIC_STIR").finish()
936 }
937}
938pub mod nvic_stir;
940pub type STK = crate::Periph<stk::RegisterBlock, 0xe000_e010>;
944impl core::fmt::Debug for STK {
945 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
946 f.debug_struct("STK").finish()
947 }
948}
949pub mod stk;
951#[no_mangle]
952static mut DEVICE_PERIPHERALS: bool = false;
953#[allow(non_snake_case)]
955pub struct Peripherals {
956 pub PWR: PWR,
958 pub RCC: RCC,
960 pub GPIOA: GPIOA,
962 pub GPIOB: GPIOB,
964 pub GPIOC: GPIOC,
966 pub GPIOD: GPIOD,
968 pub GPIOE: GPIOE,
970 pub GPIOF: GPIOF,
972 pub GPIOG: GPIOG,
974 pub AFIO: AFIO,
976 pub EXTI: EXTI,
978 pub DMA1: DMA1,
980 pub DMA2: DMA2,
982 pub RTC: RTC,
984 pub IWDG: IWDG,
986 pub WWDG: WWDG,
988 pub TIM2: TIM2,
990 pub TIM3: TIM3,
992 pub I2C1: I2C1,
994 pub I2C2: I2C2,
996 pub SPI1: SPI1,
998 pub USART1: USART1,
1000 pub USART2: USART2,
1002 pub USART3: USART3,
1004 pub ADC1: ADC1,
1006 pub ADC3: ADC3,
1008 pub CRC: CRC,
1010 pub FLASH: FLASH,
1012 pub DBGMCU: DBGMCU,
1014 pub BKP: BKP,
1016 pub FSMC: FSMC,
1018 pub OTG_FS_DEVICE: OTG_FS_DEVICE,
1020 pub OTG_FS_GLOBAL: OTG_FS_GLOBAL,
1022 pub OTG_FS_HOST: OTG_FS_HOST,
1024 pub OTG_FS_PWRCLK: OTG_FS_PWRCLK,
1026 pub SDIO: SDIO,
1028 pub TIM13: TIM13,
1030 pub TIM10: TIM10,
1032 pub TIM11: TIM11,
1034 pub TIM9: TIM9,
1036 pub TIM12: TIM12,
1038 pub TIM8: TIM8,
1040 pub TIM1: TIM1,
1042 pub ADC2: ADC2,
1044 pub DAC: DAC,
1046 pub USB: USB,
1048 pub UART4: UART4,
1050 pub UART5: UART5,
1052 pub SPI2: SPI2,
1054 pub SPI3: SPI3,
1056 pub TIM4: TIM4,
1058 pub TIM5: TIM5,
1060 pub TIM6: TIM6,
1062 pub TIM7: TIM7,
1064 pub TIM14: TIM14,
1066 pub SCB_ACTRL: SCB_ACTRL,
1068 pub NVIC_STIR: NVIC_STIR,
1070 pub STK: STK,
1072}
1073impl Peripherals {
1074 #[cfg(feature = "critical-section")]
1076 #[inline]
1077 pub fn take() -> Option<Self> {
1078 critical_section::with(|_| {
1079 if unsafe { DEVICE_PERIPHERALS } {
1080 return None;
1081 }
1082 Some(unsafe { Peripherals::steal() })
1083 })
1084 }
1085 #[inline]
1091 pub unsafe fn steal() -> Self {
1092 DEVICE_PERIPHERALS = true;
1093 Peripherals {
1094 PWR: PWR::steal(),
1095 RCC: RCC::steal(),
1096 GPIOA: GPIOA::steal(),
1097 GPIOB: GPIOB::steal(),
1098 GPIOC: GPIOC::steal(),
1099 GPIOD: GPIOD::steal(),
1100 GPIOE: GPIOE::steal(),
1101 GPIOF: GPIOF::steal(),
1102 GPIOG: GPIOG::steal(),
1103 AFIO: AFIO::steal(),
1104 EXTI: EXTI::steal(),
1105 DMA1: DMA1::steal(),
1106 DMA2: DMA2::steal(),
1107 RTC: RTC::steal(),
1108 IWDG: IWDG::steal(),
1109 WWDG: WWDG::steal(),
1110 TIM2: TIM2::steal(),
1111 TIM3: TIM3::steal(),
1112 I2C1: I2C1::steal(),
1113 I2C2: I2C2::steal(),
1114 SPI1: SPI1::steal(),
1115 USART1: USART1::steal(),
1116 USART2: USART2::steal(),
1117 USART3: USART3::steal(),
1118 ADC1: ADC1::steal(),
1119 ADC3: ADC3::steal(),
1120 CRC: CRC::steal(),
1121 FLASH: FLASH::steal(),
1122 DBGMCU: DBGMCU::steal(),
1123 BKP: BKP::steal(),
1124 FSMC: FSMC::steal(),
1125 OTG_FS_DEVICE: OTG_FS_DEVICE::steal(),
1126 OTG_FS_GLOBAL: OTG_FS_GLOBAL::steal(),
1127 OTG_FS_HOST: OTG_FS_HOST::steal(),
1128 OTG_FS_PWRCLK: OTG_FS_PWRCLK::steal(),
1129 SDIO: SDIO::steal(),
1130 TIM13: TIM13::steal(),
1131 TIM10: TIM10::steal(),
1132 TIM11: TIM11::steal(),
1133 TIM9: TIM9::steal(),
1134 TIM12: TIM12::steal(),
1135 TIM8: TIM8::steal(),
1136 TIM1: TIM1::steal(),
1137 ADC2: ADC2::steal(),
1138 DAC: DAC::steal(),
1139 USB: USB::steal(),
1140 UART4: UART4::steal(),
1141 UART5: UART5::steal(),
1142 SPI2: SPI2::steal(),
1143 SPI3: SPI3::steal(),
1144 TIM4: TIM4::steal(),
1145 TIM5: TIM5::steal(),
1146 TIM6: TIM6::steal(),
1147 TIM7: TIM7::steal(),
1148 TIM14: TIM14::steal(),
1149 SCB_ACTRL: SCB_ACTRL::steal(),
1150 NVIC_STIR: NVIC_STIR::steal(),
1151 STK: STK::steal(),
1152 }
1153 }
1154}