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, FPU, ITM, MPU, NVIC, SCB, SYST, TPIU};
16#[cfg(feature = "rt")]
17pub use cortex_m_rt::interrupt;
18#[cfg(feature = "rt")]
19extern "C" {
20 fn EXTI16_PVD();
21 fn TAMP_STAMP();
22 fn EXTI22_RTC_WKUP();
23 fn FLASH();
24 fn RCC();
25 fn EXTI0();
26 fn EXTI1();
27 fn EXTI2();
28 fn EXTI3();
29 fn EXTI4();
30 fn DMA1_STREAM0();
31 fn DMA1_STREAM1();
32 fn DMA1_STREAM2();
33 fn DMA1_STREAM3();
34 fn DMA1_STREAM4();
35 fn DMA1_STREAM5();
36 fn DMA1_STREAM6();
37 fn ADC();
38 fn EXTI9_5();
39 fn TIM1_BRK_TIM9();
40 fn TIM1_UP_TIM10();
41 fn TIM1_TRG_COM_TIM11();
42 fn TIM1_CC();
43 fn TIM2();
44 fn TIM3();
45 fn TIM4();
46 fn I2C1_EV();
47 fn I2C1_ER();
48 fn I2C2_EV();
49 fn I2C2_ER();
50 fn SPI1();
51 fn SPI2();
52 fn USART1();
53 fn USART2();
54 fn EXTI15_10();
55 fn EXTI17_RTC_ALARM();
56 fn EXTI18_OTG_FS_WKUP();
57 fn DMA1_STREAM7();
58 fn SDIO();
59 fn TIM5();
60 fn SPI3();
61 fn DMA2_STREAM0();
62 fn DMA2_STREAM1();
63 fn DMA2_STREAM2();
64 fn DMA2_STREAM3();
65 fn DMA2_STREAM4();
66 fn OTG_FS();
67 fn DMA2_STREAM5();
68 fn DMA2_STREAM6();
69 fn DMA2_STREAM7();
70 fn USART6();
71 fn I2C3_EV();
72 fn I2C3_ER();
73 fn FPU();
74 fn SPI4();
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; 85] = [
87 Vector { _reserved: 0 },
88 Vector {
89 _handler: EXTI16_PVD,
90 },
91 Vector {
92 _handler: TAMP_STAMP,
93 },
94 Vector {
95 _handler: EXTI22_RTC_WKUP,
96 },
97 Vector { _handler: FLASH },
98 Vector { _handler: RCC },
99 Vector { _handler: EXTI0 },
100 Vector { _handler: EXTI1 },
101 Vector { _handler: EXTI2 },
102 Vector { _handler: EXTI3 },
103 Vector { _handler: EXTI4 },
104 Vector {
105 _handler: DMA1_STREAM0,
106 },
107 Vector {
108 _handler: DMA1_STREAM1,
109 },
110 Vector {
111 _handler: DMA1_STREAM2,
112 },
113 Vector {
114 _handler: DMA1_STREAM3,
115 },
116 Vector {
117 _handler: DMA1_STREAM4,
118 },
119 Vector {
120 _handler: DMA1_STREAM5,
121 },
122 Vector {
123 _handler: DMA1_STREAM6,
124 },
125 Vector { _handler: ADC },
126 Vector { _reserved: 0 },
127 Vector { _reserved: 0 },
128 Vector { _reserved: 0 },
129 Vector { _reserved: 0 },
130 Vector { _handler: EXTI9_5 },
131 Vector {
132 _handler: TIM1_BRK_TIM9,
133 },
134 Vector {
135 _handler: TIM1_UP_TIM10,
136 },
137 Vector {
138 _handler: TIM1_TRG_COM_TIM11,
139 },
140 Vector { _handler: TIM1_CC },
141 Vector { _handler: TIM2 },
142 Vector { _handler: TIM3 },
143 Vector { _handler: TIM4 },
144 Vector { _handler: I2C1_EV },
145 Vector { _handler: I2C1_ER },
146 Vector { _handler: I2C2_EV },
147 Vector { _handler: I2C2_ER },
148 Vector { _handler: SPI1 },
149 Vector { _handler: SPI2 },
150 Vector { _handler: USART1 },
151 Vector { _handler: USART2 },
152 Vector { _reserved: 0 },
153 Vector {
154 _handler: EXTI15_10,
155 },
156 Vector {
157 _handler: EXTI17_RTC_ALARM,
158 },
159 Vector {
160 _handler: EXTI18_OTG_FS_WKUP,
161 },
162 Vector { _reserved: 0 },
163 Vector { _reserved: 0 },
164 Vector { _reserved: 0 },
165 Vector { _reserved: 0 },
166 Vector {
167 _handler: DMA1_STREAM7,
168 },
169 Vector { _reserved: 0 },
170 Vector { _handler: SDIO },
171 Vector { _handler: TIM5 },
172 Vector { _handler: SPI3 },
173 Vector { _reserved: 0 },
174 Vector { _reserved: 0 },
175 Vector { _reserved: 0 },
176 Vector { _reserved: 0 },
177 Vector {
178 _handler: DMA2_STREAM0,
179 },
180 Vector {
181 _handler: DMA2_STREAM1,
182 },
183 Vector {
184 _handler: DMA2_STREAM2,
185 },
186 Vector {
187 _handler: DMA2_STREAM3,
188 },
189 Vector {
190 _handler: DMA2_STREAM4,
191 },
192 Vector { _reserved: 0 },
193 Vector { _reserved: 0 },
194 Vector { _reserved: 0 },
195 Vector { _reserved: 0 },
196 Vector { _reserved: 0 },
197 Vector { _reserved: 0 },
198 Vector { _handler: OTG_FS },
199 Vector {
200 _handler: DMA2_STREAM5,
201 },
202 Vector {
203 _handler: DMA2_STREAM6,
204 },
205 Vector {
206 _handler: DMA2_STREAM7,
207 },
208 Vector { _handler: USART6 },
209 Vector { _handler: I2C3_EV },
210 Vector { _handler: I2C3_ER },
211 Vector { _reserved: 0 },
212 Vector { _reserved: 0 },
213 Vector { _reserved: 0 },
214 Vector { _reserved: 0 },
215 Vector { _reserved: 0 },
216 Vector { _reserved: 0 },
217 Vector { _reserved: 0 },
218 Vector { _handler: FPU },
219 Vector { _reserved: 0 },
220 Vector { _reserved: 0 },
221 Vector { _handler: SPI4 },
222];
223#[cfg_attr(feature = "defmt", derive(defmt::Format))]
225#[derive(Copy, Clone, Debug, PartialEq, Eq)]
226#[repr(u16)]
227pub enum Interrupt {
228 EXTI16_PVD = 1,
230 TAMP_STAMP = 2,
232 EXTI22_RTC_WKUP = 3,
234 FLASH = 4,
236 RCC = 5,
238 EXTI0 = 6,
240 EXTI1 = 7,
242 EXTI2 = 8,
244 EXTI3 = 9,
246 EXTI4 = 10,
248 DMA1_STREAM0 = 11,
250 DMA1_STREAM1 = 12,
252 DMA1_STREAM2 = 13,
254 DMA1_STREAM3 = 14,
256 DMA1_STREAM4 = 15,
258 DMA1_STREAM5 = 16,
260 DMA1_STREAM6 = 17,
262 ADC = 18,
264 EXTI9_5 = 23,
266 TIM1_BRK_TIM9 = 24,
268 TIM1_UP_TIM10 = 25,
270 TIM1_TRG_COM_TIM11 = 26,
272 TIM1_CC = 27,
274 TIM2 = 28,
276 TIM3 = 29,
278 TIM4 = 30,
280 I2C1_EV = 31,
282 I2C1_ER = 32,
284 I2C2_EV = 33,
286 I2C2_ER = 34,
288 SPI1 = 35,
290 SPI2 = 36,
292 USART1 = 37,
294 USART2 = 38,
296 EXTI15_10 = 40,
298 EXTI17_RTC_ALARM = 41,
300 EXTI18_OTG_FS_WKUP = 42,
302 DMA1_STREAM7 = 47,
304 SDIO = 49,
306 TIM5 = 50,
308 SPI3 = 51,
310 DMA2_STREAM0 = 56,
312 DMA2_STREAM1 = 57,
314 DMA2_STREAM2 = 58,
316 DMA2_STREAM3 = 59,
318 DMA2_STREAM4 = 60,
320 OTG_FS = 67,
322 DMA2_STREAM5 = 68,
324 DMA2_STREAM6 = 69,
326 DMA2_STREAM7 = 70,
328 USART6 = 71,
330 I2C3_EV = 72,
332 I2C3_ER = 73,
334 FPU = 81,
336 SPI4 = 84,
338}
339unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
340 #[inline(always)]
341 fn number(self) -> u16 {
342 self as u16
343 }
344}
345pub type ADC_COMMON = crate::Periph<adc_common::RegisterBlock, 0x4001_2300>;
349impl core::fmt::Debug for ADC_COMMON {
350 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
351 f.debug_struct("ADC_COMMON").finish()
352 }
353}
354pub mod adc_common;
356pub type ADC1 = crate::Periph<adc1::RegisterBlock, 0x4001_2000>;
360impl core::fmt::Debug for ADC1 {
361 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
362 f.debug_struct("ADC1").finish()
363 }
364}
365pub mod adc1;
367pub type CRC = crate::Periph<crc::RegisterBlock, 0x4002_3000>;
371impl core::fmt::Debug for CRC {
372 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
373 f.debug_struct("CRC").finish()
374 }
375}
376pub mod crc;
378pub type DBGMCU = crate::Periph<dbgmcu::RegisterBlock, 0xe004_2000>;
382impl core::fmt::Debug for DBGMCU {
383 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
384 f.debug_struct("DBGMCU").finish()
385 }
386}
387pub mod dbgmcu;
389pub type EXTI = crate::Periph<exti::RegisterBlock, 0x4001_3c00>;
393impl core::fmt::Debug for EXTI {
394 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
395 f.debug_struct("EXTI").finish()
396 }
397}
398pub mod exti;
400pub type FLASH = crate::Periph<flash::RegisterBlock, 0x4002_3c00>;
404impl core::fmt::Debug for FLASH {
405 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
406 f.debug_struct("FLASH").finish()
407 }
408}
409pub mod flash;
411pub type IWDG = crate::Periph<iwdg::RegisterBlock, 0x4000_3000>;
415impl core::fmt::Debug for IWDG {
416 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
417 f.debug_struct("IWDG").finish()
418 }
419}
420pub mod iwdg;
422pub type OTG_FS_DEVICE = crate::Periph<otg_fs_device::RegisterBlock, 0x5000_0800>;
426impl core::fmt::Debug for OTG_FS_DEVICE {
427 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
428 f.debug_struct("OTG_FS_DEVICE").finish()
429 }
430}
431pub mod otg_fs_device;
433pub type OTG_FS_GLOBAL = crate::Periph<otg_fs_global::RegisterBlock, 0x5000_0000>;
437impl core::fmt::Debug for OTG_FS_GLOBAL {
438 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
439 f.debug_struct("OTG_FS_GLOBAL").finish()
440 }
441}
442pub mod otg_fs_global;
444pub type OTG_FS_HOST = crate::Periph<otg_fs_host::RegisterBlock, 0x5000_0400>;
448impl core::fmt::Debug for OTG_FS_HOST {
449 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
450 f.debug_struct("OTG_FS_HOST").finish()
451 }
452}
453pub mod otg_fs_host;
455pub type OTG_FS_PWRCLK = crate::Periph<otg_fs_pwrclk::RegisterBlock, 0x5000_0e00>;
459impl core::fmt::Debug for OTG_FS_PWRCLK {
460 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
461 f.debug_struct("OTG_FS_PWRCLK").finish()
462 }
463}
464pub mod otg_fs_pwrclk;
466pub type PWR = crate::Periph<pwr::RegisterBlock, 0x4000_7000>;
470impl core::fmt::Debug for PWR {
471 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
472 f.debug_struct("PWR").finish()
473 }
474}
475pub mod pwr;
477pub type RCC = crate::Periph<rcc::RegisterBlock, 0x4002_3800>;
481impl core::fmt::Debug for RCC {
482 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
483 f.debug_struct("RCC").finish()
484 }
485}
486pub mod rcc;
488pub type RTC = crate::Periph<rtc::RegisterBlock, 0x4000_2800>;
492impl core::fmt::Debug for RTC {
493 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
494 f.debug_struct("RTC").finish()
495 }
496}
497pub mod rtc;
499pub type SDIO = crate::Periph<sdio::RegisterBlock, 0x4001_2c00>;
503impl core::fmt::Debug for SDIO {
504 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
505 f.debug_struct("SDIO").finish()
506 }
507}
508pub mod sdio;
510pub type SYSCFG = crate::Periph<syscfg::RegisterBlock, 0x4001_3800>;
514impl core::fmt::Debug for SYSCFG {
515 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
516 f.debug_struct("SYSCFG").finish()
517 }
518}
519pub mod syscfg;
521pub type TIM1 = crate::Periph<tim1::RegisterBlock, 0x4001_0000>;
525impl core::fmt::Debug for TIM1 {
526 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
527 f.debug_struct("TIM1").finish()
528 }
529}
530pub mod tim1;
532pub type TIM10 = crate::Periph<tim10::RegisterBlock, 0x4001_4400>;
536impl core::fmt::Debug for TIM10 {
537 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
538 f.debug_struct("TIM10").finish()
539 }
540}
541pub mod tim10;
543pub type TIM11 = crate::Periph<tim11::RegisterBlock, 0x4001_4800>;
547impl core::fmt::Debug for TIM11 {
548 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
549 f.debug_struct("TIM11").finish()
550 }
551}
552pub mod tim11;
554pub type TIM2 = crate::Periph<tim2::RegisterBlock, 0x4000_0000>;
558impl core::fmt::Debug for TIM2 {
559 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
560 f.debug_struct("TIM2").finish()
561 }
562}
563pub mod tim2;
565pub type TIM3 = crate::Periph<tim3::RegisterBlock, 0x4000_0400>;
569impl core::fmt::Debug for TIM3 {
570 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
571 f.debug_struct("TIM3").finish()
572 }
573}
574pub mod tim3;
576pub type TIM4 = crate::Periph<tim3::RegisterBlock, 0x4000_0800>;
580impl core::fmt::Debug for TIM4 {
581 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
582 f.debug_struct("TIM4").finish()
583 }
584}
585pub use self::tim3 as tim4;
587pub type TIM5 = crate::Periph<tim5::RegisterBlock, 0x4000_0c00>;
591impl core::fmt::Debug for TIM5 {
592 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
593 f.debug_struct("TIM5").finish()
594 }
595}
596pub mod tim5;
598pub type TIM9 = crate::Periph<tim9::RegisterBlock, 0x4001_4000>;
602impl core::fmt::Debug for TIM9 {
603 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
604 f.debug_struct("TIM9").finish()
605 }
606}
607pub mod tim9;
609pub type USART1 = crate::Periph<usart1::RegisterBlock, 0x4001_1000>;
613impl core::fmt::Debug for USART1 {
614 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
615 f.debug_struct("USART1").finish()
616 }
617}
618pub mod usart1;
620pub type USART2 = crate::Periph<usart1::RegisterBlock, 0x4000_4400>;
624impl core::fmt::Debug for USART2 {
625 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
626 f.debug_struct("USART2").finish()
627 }
628}
629pub use self::usart1 as usart2;
631pub type USART6 = crate::Periph<usart1::RegisterBlock, 0x4001_1400>;
635impl core::fmt::Debug for USART6 {
636 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
637 f.debug_struct("USART6").finish()
638 }
639}
640pub use self::usart1 as usart6;
642pub type WWDG = crate::Periph<wwdg::RegisterBlock, 0x4000_2c00>;
646impl core::fmt::Debug for WWDG {
647 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
648 f.debug_struct("WWDG").finish()
649 }
650}
651pub mod wwdg;
653pub type DMA2 = crate::Periph<dma2::RegisterBlock, 0x4002_6400>;
657impl core::fmt::Debug for DMA2 {
658 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
659 f.debug_struct("DMA2").finish()
660 }
661}
662pub mod dma2;
664pub type DMA1 = crate::Periph<dma2::RegisterBlock, 0x4002_6000>;
668impl core::fmt::Debug for DMA1 {
669 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
670 f.debug_struct("DMA1").finish()
671 }
672}
673pub use self::dma2 as dma1;
675pub type GPIOH = crate::Periph<gpioh::RegisterBlock, 0x4002_1c00>;
679impl core::fmt::Debug for GPIOH {
680 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
681 f.debug_struct("GPIOH").finish()
682 }
683}
684pub mod gpioh;
686pub type GPIOE = crate::Periph<gpioh::RegisterBlock, 0x4002_1000>;
690impl core::fmt::Debug for GPIOE {
691 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
692 f.debug_struct("GPIOE").finish()
693 }
694}
695pub use self::gpioh as gpioe;
697pub type GPIOD = crate::Periph<gpioh::RegisterBlock, 0x4002_0c00>;
701impl core::fmt::Debug for GPIOD {
702 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
703 f.debug_struct("GPIOD").finish()
704 }
705}
706pub use self::gpioh as gpiod;
708pub type GPIOC = crate::Periph<gpioh::RegisterBlock, 0x4002_0800>;
712impl core::fmt::Debug for GPIOC {
713 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
714 f.debug_struct("GPIOC").finish()
715 }
716}
717pub use self::gpioh as gpioc;
719pub type GPIOB = crate::Periph<gpiob::RegisterBlock, 0x4002_0400>;
723impl core::fmt::Debug for GPIOB {
724 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
725 f.debug_struct("GPIOB").finish()
726 }
727}
728pub mod gpiob;
730pub type GPIOA = crate::Periph<gpioa::RegisterBlock, 0x4002_0000>;
734impl core::fmt::Debug for GPIOA {
735 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
736 f.debug_struct("GPIOA").finish()
737 }
738}
739pub mod gpioa;
741pub type I2C1 = crate::Periph<i2c1::RegisterBlock, 0x4000_5400>;
745impl core::fmt::Debug for I2C1 {
746 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
747 f.debug_struct("I2C1").finish()
748 }
749}
750pub mod i2c1;
752pub type I2C3 = crate::Periph<i2c1::RegisterBlock, 0x4000_5c00>;
756impl core::fmt::Debug for I2C3 {
757 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
758 f.debug_struct("I2C3").finish()
759 }
760}
761pub use self::i2c1 as i2c3;
763pub type I2C2 = crate::Periph<i2c1::RegisterBlock, 0x4000_5800>;
767impl core::fmt::Debug for I2C2 {
768 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
769 f.debug_struct("I2C2").finish()
770 }
771}
772pub use self::i2c1 as i2c2;
774pub type SPI1 = crate::Periph<spi1::RegisterBlock, 0x4001_3000>;
778impl core::fmt::Debug for SPI1 {
779 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
780 f.debug_struct("SPI1").finish()
781 }
782}
783pub mod spi1;
785pub type I2S2EXT = crate::Periph<spi1::RegisterBlock, 0x4000_3400>;
789impl core::fmt::Debug for I2S2EXT {
790 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
791 f.debug_struct("I2S2EXT").finish()
792 }
793}
794pub use self::spi1 as i2s2ext;
796pub type I2S3EXT = crate::Periph<spi1::RegisterBlock, 0x4000_4000>;
800impl core::fmt::Debug for I2S3EXT {
801 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
802 f.debug_struct("I2S3EXT").finish()
803 }
804}
805pub use self::spi1 as i2s3ext;
807pub type SPI2 = crate::Periph<spi1::RegisterBlock, 0x4000_3800>;
811impl core::fmt::Debug for SPI2 {
812 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
813 f.debug_struct("SPI2").finish()
814 }
815}
816pub use self::spi1 as spi2;
818pub type SPI3 = crate::Periph<spi1::RegisterBlock, 0x4000_3c00>;
822impl core::fmt::Debug for SPI3 {
823 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
824 f.debug_struct("SPI3").finish()
825 }
826}
827pub use self::spi1 as spi3;
829pub type SPI4 = crate::Periph<spi1::RegisterBlock, 0x4001_3400>;
833impl core::fmt::Debug for SPI4 {
834 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
835 f.debug_struct("SPI4").finish()
836 }
837}
838pub use self::spi1 as spi4;
840#[no_mangle]
841static mut DEVICE_PERIPHERALS: bool = false;
842#[allow(non_snake_case)]
844pub struct Peripherals {
845 pub ADC_COMMON: ADC_COMMON,
847 pub ADC1: ADC1,
849 pub CRC: CRC,
851 pub DBGMCU: DBGMCU,
853 pub EXTI: EXTI,
855 pub FLASH: FLASH,
857 pub IWDG: IWDG,
859 pub OTG_FS_DEVICE: OTG_FS_DEVICE,
861 pub OTG_FS_GLOBAL: OTG_FS_GLOBAL,
863 pub OTG_FS_HOST: OTG_FS_HOST,
865 pub OTG_FS_PWRCLK: OTG_FS_PWRCLK,
867 pub PWR: PWR,
869 pub RCC: RCC,
871 pub RTC: RTC,
873 pub SDIO: SDIO,
875 pub SYSCFG: SYSCFG,
877 pub TIM1: TIM1,
879 pub TIM10: TIM10,
881 pub TIM11: TIM11,
883 pub TIM2: TIM2,
885 pub TIM3: TIM3,
887 pub TIM4: TIM4,
889 pub TIM5: TIM5,
891 pub TIM9: TIM9,
893 pub USART1: USART1,
895 pub USART2: USART2,
897 pub USART6: USART6,
899 pub WWDG: WWDG,
901 pub DMA2: DMA2,
903 pub DMA1: DMA1,
905 pub GPIOH: GPIOH,
907 pub GPIOE: GPIOE,
909 pub GPIOD: GPIOD,
911 pub GPIOC: GPIOC,
913 pub GPIOB: GPIOB,
915 pub GPIOA: GPIOA,
917 pub I2C1: I2C1,
919 pub I2C3: I2C3,
921 pub I2C2: I2C2,
923 pub SPI1: SPI1,
925 pub I2S2EXT: I2S2EXT,
927 pub I2S3EXT: I2S3EXT,
929 pub SPI2: SPI2,
931 pub SPI3: SPI3,
933 pub SPI4: SPI4,
935}
936impl Peripherals {
937 #[cfg(feature = "critical-section")]
939 #[inline]
940 pub fn take() -> Option<Self> {
941 critical_section::with(|_| {
942 if unsafe { DEVICE_PERIPHERALS } {
943 return None;
944 }
945 Some(unsafe { Peripherals::steal() })
946 })
947 }
948 #[inline]
954 pub unsafe fn steal() -> Self {
955 DEVICE_PERIPHERALS = true;
956 Peripherals {
957 ADC_COMMON: ADC_COMMON::steal(),
958 ADC1: ADC1::steal(),
959 CRC: CRC::steal(),
960 DBGMCU: DBGMCU::steal(),
961 EXTI: EXTI::steal(),
962 FLASH: FLASH::steal(),
963 IWDG: IWDG::steal(),
964 OTG_FS_DEVICE: OTG_FS_DEVICE::steal(),
965 OTG_FS_GLOBAL: OTG_FS_GLOBAL::steal(),
966 OTG_FS_HOST: OTG_FS_HOST::steal(),
967 OTG_FS_PWRCLK: OTG_FS_PWRCLK::steal(),
968 PWR: PWR::steal(),
969 RCC: RCC::steal(),
970 RTC: RTC::steal(),
971 SDIO: SDIO::steal(),
972 SYSCFG: SYSCFG::steal(),
973 TIM1: TIM1::steal(),
974 TIM10: TIM10::steal(),
975 TIM11: TIM11::steal(),
976 TIM2: TIM2::steal(),
977 TIM3: TIM3::steal(),
978 TIM4: TIM4::steal(),
979 TIM5: TIM5::steal(),
980 TIM9: TIM9::steal(),
981 USART1: USART1::steal(),
982 USART2: USART2::steal(),
983 USART6: USART6::steal(),
984 WWDG: WWDG::steal(),
985 DMA2: DMA2::steal(),
986 DMA1: DMA1::steal(),
987 GPIOH: GPIOH::steal(),
988 GPIOE: GPIOE::steal(),
989 GPIOD: GPIOD::steal(),
990 GPIOC: GPIOC::steal(),
991 GPIOB: GPIOB::steal(),
992 GPIOA: GPIOA::steal(),
993 I2C1: I2C1::steal(),
994 I2C3: I2C3::steal(),
995 I2C2: I2C2::steal(),
996 SPI1: SPI1::steal(),
997 I2S2EXT: I2S2EXT::steal(),
998 I2S3EXT: I2S3EXT::steal(),
999 SPI2: SPI2::steal(),
1000 SPI3: SPI3::steal(),
1001 SPI4: SPI4::steal(),
1002 }
1003 }
1004}