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 WWDG();
38 fn PVD();
39 fn RTC();
40 fn FLASH();
41 fn RCC();
42 fn EXTI0_1();
43 fn EXTI2_3();
44 fn EXTI4_15();
45 fn DMA_CHANNEL1();
46 fn DMA_CHANNEL2_3();
47 fn ADC_COMP();
48 fn TIM1_BRK_UP_TRG_COM();
49 fn TIM1_CC();
50 fn TIM3();
51 fn TIM14();
52 fn TIM16();
53 fn TIM17();
54 fn I2C1();
55 fn SPI1();
56 fn USART1();
57 fn USART2();
58}
59#[doc(hidden)]
60pub union Vector {
61 _handler: unsafe extern "C" fn(),
62 _reserved: u32,
63}
64#[cfg(feature = "rt")]
65#[doc(hidden)]
66#[link_section = ".vector_table.interrupts"]
67#[no_mangle]
68pub static __INTERRUPTS: [Vector; 29] = [
69 Vector { _handler: WWDG },
70 Vector { _handler: PVD },
71 Vector { _handler: RTC },
72 Vector { _handler: FLASH },
73 Vector { _handler: RCC },
74 Vector { _handler: EXTI0_1 },
75 Vector { _handler: EXTI2_3 },
76 Vector { _handler: EXTI4_15 },
77 Vector { _reserved: 0 },
78 Vector {
79 _handler: DMA_CHANNEL1,
80 },
81 Vector {
82 _handler: DMA_CHANNEL2_3,
83 },
84 Vector { _reserved: 0 },
85 Vector { _handler: ADC_COMP },
86 Vector {
87 _handler: TIM1_BRK_UP_TRG_COM,
88 },
89 Vector { _handler: TIM1_CC },
90 Vector { _reserved: 0 },
91 Vector { _handler: TIM3 },
92 Vector { _reserved: 0 },
93 Vector { _reserved: 0 },
94 Vector { _handler: TIM14 },
95 Vector { _reserved: 0 },
96 Vector { _handler: TIM16 },
97 Vector { _handler: TIM17 },
98 Vector { _handler: I2C1 },
99 Vector { _reserved: 0 },
100 Vector { _handler: SPI1 },
101 Vector { _reserved: 0 },
102 Vector { _handler: USART1 },
103 Vector { _handler: USART2 },
104];
105#[doc = r"Enumeration of all the interrupts."]
106#[derive(Copy, Clone, Debug, PartialEq, Eq)]
107#[repr(u16)]
108pub enum Interrupt {
109 #[doc = "0 - Window WatchDog Interrupt"]
110 WWDG = 0,
111 #[doc = "1 - PVD Interrupt through EXTI Lines 16"]
112 PVD = 1,
113 #[doc = "2 - RTC Interrupt through EXTI Lines 19"]
114 RTC = 2,
115 #[doc = "3 - FLASH global Interrupt"]
116 FLASH = 3,
117 #[doc = "4 - RCC global Interrupt"]
118 RCC = 4,
119 #[doc = "5 - EXTI Line 0 and 1 Interrupt"]
120 EXTI0_1 = 5,
121 #[doc = "6 - EXTI Line 2 and 3 Interrupt"]
122 EXTI2_3 = 6,
123 #[doc = "7 - EXTI Line 4 to 15 Interrupt"]
124 EXTI4_15 = 7,
125 #[doc = "9 - DMA Channel 1 Interrupt"]
126 DMA_CHANNEL1 = 9,
127 #[doc = "10 - DMA Channel 2 and Channel 3 Interrupt"]
128 DMA_CHANNEL2_3 = 10,
129 #[doc = "12 - ADC and COMP Interrupt through EXTI Lines 17 and 18"]
130 ADC_COMP = 12,
131 #[doc = "13 - TIM1 Break, Update, Trigger and Commutation Interrupt"]
132 TIM1_BRK_UP_TRG_COM = 13,
133 #[doc = "14 - TIM1 Capture Compare Interrupt"]
134 TIM1_CC = 14,
135 #[doc = "16 - TIM3 global Interrupt"]
136 TIM3 = 16,
137 #[doc = "19 - TIM14 global Interrupt"]
138 TIM14 = 19,
139 #[doc = "21 - TIM16 global Interrupt"]
140 TIM16 = 21,
141 #[doc = "22 - TIM17 global Interrupt"]
142 TIM17 = 22,
143 #[doc = "23 - I2C1 global Interrupt"]
144 I2C1 = 23,
145 #[doc = "25 - SPI1 global Interrupt"]
146 SPI1 = 25,
147 #[doc = "27 - USART1 global Interrupt"]
148 USART1 = 27,
149 #[doc = "28 - USART2 global Interrupt"]
150 USART2 = 28,
151}
152unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
153 #[inline(always)]
154 fn number(self) -> u16 {
155 self as u16
156 }
157}
158#[doc = "Analog to Digital Converter"]
159pub struct ADC {
160 _marker: PhantomData<*const ()>,
161}
162unsafe impl Send for ADC {}
163impl ADC {
164 #[doc = r"Pointer to the register block"]
165 pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
166 #[doc = r"Return the pointer to the register block"]
167 #[inline(always)]
168 pub const fn ptr() -> *const adc::RegisterBlock {
169 Self::PTR
170 }
171}
172impl Deref for ADC {
173 type Target = adc::RegisterBlock;
174 #[inline(always)]
175 fn deref(&self) -> &Self::Target {
176 unsafe { &*Self::PTR }
177 }
178}
179impl core::fmt::Debug for ADC {
180 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
181 f.debug_struct("ADC").finish()
182 }
183}
184#[doc = "Analog to Digital Converter"]
185pub mod adc;
186#[doc = "Comparator"]
187pub struct COMP1 {
188 _marker: PhantomData<*const ()>,
189}
190unsafe impl Send for COMP1 {}
191impl COMP1 {
192 #[doc = r"Pointer to the register block"]
193 pub const PTR: *const comp1::RegisterBlock = 0x4001_0200 as *const _;
194 #[doc = r"Return the pointer to the register block"]
195 #[inline(always)]
196 pub const fn ptr() -> *const comp1::RegisterBlock {
197 Self::PTR
198 }
199}
200impl Deref for COMP1 {
201 type Target = comp1::RegisterBlock;
202 #[inline(always)]
203 fn deref(&self) -> &Self::Target {
204 unsafe { &*Self::PTR }
205 }
206}
207impl core::fmt::Debug for COMP1 {
208 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
209 f.debug_struct("COMP1").finish()
210 }
211}
212#[doc = "Comparator"]
213pub mod comp1;
214#[doc = "Comparator"]
215pub struct COMP2 {
216 _marker: PhantomData<*const ()>,
217}
218unsafe impl Send for COMP2 {}
219impl COMP2 {
220 #[doc = r"Pointer to the register block"]
221 pub const PTR: *const comp2::RegisterBlock = 0x4001_0210 as *const _;
222 #[doc = r"Return the pointer to the register block"]
223 #[inline(always)]
224 pub const fn ptr() -> *const comp2::RegisterBlock {
225 Self::PTR
226 }
227}
228impl Deref for COMP2 {
229 type Target = comp2::RegisterBlock;
230 #[inline(always)]
231 fn deref(&self) -> &Self::Target {
232 unsafe { &*Self::PTR }
233 }
234}
235impl core::fmt::Debug for COMP2 {
236 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
237 f.debug_struct("COMP2").finish()
238 }
239}
240#[doc = "Comparator"]
241pub mod comp2;
242#[doc = "Reset and clock control"]
243pub struct RCC {
244 _marker: PhantomData<*const ()>,
245}
246unsafe impl Send for RCC {}
247impl RCC {
248 #[doc = r"Pointer to the register block"]
249 pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
250 #[doc = r"Return the pointer to the register block"]
251 #[inline(always)]
252 pub const fn ptr() -> *const rcc::RegisterBlock {
253 Self::PTR
254 }
255}
256impl Deref for RCC {
257 type Target = rcc::RegisterBlock;
258 #[inline(always)]
259 fn deref(&self) -> &Self::Target {
260 unsafe { &*Self::PTR }
261 }
262}
263impl core::fmt::Debug for RCC {
264 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
265 f.debug_struct("RCC").finish()
266 }
267}
268#[doc = "Reset and clock control"]
269pub mod rcc;
270#[doc = "Power control"]
271pub struct PWR {
272 _marker: PhantomData<*const ()>,
273}
274unsafe impl Send for PWR {}
275impl PWR {
276 #[doc = r"Pointer to the register block"]
277 pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
278 #[doc = r"Return the pointer to the register block"]
279 #[inline(always)]
280 pub const fn ptr() -> *const pwr::RegisterBlock {
281 Self::PTR
282 }
283}
284impl Deref for PWR {
285 type Target = pwr::RegisterBlock;
286 #[inline(always)]
287 fn deref(&self) -> &Self::Target {
288 unsafe { &*Self::PTR }
289 }
290}
291impl core::fmt::Debug for PWR {
292 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
293 f.debug_struct("PWR").finish()
294 }
295}
296#[doc = "Power control"]
297pub mod pwr;
298#[doc = "General-purpose I/Os"]
299pub struct GPIOA {
300 _marker: PhantomData<*const ()>,
301}
302unsafe impl Send for GPIOA {}
303impl GPIOA {
304 #[doc = r"Pointer to the register block"]
305 pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
306 #[doc = r"Return the pointer to the register block"]
307 #[inline(always)]
308 pub const fn ptr() -> *const gpioa::RegisterBlock {
309 Self::PTR
310 }
311}
312impl Deref for GPIOA {
313 type Target = gpioa::RegisterBlock;
314 #[inline(always)]
315 fn deref(&self) -> &Self::Target {
316 unsafe { &*Self::PTR }
317 }
318}
319impl core::fmt::Debug for GPIOA {
320 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
321 f.debug_struct("GPIOA").finish()
322 }
323}
324#[doc = "General-purpose I/Os"]
325pub mod gpioa;
326#[doc = "General-purpose I/Os"]
327pub struct GPIOB {
328 _marker: PhantomData<*const ()>,
329}
330unsafe impl Send for GPIOB {}
331impl GPIOB {
332 #[doc = r"Pointer to the register block"]
333 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
334 #[doc = r"Return the pointer to the register block"]
335 #[inline(always)]
336 pub const fn ptr() -> *const gpiob::RegisterBlock {
337 Self::PTR
338 }
339}
340impl Deref for GPIOB {
341 type Target = gpiob::RegisterBlock;
342 #[inline(always)]
343 fn deref(&self) -> &Self::Target {
344 unsafe { &*Self::PTR }
345 }
346}
347impl core::fmt::Debug for GPIOB {
348 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
349 f.debug_struct("GPIOB").finish()
350 }
351}
352#[doc = "General-purpose I/Os"]
353pub mod gpiob;
354#[doc = "General-purpose I/Os"]
355pub struct GPIOF {
356 _marker: PhantomData<*const ()>,
357}
358unsafe impl Send for GPIOF {}
359impl GPIOF {
360 #[doc = r"Pointer to the register block"]
361 pub const PTR: *const gpiob::RegisterBlock = 0x5000_1400 as *const _;
362 #[doc = r"Return the pointer to the register block"]
363 #[inline(always)]
364 pub const fn ptr() -> *const gpiob::RegisterBlock {
365 Self::PTR
366 }
367}
368impl Deref for GPIOF {
369 type Target = gpiob::RegisterBlock;
370 #[inline(always)]
371 fn deref(&self) -> &Self::Target {
372 unsafe { &*Self::PTR }
373 }
374}
375impl core::fmt::Debug for GPIOF {
376 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
377 f.debug_struct("GPIOF").finish()
378 }
379}
380#[doc = "General-purpose I/Os"]
381pub use gpiob as gpiof;
382#[doc = "External interrupt/event controller"]
383pub struct EXTI {
384 _marker: PhantomData<*const ()>,
385}
386unsafe impl Send for EXTI {}
387impl EXTI {
388 #[doc = r"Pointer to the register block"]
389 pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
390 #[doc = r"Return the pointer to the register block"]
391 #[inline(always)]
392 pub const fn ptr() -> *const exti::RegisterBlock {
393 Self::PTR
394 }
395}
396impl Deref for EXTI {
397 type Target = exti::RegisterBlock;
398 #[inline(always)]
399 fn deref(&self) -> &Self::Target {
400 unsafe { &*Self::PTR }
401 }
402}
403impl core::fmt::Debug for EXTI {
404 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
405 f.debug_struct("EXTI").finish()
406 }
407}
408#[doc = "External interrupt/event controller"]
409pub mod exti;
410#[doc = "Low power timer"]
411pub struct LPTIM {
412 _marker: PhantomData<*const ()>,
413}
414unsafe impl Send for LPTIM {}
415impl LPTIM {
416 #[doc = r"Pointer to the register block"]
417 pub const PTR: *const lptim::RegisterBlock = 0x4000_7c00 as *const _;
418 #[doc = r"Return the pointer to the register block"]
419 #[inline(always)]
420 pub const fn ptr() -> *const lptim::RegisterBlock {
421 Self::PTR
422 }
423}
424impl Deref for LPTIM {
425 type Target = lptim::RegisterBlock;
426 #[inline(always)]
427 fn deref(&self) -> &Self::Target {
428 unsafe { &*Self::PTR }
429 }
430}
431impl core::fmt::Debug for LPTIM {
432 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
433 f.debug_struct("LPTIM").finish()
434 }
435}
436#[doc = "Low power timer"]
437pub mod lptim;
438#[doc = "Universal synchronous asynchronous receiver transmitter"]
439pub struct USART1 {
440 _marker: PhantomData<*const ()>,
441}
442unsafe impl Send for USART1 {}
443impl USART1 {
444 #[doc = r"Pointer to the register block"]
445 pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
446 #[doc = r"Return the pointer to the register block"]
447 #[inline(always)]
448 pub const fn ptr() -> *const usart1::RegisterBlock {
449 Self::PTR
450 }
451}
452impl Deref for USART1 {
453 type Target = usart1::RegisterBlock;
454 #[inline(always)]
455 fn deref(&self) -> &Self::Target {
456 unsafe { &*Self::PTR }
457 }
458}
459impl core::fmt::Debug for USART1 {
460 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
461 f.debug_struct("USART1").finish()
462 }
463}
464#[doc = "Universal synchronous asynchronous receiver transmitter"]
465pub mod usart1;
466#[doc = "Universal synchronous asynchronous receiver transmitter"]
467pub struct USART2 {
468 _marker: PhantomData<*const ()>,
469}
470unsafe impl Send for USART2 {}
471impl USART2 {
472 #[doc = r"Pointer to the register block"]
473 pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
474 #[doc = r"Return the pointer to the register block"]
475 #[inline(always)]
476 pub const fn ptr() -> *const usart1::RegisterBlock {
477 Self::PTR
478 }
479}
480impl Deref for USART2 {
481 type Target = usart1::RegisterBlock;
482 #[inline(always)]
483 fn deref(&self) -> &Self::Target {
484 unsafe { &*Self::PTR }
485 }
486}
487impl core::fmt::Debug for USART2 {
488 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
489 f.debug_struct("USART2").finish()
490 }
491}
492#[doc = "Universal synchronous asynchronous receiver transmitter"]
493pub use usart1 as usart2;
494#[doc = "Real time clock"]
495pub struct RTC {
496 _marker: PhantomData<*const ()>,
497}
498unsafe impl Send for RTC {}
499impl RTC {
500 #[doc = r"Pointer to the register block"]
501 pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
502 #[doc = r"Return the pointer to the register block"]
503 #[inline(always)]
504 pub const fn ptr() -> *const rtc::RegisterBlock {
505 Self::PTR
506 }
507}
508impl Deref for RTC {
509 type Target = rtc::RegisterBlock;
510 #[inline(always)]
511 fn deref(&self) -> &Self::Target {
512 unsafe { &*Self::PTR }
513 }
514}
515impl core::fmt::Debug for RTC {
516 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
517 f.debug_struct("RTC").finish()
518 }
519}
520#[doc = "Real time clock"]
521pub mod rtc;
522#[doc = "Independent watchdog"]
523pub struct IWDG {
524 _marker: PhantomData<*const ()>,
525}
526unsafe impl Send for IWDG {}
527impl IWDG {
528 #[doc = r"Pointer to the register block"]
529 pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
530 #[doc = r"Return the pointer to the register block"]
531 #[inline(always)]
532 pub const fn ptr() -> *const iwdg::RegisterBlock {
533 Self::PTR
534 }
535}
536impl Deref for IWDG {
537 type Target = iwdg::RegisterBlock;
538 #[inline(always)]
539 fn deref(&self) -> &Self::Target {
540 unsafe { &*Self::PTR }
541 }
542}
543impl core::fmt::Debug for IWDG {
544 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
545 f.debug_struct("IWDG").finish()
546 }
547}
548#[doc = "Independent watchdog"]
549pub mod iwdg;
550#[doc = "Window watchdog"]
551pub struct WWDG {
552 _marker: PhantomData<*const ()>,
553}
554unsafe impl Send for WWDG {}
555impl WWDG {
556 #[doc = r"Pointer to the register block"]
557 pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
558 #[doc = r"Return the pointer to the register block"]
559 #[inline(always)]
560 pub const fn ptr() -> *const wwdg::RegisterBlock {
561 Self::PTR
562 }
563}
564impl Deref for WWDG {
565 type Target = wwdg::RegisterBlock;
566 #[inline(always)]
567 fn deref(&self) -> &Self::Target {
568 unsafe { &*Self::PTR }
569 }
570}
571impl core::fmt::Debug for WWDG {
572 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
573 f.debug_struct("WWDG").finish()
574 }
575}
576#[doc = "Window watchdog"]
577pub mod wwdg;
578#[doc = "Advanced timer"]
579pub struct TIM1 {
580 _marker: PhantomData<*const ()>,
581}
582unsafe impl Send for TIM1 {}
583impl TIM1 {
584 #[doc = r"Pointer to the register block"]
585 pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
586 #[doc = r"Return the pointer to the register block"]
587 #[inline(always)]
588 pub const fn ptr() -> *const tim1::RegisterBlock {
589 Self::PTR
590 }
591}
592impl Deref for TIM1 {
593 type Target = tim1::RegisterBlock;
594 #[inline(always)]
595 fn deref(&self) -> &Self::Target {
596 unsafe { &*Self::PTR }
597 }
598}
599impl core::fmt::Debug for TIM1 {
600 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
601 f.debug_struct("TIM1").finish()
602 }
603}
604#[doc = "Advanced timer"]
605pub mod tim1;
606#[doc = "General purpose timer"]
607pub struct TIM3 {
608 _marker: PhantomData<*const ()>,
609}
610unsafe impl Send for TIM3 {}
611impl TIM3 {
612 #[doc = r"Pointer to the register block"]
613 pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
614 #[doc = r"Return the pointer to the register block"]
615 #[inline(always)]
616 pub const fn ptr() -> *const tim3::RegisterBlock {
617 Self::PTR
618 }
619}
620impl Deref for TIM3 {
621 type Target = tim3::RegisterBlock;
622 #[inline(always)]
623 fn deref(&self) -> &Self::Target {
624 unsafe { &*Self::PTR }
625 }
626}
627impl core::fmt::Debug for TIM3 {
628 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
629 f.debug_struct("TIM3").finish()
630 }
631}
632#[doc = "General purpose timer"]
633pub mod tim3;
634#[doc = "General purpose timer"]
635pub struct TIM14 {
636 _marker: PhantomData<*const ()>,
637}
638unsafe impl Send for TIM14 {}
639impl TIM14 {
640 #[doc = r"Pointer to the register block"]
641 pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
642 #[doc = r"Return the pointer to the register block"]
643 #[inline(always)]
644 pub const fn ptr() -> *const tim14::RegisterBlock {
645 Self::PTR
646 }
647}
648impl Deref for TIM14 {
649 type Target = tim14::RegisterBlock;
650 #[inline(always)]
651 fn deref(&self) -> &Self::Target {
652 unsafe { &*Self::PTR }
653 }
654}
655impl core::fmt::Debug for TIM14 {
656 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
657 f.debug_struct("TIM14").finish()
658 }
659}
660#[doc = "General purpose timer"]
661pub mod tim14;
662#[doc = "General purpose timer"]
663pub struct TIM16 {
664 _marker: PhantomData<*const ()>,
665}
666unsafe impl Send for TIM16 {}
667impl TIM16 {
668 #[doc = r"Pointer to the register block"]
669 pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
670 #[doc = r"Return the pointer to the register block"]
671 #[inline(always)]
672 pub const fn ptr() -> *const tim16::RegisterBlock {
673 Self::PTR
674 }
675}
676impl Deref for TIM16 {
677 type Target = tim16::RegisterBlock;
678 #[inline(always)]
679 fn deref(&self) -> &Self::Target {
680 unsafe { &*Self::PTR }
681 }
682}
683impl core::fmt::Debug for TIM16 {
684 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
685 f.debug_struct("TIM16").finish()
686 }
687}
688#[doc = "General purpose timer"]
689pub mod tim16;
690#[doc = "General purpose timer"]
691pub struct TIM17 {
692 _marker: PhantomData<*const ()>,
693}
694unsafe impl Send for TIM17 {}
695impl TIM17 {
696 #[doc = r"Pointer to the register block"]
697 pub const PTR: *const tim16::RegisterBlock = 0x4001_4800 as *const _;
698 #[doc = r"Return the pointer to the register block"]
699 #[inline(always)]
700 pub const fn ptr() -> *const tim16::RegisterBlock {
701 Self::PTR
702 }
703}
704impl Deref for TIM17 {
705 type Target = tim16::RegisterBlock;
706 #[inline(always)]
707 fn deref(&self) -> &Self::Target {
708 unsafe { &*Self::PTR }
709 }
710}
711impl core::fmt::Debug for TIM17 {
712 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
713 f.debug_struct("TIM17").finish()
714 }
715}
716#[doc = "General purpose timer"]
717pub use tim16 as tim17;
718#[doc = "System configuration controller"]
719pub struct SYSCFG {
720 _marker: PhantomData<*const ()>,
721}
722unsafe impl Send for SYSCFG {}
723impl SYSCFG {
724 #[doc = r"Pointer to the register block"]
725 pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
726 #[doc = r"Return the pointer to the register block"]
727 #[inline(always)]
728 pub const fn ptr() -> *const syscfg::RegisterBlock {
729 Self::PTR
730 }
731}
732impl Deref for SYSCFG {
733 type Target = syscfg::RegisterBlock;
734 #[inline(always)]
735 fn deref(&self) -> &Self::Target {
736 unsafe { &*Self::PTR }
737 }
738}
739impl core::fmt::Debug for SYSCFG {
740 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
741 f.debug_struct("SYSCFG").finish()
742 }
743}
744#[doc = "System configuration controller"]
745pub mod syscfg;
746#[doc = "Direct memory access"]
747pub struct DMA {
748 _marker: PhantomData<*const ()>,
749}
750unsafe impl Send for DMA {}
751impl DMA {
752 #[doc = r"Pointer to the register block"]
753 pub const PTR: *const dma::RegisterBlock = 0x4002_0000 as *const _;
754 #[doc = r"Return the pointer to the register block"]
755 #[inline(always)]
756 pub const fn ptr() -> *const dma::RegisterBlock {
757 Self::PTR
758 }
759}
760impl Deref for DMA {
761 type Target = dma::RegisterBlock;
762 #[inline(always)]
763 fn deref(&self) -> &Self::Target {
764 unsafe { &*Self::PTR }
765 }
766}
767impl core::fmt::Debug for DMA {
768 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
769 f.debug_struct("DMA").finish()
770 }
771}
772#[doc = "Direct memory access"]
773pub mod dma;
774#[doc = "Flash"]
775pub struct FLASH {
776 _marker: PhantomData<*const ()>,
777}
778unsafe impl Send for FLASH {}
779impl FLASH {
780 #[doc = r"Pointer to the register block"]
781 pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
782 #[doc = r"Return the pointer to the register block"]
783 #[inline(always)]
784 pub const fn ptr() -> *const flash::RegisterBlock {
785 Self::PTR
786 }
787}
788impl Deref for FLASH {
789 type Target = flash::RegisterBlock;
790 #[inline(always)]
791 fn deref(&self) -> &Self::Target {
792 unsafe { &*Self::PTR }
793 }
794}
795impl core::fmt::Debug for FLASH {
796 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
797 f.debug_struct("FLASH").finish()
798 }
799}
800#[doc = "Flash"]
801pub mod flash;
802#[doc = "CRC calculation unit"]
803pub struct CRC {
804 _marker: PhantomData<*const ()>,
805}
806unsafe impl Send for CRC {}
807impl CRC {
808 #[doc = r"Pointer to the register block"]
809 pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
810 #[doc = r"Return the pointer to the register block"]
811 #[inline(always)]
812 pub const fn ptr() -> *const crc::RegisterBlock {
813 Self::PTR
814 }
815}
816impl Deref for CRC {
817 type Target = crc::RegisterBlock;
818 #[inline(always)]
819 fn deref(&self) -> &Self::Target {
820 unsafe { &*Self::PTR }
821 }
822}
823impl core::fmt::Debug for CRC {
824 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
825 f.debug_struct("CRC").finish()
826 }
827}
828#[doc = "CRC calculation unit"]
829pub mod crc;
830#[doc = "Serial peripheral interface"]
831pub struct SPI1 {
832 _marker: PhantomData<*const ()>,
833}
834unsafe impl Send for SPI1 {}
835impl SPI1 {
836 #[doc = r"Pointer to the register block"]
837 pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
838 #[doc = r"Return the pointer to the register block"]
839 #[inline(always)]
840 pub const fn ptr() -> *const spi1::RegisterBlock {
841 Self::PTR
842 }
843}
844impl Deref for SPI1 {
845 type Target = spi1::RegisterBlock;
846 #[inline(always)]
847 fn deref(&self) -> &Self::Target {
848 unsafe { &*Self::PTR }
849 }
850}
851impl core::fmt::Debug for SPI1 {
852 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
853 f.debug_struct("SPI1").finish()
854 }
855}
856#[doc = "Serial peripheral interface"]
857pub mod spi1;
858#[doc = "Inter integrated circuit"]
859pub struct I2C {
860 _marker: PhantomData<*const ()>,
861}
862unsafe impl Send for I2C {}
863impl I2C {
864 #[doc = r"Pointer to the register block"]
865 pub const PTR: *const i2c::RegisterBlock = 0x4000_5400 as *const _;
866 #[doc = r"Return the pointer to the register block"]
867 #[inline(always)]
868 pub const fn ptr() -> *const i2c::RegisterBlock {
869 Self::PTR
870 }
871}
872impl Deref for I2C {
873 type Target = i2c::RegisterBlock;
874 #[inline(always)]
875 fn deref(&self) -> &Self::Target {
876 unsafe { &*Self::PTR }
877 }
878}
879impl core::fmt::Debug for I2C {
880 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
881 f.debug_struct("I2C").finish()
882 }
883}
884#[doc = "Inter integrated circuit"]
885pub mod i2c;
886#[doc = "Debug support"]
887pub struct DBGMCU {
888 _marker: PhantomData<*const ()>,
889}
890unsafe impl Send for DBGMCU {}
891impl DBGMCU {
892 #[doc = r"Pointer to the register block"]
893 pub const PTR: *const dbgmcu::RegisterBlock = 0x4001_5800 as *const _;
894 #[doc = r"Return the pointer to the register block"]
895 #[inline(always)]
896 pub const fn ptr() -> *const dbgmcu::RegisterBlock {
897 Self::PTR
898 }
899}
900impl Deref for DBGMCU {
901 type Target = dbgmcu::RegisterBlock;
902 #[inline(always)]
903 fn deref(&self) -> &Self::Target {
904 unsafe { &*Self::PTR }
905 }
906}
907impl core::fmt::Debug for DBGMCU {
908 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
909 f.debug_struct("DBGMCU").finish()
910 }
911}
912#[doc = "Debug support"]
913pub mod dbgmcu;
914#[no_mangle]
915static mut DEVICE_PERIPHERALS: bool = false;
916#[doc = r"All the peripherals"]
917#[allow(non_snake_case)]
918pub struct Peripherals {
919 #[doc = "ADC"]
920 pub ADC: ADC,
921 #[doc = "COMP1"]
922 pub COMP1: COMP1,
923 #[doc = "COMP2"]
924 pub COMP2: COMP2,
925 #[doc = "RCC"]
926 pub RCC: RCC,
927 #[doc = "PWR"]
928 pub PWR: PWR,
929 #[doc = "GPIOA"]
930 pub GPIOA: GPIOA,
931 #[doc = "GPIOB"]
932 pub GPIOB: GPIOB,
933 #[doc = "GPIOF"]
934 pub GPIOF: GPIOF,
935 #[doc = "EXTI"]
936 pub EXTI: EXTI,
937 #[doc = "LPTIM"]
938 pub LPTIM: LPTIM,
939 #[doc = "USART1"]
940 pub USART1: USART1,
941 #[doc = "USART2"]
942 pub USART2: USART2,
943 #[doc = "RTC"]
944 pub RTC: RTC,
945 #[doc = "IWDG"]
946 pub IWDG: IWDG,
947 #[doc = "WWDG"]
948 pub WWDG: WWDG,
949 #[doc = "TIM1"]
950 pub TIM1: TIM1,
951 #[doc = "TIM3"]
952 pub TIM3: TIM3,
953 #[doc = "TIM14"]
954 pub TIM14: TIM14,
955 #[doc = "TIM16"]
956 pub TIM16: TIM16,
957 #[doc = "TIM17"]
958 pub TIM17: TIM17,
959 #[doc = "SYSCFG"]
960 pub SYSCFG: SYSCFG,
961 #[doc = "DMA"]
962 pub DMA: DMA,
963 #[doc = "FLASH"]
964 pub FLASH: FLASH,
965 #[doc = "CRC"]
966 pub CRC: CRC,
967 #[doc = "SPI1"]
968 pub SPI1: SPI1,
969 #[doc = "I2C"]
970 pub I2C: I2C,
971 #[doc = "DBGMCU"]
972 pub DBGMCU: DBGMCU,
973}
974impl Peripherals {
975 #[doc = r"Returns all the peripherals *once*"]
976 #[inline]
977 pub fn take() -> Option<Self> {
978 cortex_m::interrupt::free(|_| {
979 if unsafe { DEVICE_PERIPHERALS } {
980 None
981 } else {
982 Some(unsafe { Peripherals::steal() })
983 }
984 })
985 }
986 #[doc = r"Unchecked version of `Peripherals::take`"]
987 #[inline]
988 pub unsafe fn steal() -> Self {
989 DEVICE_PERIPHERALS = true;
990 Peripherals {
991 ADC: ADC {
992 _marker: PhantomData,
993 },
994 COMP1: COMP1 {
995 _marker: PhantomData,
996 },
997 COMP2: COMP2 {
998 _marker: PhantomData,
999 },
1000 RCC: RCC {
1001 _marker: PhantomData,
1002 },
1003 PWR: PWR {
1004 _marker: PhantomData,
1005 },
1006 GPIOA: GPIOA {
1007 _marker: PhantomData,
1008 },
1009 GPIOB: GPIOB {
1010 _marker: PhantomData,
1011 },
1012 GPIOF: GPIOF {
1013 _marker: PhantomData,
1014 },
1015 EXTI: EXTI {
1016 _marker: PhantomData,
1017 },
1018 LPTIM: LPTIM {
1019 _marker: PhantomData,
1020 },
1021 USART1: USART1 {
1022 _marker: PhantomData,
1023 },
1024 USART2: USART2 {
1025 _marker: PhantomData,
1026 },
1027 RTC: RTC {
1028 _marker: PhantomData,
1029 },
1030 IWDG: IWDG {
1031 _marker: PhantomData,
1032 },
1033 WWDG: WWDG {
1034 _marker: PhantomData,
1035 },
1036 TIM1: TIM1 {
1037 _marker: PhantomData,
1038 },
1039 TIM3: TIM3 {
1040 _marker: PhantomData,
1041 },
1042 TIM14: TIM14 {
1043 _marker: PhantomData,
1044 },
1045 TIM16: TIM16 {
1046 _marker: PhantomData,
1047 },
1048 TIM17: TIM17 {
1049 _marker: PhantomData,
1050 },
1051 SYSCFG: SYSCFG {
1052 _marker: PhantomData,
1053 },
1054 DMA: DMA {
1055 _marker: PhantomData,
1056 },
1057 FLASH: FLASH {
1058 _marker: PhantomData,
1059 },
1060 CRC: CRC {
1061 _marker: PhantomData,
1062 },
1063 SPI1: SPI1 {
1064 _marker: PhantomData,
1065 },
1066 I2C: I2C {
1067 _marker: PhantomData,
1068 },
1069 DBGMCU: DBGMCU {
1070 _marker: PhantomData,
1071 },
1072 }
1073 }
1074}