1use core::marker::PhantomData;
12use core::ops::Deref;
13pub const NVIC_PRIO_BITS: u8 = 4;
15#[cfg(feature = "rt")]
16pub use self::Interrupt as interrupt;
17pub use cortex_m::peripheral::Peripherals as CorePeripherals;
18pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
19#[cfg(feature = "rt")]
20pub use cortex_m_rt::interrupt;
21#[cfg(feature = "rt")]
22extern "C" {
23 fn WWDG();
24 fn PVD();
25 fn RTC();
26 fn FLASH();
27 fn RCC();
28 fn EXTI0_1();
29 fn EXTI2_3();
30 fn EXTI4_15();
31 fn DMA_CHANNEL1();
32 fn DMA_CHANNEL2_3();
33 fn ADC_COMP();
34 fn TIM1_BRK_UP_TRG_COM();
35 fn TIM1_CC();
36 fn TIM3();
37 fn TIM14();
38 fn TIM16();
39 fn TIM17();
40 fn I2C1();
41 fn SPI1();
42 fn USART1();
43 fn USART2();
44}
45#[doc(hidden)]
46pub union Vector {
47 _handler: unsafe extern "C" fn(),
48 _reserved: u32,
49}
50#[cfg(feature = "rt")]
51#[doc(hidden)]
52#[link_section = ".vector_table.interrupts"]
53#[no_mangle]
54pub static __INTERRUPTS: [Vector; 29] = [
55 Vector { _handler: WWDG },
56 Vector { _handler: PVD },
57 Vector { _handler: RTC },
58 Vector { _handler: FLASH },
59 Vector { _handler: RCC },
60 Vector { _handler: EXTI0_1 },
61 Vector { _handler: EXTI2_3 },
62 Vector { _handler: EXTI4_15 },
63 Vector { _reserved: 0 },
64 Vector {
65 _handler: DMA_CHANNEL1,
66 },
67 Vector {
68 _handler: DMA_CHANNEL2_3,
69 },
70 Vector { _reserved: 0 },
71 Vector { _handler: ADC_COMP },
72 Vector {
73 _handler: TIM1_BRK_UP_TRG_COM,
74 },
75 Vector { _handler: TIM1_CC },
76 Vector { _reserved: 0 },
77 Vector { _handler: TIM3 },
78 Vector { _reserved: 0 },
79 Vector { _reserved: 0 },
80 Vector { _handler: TIM14 },
81 Vector { _reserved: 0 },
82 Vector { _handler: TIM16 },
83 Vector { _handler: TIM17 },
84 Vector { _handler: I2C1 },
85 Vector { _reserved: 0 },
86 Vector { _handler: SPI1 },
87 Vector { _reserved: 0 },
88 Vector { _handler: USART1 },
89 Vector { _handler: USART2 },
90];
91#[derive(Copy, Clone, Debug, PartialEq, Eq)]
93#[repr(u16)]
94pub enum Interrupt {
95 WWDG = 0,
97 PVD = 1,
99 RTC = 2,
101 FLASH = 3,
103 RCC = 4,
105 EXTI0_1 = 5,
107 EXTI2_3 = 6,
109 EXTI4_15 = 7,
111 DMA_CHANNEL1 = 9,
113 DMA_CHANNEL2_3 = 10,
115 ADC_COMP = 12,
117 TIM1_BRK_UP_TRG_COM = 13,
119 TIM1_CC = 14,
121 TIM3 = 16,
123 TIM14 = 19,
125 TIM16 = 21,
127 TIM17 = 22,
129 I2C1 = 23,
131 SPI1 = 25,
133 USART1 = 27,
135 USART2 = 28,
137}
138unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
139 #[inline(always)]
140 fn number(self) -> u16 {
141 self as u16
142 }
143}
144pub struct ADC {
146 _marker: PhantomData<*const ()>,
147}
148unsafe impl Send for ADC {}
149impl ADC {
150 pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
152 #[inline(always)]
154 pub const fn ptr() -> *const adc::RegisterBlock {
155 Self::PTR
156 }
157}
158impl Deref for ADC {
159 type Target = adc::RegisterBlock;
160 #[inline(always)]
161 fn deref(&self) -> &Self::Target {
162 unsafe { &*Self::PTR }
163 }
164}
165impl core::fmt::Debug for ADC {
166 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
167 f.debug_struct("ADC").finish()
168 }
169}
170pub mod adc;
172pub struct COMP1 {
174 _marker: PhantomData<*const ()>,
175}
176unsafe impl Send for COMP1 {}
177impl COMP1 {
178 pub const PTR: *const comp1::RegisterBlock = 0x4001_0200 as *const _;
180 #[inline(always)]
182 pub const fn ptr() -> *const comp1::RegisterBlock {
183 Self::PTR
184 }
185}
186impl Deref for COMP1 {
187 type Target = comp1::RegisterBlock;
188 #[inline(always)]
189 fn deref(&self) -> &Self::Target {
190 unsafe { &*Self::PTR }
191 }
192}
193impl core::fmt::Debug for COMP1 {
194 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
195 f.debug_struct("COMP1").finish()
196 }
197}
198pub mod comp1;
200pub struct COMP2 {
202 _marker: PhantomData<*const ()>,
203}
204unsafe impl Send for COMP2 {}
205impl COMP2 {
206 pub const PTR: *const comp2::RegisterBlock = 0x4001_0210 as *const _;
208 #[inline(always)]
210 pub const fn ptr() -> *const comp2::RegisterBlock {
211 Self::PTR
212 }
213}
214impl Deref for COMP2 {
215 type Target = comp2::RegisterBlock;
216 #[inline(always)]
217 fn deref(&self) -> &Self::Target {
218 unsafe { &*Self::PTR }
219 }
220}
221impl core::fmt::Debug for COMP2 {
222 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
223 f.debug_struct("COMP2").finish()
224 }
225}
226pub mod comp2;
228pub struct RCC {
230 _marker: PhantomData<*const ()>,
231}
232unsafe impl Send for RCC {}
233impl RCC {
234 pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
236 #[inline(always)]
238 pub const fn ptr() -> *const rcc::RegisterBlock {
239 Self::PTR
240 }
241}
242impl Deref for RCC {
243 type Target = rcc::RegisterBlock;
244 #[inline(always)]
245 fn deref(&self) -> &Self::Target {
246 unsafe { &*Self::PTR }
247 }
248}
249impl core::fmt::Debug for RCC {
250 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
251 f.debug_struct("RCC").finish()
252 }
253}
254pub mod rcc;
256pub struct PWR {
258 _marker: PhantomData<*const ()>,
259}
260unsafe impl Send for PWR {}
261impl PWR {
262 pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
264 #[inline(always)]
266 pub const fn ptr() -> *const pwr::RegisterBlock {
267 Self::PTR
268 }
269}
270impl Deref for PWR {
271 type Target = pwr::RegisterBlock;
272 #[inline(always)]
273 fn deref(&self) -> &Self::Target {
274 unsafe { &*Self::PTR }
275 }
276}
277impl core::fmt::Debug for PWR {
278 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
279 f.debug_struct("PWR").finish()
280 }
281}
282pub mod pwr;
284pub struct GPIOA {
286 _marker: PhantomData<*const ()>,
287}
288unsafe impl Send for GPIOA {}
289impl GPIOA {
290 pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
292 #[inline(always)]
294 pub const fn ptr() -> *const gpioa::RegisterBlock {
295 Self::PTR
296 }
297}
298impl Deref for GPIOA {
299 type Target = gpioa::RegisterBlock;
300 #[inline(always)]
301 fn deref(&self) -> &Self::Target {
302 unsafe { &*Self::PTR }
303 }
304}
305impl core::fmt::Debug for GPIOA {
306 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
307 f.debug_struct("GPIOA").finish()
308 }
309}
310pub mod gpioa;
312pub struct GPIOB {
314 _marker: PhantomData<*const ()>,
315}
316unsafe impl Send for GPIOB {}
317impl GPIOB {
318 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
320 #[inline(always)]
322 pub const fn ptr() -> *const gpiob::RegisterBlock {
323 Self::PTR
324 }
325}
326impl Deref for GPIOB {
327 type Target = gpiob::RegisterBlock;
328 #[inline(always)]
329 fn deref(&self) -> &Self::Target {
330 unsafe { &*Self::PTR }
331 }
332}
333impl core::fmt::Debug for GPIOB {
334 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
335 f.debug_struct("GPIOB").finish()
336 }
337}
338pub mod gpiob;
340pub struct GPIOF {
342 _marker: PhantomData<*const ()>,
343}
344unsafe impl Send for GPIOF {}
345impl GPIOF {
346 pub const PTR: *const gpiob::RegisterBlock = 0x5000_1400 as *const _;
348 #[inline(always)]
350 pub const fn ptr() -> *const gpiob::RegisterBlock {
351 Self::PTR
352 }
353}
354impl Deref for GPIOF {
355 type Target = gpiob::RegisterBlock;
356 #[inline(always)]
357 fn deref(&self) -> &Self::Target {
358 unsafe { &*Self::PTR }
359 }
360}
361impl core::fmt::Debug for GPIOF {
362 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
363 f.debug_struct("GPIOF").finish()
364 }
365}
366pub use self::gpiob as gpiof;
368pub struct EXTI {
370 _marker: PhantomData<*const ()>,
371}
372unsafe impl Send for EXTI {}
373impl EXTI {
374 pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
376 #[inline(always)]
378 pub const fn ptr() -> *const exti::RegisterBlock {
379 Self::PTR
380 }
381}
382impl Deref for EXTI {
383 type Target = exti::RegisterBlock;
384 #[inline(always)]
385 fn deref(&self) -> &Self::Target {
386 unsafe { &*Self::PTR }
387 }
388}
389impl core::fmt::Debug for EXTI {
390 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
391 f.debug_struct("EXTI").finish()
392 }
393}
394pub mod exti;
396pub struct LPTIM {
398 _marker: PhantomData<*const ()>,
399}
400unsafe impl Send for LPTIM {}
401impl LPTIM {
402 pub const PTR: *const lptim::RegisterBlock = 0x4000_7c00 as *const _;
404 #[inline(always)]
406 pub const fn ptr() -> *const lptim::RegisterBlock {
407 Self::PTR
408 }
409}
410impl Deref for LPTIM {
411 type Target = lptim::RegisterBlock;
412 #[inline(always)]
413 fn deref(&self) -> &Self::Target {
414 unsafe { &*Self::PTR }
415 }
416}
417impl core::fmt::Debug for LPTIM {
418 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
419 f.debug_struct("LPTIM").finish()
420 }
421}
422pub mod lptim;
424pub struct USART1 {
426 _marker: PhantomData<*const ()>,
427}
428unsafe impl Send for USART1 {}
429impl USART1 {
430 pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
432 #[inline(always)]
434 pub const fn ptr() -> *const usart1::RegisterBlock {
435 Self::PTR
436 }
437}
438impl Deref for USART1 {
439 type Target = usart1::RegisterBlock;
440 #[inline(always)]
441 fn deref(&self) -> &Self::Target {
442 unsafe { &*Self::PTR }
443 }
444}
445impl core::fmt::Debug for USART1 {
446 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
447 f.debug_struct("USART1").finish()
448 }
449}
450pub mod usart1;
452pub struct USART2 {
454 _marker: PhantomData<*const ()>,
455}
456unsafe impl Send for USART2 {}
457impl USART2 {
458 pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
460 #[inline(always)]
462 pub const fn ptr() -> *const usart1::RegisterBlock {
463 Self::PTR
464 }
465}
466impl Deref for USART2 {
467 type Target = usart1::RegisterBlock;
468 #[inline(always)]
469 fn deref(&self) -> &Self::Target {
470 unsafe { &*Self::PTR }
471 }
472}
473impl core::fmt::Debug for USART2 {
474 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
475 f.debug_struct("USART2").finish()
476 }
477}
478pub use self::usart1 as usart2;
480pub struct RTC {
482 _marker: PhantomData<*const ()>,
483}
484unsafe impl Send for RTC {}
485impl RTC {
486 pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
488 #[inline(always)]
490 pub const fn ptr() -> *const rtc::RegisterBlock {
491 Self::PTR
492 }
493}
494impl Deref for RTC {
495 type Target = rtc::RegisterBlock;
496 #[inline(always)]
497 fn deref(&self) -> &Self::Target {
498 unsafe { &*Self::PTR }
499 }
500}
501impl core::fmt::Debug for RTC {
502 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
503 f.debug_struct("RTC").finish()
504 }
505}
506pub mod rtc;
508pub struct IWDG {
510 _marker: PhantomData<*const ()>,
511}
512unsafe impl Send for IWDG {}
513impl IWDG {
514 pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
516 #[inline(always)]
518 pub const fn ptr() -> *const iwdg::RegisterBlock {
519 Self::PTR
520 }
521}
522impl Deref for IWDG {
523 type Target = iwdg::RegisterBlock;
524 #[inline(always)]
525 fn deref(&self) -> &Self::Target {
526 unsafe { &*Self::PTR }
527 }
528}
529impl core::fmt::Debug for IWDG {
530 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
531 f.debug_struct("IWDG").finish()
532 }
533}
534pub mod iwdg;
536pub struct WWDG {
538 _marker: PhantomData<*const ()>,
539}
540unsafe impl Send for WWDG {}
541impl WWDG {
542 pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
544 #[inline(always)]
546 pub const fn ptr() -> *const wwdg::RegisterBlock {
547 Self::PTR
548 }
549}
550impl Deref for WWDG {
551 type Target = wwdg::RegisterBlock;
552 #[inline(always)]
553 fn deref(&self) -> &Self::Target {
554 unsafe { &*Self::PTR }
555 }
556}
557impl core::fmt::Debug for WWDG {
558 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
559 f.debug_struct("WWDG").finish()
560 }
561}
562pub mod wwdg;
564pub struct TIM1 {
566 _marker: PhantomData<*const ()>,
567}
568unsafe impl Send for TIM1 {}
569impl TIM1 {
570 pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
572 #[inline(always)]
574 pub const fn ptr() -> *const tim1::RegisterBlock {
575 Self::PTR
576 }
577}
578impl Deref for TIM1 {
579 type Target = tim1::RegisterBlock;
580 #[inline(always)]
581 fn deref(&self) -> &Self::Target {
582 unsafe { &*Self::PTR }
583 }
584}
585impl core::fmt::Debug for TIM1 {
586 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
587 f.debug_struct("TIM1").finish()
588 }
589}
590pub mod tim1;
592pub struct TIM3 {
594 _marker: PhantomData<*const ()>,
595}
596unsafe impl Send for TIM3 {}
597impl TIM3 {
598 pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
600 #[inline(always)]
602 pub const fn ptr() -> *const tim3::RegisterBlock {
603 Self::PTR
604 }
605}
606impl Deref for TIM3 {
607 type Target = tim3::RegisterBlock;
608 #[inline(always)]
609 fn deref(&self) -> &Self::Target {
610 unsafe { &*Self::PTR }
611 }
612}
613impl core::fmt::Debug for TIM3 {
614 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
615 f.debug_struct("TIM3").finish()
616 }
617}
618pub mod tim3;
620pub struct TIM14 {
622 _marker: PhantomData<*const ()>,
623}
624unsafe impl Send for TIM14 {}
625impl TIM14 {
626 pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
628 #[inline(always)]
630 pub const fn ptr() -> *const tim14::RegisterBlock {
631 Self::PTR
632 }
633}
634impl Deref for TIM14 {
635 type Target = tim14::RegisterBlock;
636 #[inline(always)]
637 fn deref(&self) -> &Self::Target {
638 unsafe { &*Self::PTR }
639 }
640}
641impl core::fmt::Debug for TIM14 {
642 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
643 f.debug_struct("TIM14").finish()
644 }
645}
646pub mod tim14;
648pub struct TIM16 {
650 _marker: PhantomData<*const ()>,
651}
652unsafe impl Send for TIM16 {}
653impl TIM16 {
654 pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
656 #[inline(always)]
658 pub const fn ptr() -> *const tim16::RegisterBlock {
659 Self::PTR
660 }
661}
662impl Deref for TIM16 {
663 type Target = tim16::RegisterBlock;
664 #[inline(always)]
665 fn deref(&self) -> &Self::Target {
666 unsafe { &*Self::PTR }
667 }
668}
669impl core::fmt::Debug for TIM16 {
670 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
671 f.debug_struct("TIM16").finish()
672 }
673}
674pub mod tim16;
676pub struct TIM17 {
678 _marker: PhantomData<*const ()>,
679}
680unsafe impl Send for TIM17 {}
681impl TIM17 {
682 pub const PTR: *const tim16::RegisterBlock = 0x4001_4800 as *const _;
684 #[inline(always)]
686 pub const fn ptr() -> *const tim16::RegisterBlock {
687 Self::PTR
688 }
689}
690impl Deref for TIM17 {
691 type Target = tim16::RegisterBlock;
692 #[inline(always)]
693 fn deref(&self) -> &Self::Target {
694 unsafe { &*Self::PTR }
695 }
696}
697impl core::fmt::Debug for TIM17 {
698 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
699 f.debug_struct("TIM17").finish()
700 }
701}
702pub use self::tim16 as tim17;
704pub struct SYSCFG {
706 _marker: PhantomData<*const ()>,
707}
708unsafe impl Send for SYSCFG {}
709impl SYSCFG {
710 pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
712 #[inline(always)]
714 pub const fn ptr() -> *const syscfg::RegisterBlock {
715 Self::PTR
716 }
717}
718impl Deref for SYSCFG {
719 type Target = syscfg::RegisterBlock;
720 #[inline(always)]
721 fn deref(&self) -> &Self::Target {
722 unsafe { &*Self::PTR }
723 }
724}
725impl core::fmt::Debug for SYSCFG {
726 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
727 f.debug_struct("SYSCFG").finish()
728 }
729}
730pub mod syscfg;
732pub struct DMA {
734 _marker: PhantomData<*const ()>,
735}
736unsafe impl Send for DMA {}
737impl DMA {
738 pub const PTR: *const dma::RegisterBlock = 0x4002_0000 as *const _;
740 #[inline(always)]
742 pub const fn ptr() -> *const dma::RegisterBlock {
743 Self::PTR
744 }
745}
746impl Deref for DMA {
747 type Target = dma::RegisterBlock;
748 #[inline(always)]
749 fn deref(&self) -> &Self::Target {
750 unsafe { &*Self::PTR }
751 }
752}
753impl core::fmt::Debug for DMA {
754 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
755 f.debug_struct("DMA").finish()
756 }
757}
758pub mod dma;
760pub struct FLASH {
762 _marker: PhantomData<*const ()>,
763}
764unsafe impl Send for FLASH {}
765impl FLASH {
766 pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
768 #[inline(always)]
770 pub const fn ptr() -> *const flash::RegisterBlock {
771 Self::PTR
772 }
773}
774impl Deref for FLASH {
775 type Target = flash::RegisterBlock;
776 #[inline(always)]
777 fn deref(&self) -> &Self::Target {
778 unsafe { &*Self::PTR }
779 }
780}
781impl core::fmt::Debug for FLASH {
782 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
783 f.debug_struct("FLASH").finish()
784 }
785}
786pub mod flash;
788pub struct CRC {
790 _marker: PhantomData<*const ()>,
791}
792unsafe impl Send for CRC {}
793impl CRC {
794 pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
796 #[inline(always)]
798 pub const fn ptr() -> *const crc::RegisterBlock {
799 Self::PTR
800 }
801}
802impl Deref for CRC {
803 type Target = crc::RegisterBlock;
804 #[inline(always)]
805 fn deref(&self) -> &Self::Target {
806 unsafe { &*Self::PTR }
807 }
808}
809impl core::fmt::Debug for CRC {
810 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
811 f.debug_struct("CRC").finish()
812 }
813}
814pub mod crc;
816pub struct SPI1 {
818 _marker: PhantomData<*const ()>,
819}
820unsafe impl Send for SPI1 {}
821impl SPI1 {
822 pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
824 #[inline(always)]
826 pub const fn ptr() -> *const spi1::RegisterBlock {
827 Self::PTR
828 }
829}
830impl Deref for SPI1 {
831 type Target = spi1::RegisterBlock;
832 #[inline(always)]
833 fn deref(&self) -> &Self::Target {
834 unsafe { &*Self::PTR }
835 }
836}
837impl core::fmt::Debug for SPI1 {
838 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
839 f.debug_struct("SPI1").finish()
840 }
841}
842pub mod spi1;
844pub struct I2C {
846 _marker: PhantomData<*const ()>,
847}
848unsafe impl Send for I2C {}
849impl I2C {
850 pub const PTR: *const i2c::RegisterBlock = 0x4000_5400 as *const _;
852 #[inline(always)]
854 pub const fn ptr() -> *const i2c::RegisterBlock {
855 Self::PTR
856 }
857}
858impl Deref for I2C {
859 type Target = i2c::RegisterBlock;
860 #[inline(always)]
861 fn deref(&self) -> &Self::Target {
862 unsafe { &*Self::PTR }
863 }
864}
865impl core::fmt::Debug for I2C {
866 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
867 f.debug_struct("I2C").finish()
868 }
869}
870pub mod i2c;
872pub struct DBG {
874 _marker: PhantomData<*const ()>,
875}
876unsafe impl Send for DBG {}
877impl DBG {
878 pub const PTR: *const dbg::RegisterBlock = 0x4001_5800 as *const _;
880 #[inline(always)]
882 pub const fn ptr() -> *const dbg::RegisterBlock {
883 Self::PTR
884 }
885}
886impl Deref for DBG {
887 type Target = dbg::RegisterBlock;
888 #[inline(always)]
889 fn deref(&self) -> &Self::Target {
890 unsafe { &*Self::PTR }
891 }
892}
893impl core::fmt::Debug for DBG {
894 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
895 f.debug_struct("DBG").finish()
896 }
897}
898pub mod dbg;
900#[no_mangle]
901static mut DEVICE_PERIPHERALS: bool = false;
902#[allow(non_snake_case)]
904pub struct Peripherals {
905 pub ADC: ADC,
907 pub COMP1: COMP1,
909 pub COMP2: COMP2,
911 pub RCC: RCC,
913 pub PWR: PWR,
915 pub GPIOA: GPIOA,
917 pub GPIOB: GPIOB,
919 pub GPIOF: GPIOF,
921 pub EXTI: EXTI,
923 pub LPTIM: LPTIM,
925 pub USART1: USART1,
927 pub USART2: USART2,
929 pub RTC: RTC,
931 pub IWDG: IWDG,
933 pub WWDG: WWDG,
935 pub TIM1: TIM1,
937 pub TIM3: TIM3,
939 pub TIM14: TIM14,
941 pub TIM16: TIM16,
943 pub TIM17: TIM17,
945 pub SYSCFG: SYSCFG,
947 pub DMA: DMA,
949 pub FLASH: FLASH,
951 pub CRC: CRC,
953 pub SPI1: SPI1,
955 pub I2C: I2C,
957 pub DBG: DBG,
959}
960impl Peripherals {
961 #[cfg(feature = "critical-section")]
963 #[inline]
964 pub fn take() -> Option<Self> {
965 critical_section::with(|_| {
966 if unsafe { DEVICE_PERIPHERALS } {
967 return None;
968 }
969 Some(unsafe { Peripherals::steal() })
970 })
971 }
972 #[inline]
978 pub unsafe fn steal() -> Self {
979 DEVICE_PERIPHERALS = true;
980 Peripherals {
981 ADC: ADC {
982 _marker: PhantomData,
983 },
984 COMP1: COMP1 {
985 _marker: PhantomData,
986 },
987 COMP2: COMP2 {
988 _marker: PhantomData,
989 },
990 RCC: RCC {
991 _marker: PhantomData,
992 },
993 PWR: PWR {
994 _marker: PhantomData,
995 },
996 GPIOA: GPIOA {
997 _marker: PhantomData,
998 },
999 GPIOB: GPIOB {
1000 _marker: PhantomData,
1001 },
1002 GPIOF: GPIOF {
1003 _marker: PhantomData,
1004 },
1005 EXTI: EXTI {
1006 _marker: PhantomData,
1007 },
1008 LPTIM: LPTIM {
1009 _marker: PhantomData,
1010 },
1011 USART1: USART1 {
1012 _marker: PhantomData,
1013 },
1014 USART2: USART2 {
1015 _marker: PhantomData,
1016 },
1017 RTC: RTC {
1018 _marker: PhantomData,
1019 },
1020 IWDG: IWDG {
1021 _marker: PhantomData,
1022 },
1023 WWDG: WWDG {
1024 _marker: PhantomData,
1025 },
1026 TIM1: TIM1 {
1027 _marker: PhantomData,
1028 },
1029 TIM3: TIM3 {
1030 _marker: PhantomData,
1031 },
1032 TIM14: TIM14 {
1033 _marker: PhantomData,
1034 },
1035 TIM16: TIM16 {
1036 _marker: PhantomData,
1037 },
1038 TIM17: TIM17 {
1039 _marker: PhantomData,
1040 },
1041 SYSCFG: SYSCFG {
1042 _marker: PhantomData,
1043 },
1044 DMA: DMA {
1045 _marker: PhantomData,
1046 },
1047 FLASH: FLASH {
1048 _marker: PhantomData,
1049 },
1050 CRC: CRC {
1051 _marker: PhantomData,
1052 },
1053 SPI1: SPI1 {
1054 _marker: PhantomData,
1055 },
1056 I2C: I2C {
1057 _marker: PhantomData,
1058 },
1059 DBG: DBG {
1060 _marker: PhantomData,
1061 },
1062 }
1063 }
1064}