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