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 FLASH();
38 fn RCC();
39 fn EXTI0_1();
40 fn EXTI2_3();
41 fn EXTI4_15();
42 fn ADC();
43 fn TIM1_BRK_UP_TRG_COM();
44 fn TIM1_CC();
45 fn LPTIM1_DAC();
46 fn TIM14();
47 fn I2C1();
48 fn SPI1();
49 fn USART1();
50}
51#[doc(hidden)]
52pub union Vector {
53 _handler: unsafe extern "C" fn(),
54 _reserved: u32,
55}
56#[cfg(feature = "rt")]
57#[doc(hidden)]
58#[link_section = ".vector_table.interrupts"]
59#[no_mangle]
60pub static __INTERRUPTS: [Vector; 28] = [
61 Vector { _reserved: 0 },
62 Vector { _reserved: 0 },
63 Vector { _reserved: 0 },
64 Vector { _handler: FLASH },
65 Vector { _handler: RCC },
66 Vector { _handler: EXTI0_1 },
67 Vector { _handler: EXTI2_3 },
68 Vector { _handler: EXTI4_15 },
69 Vector { _reserved: 0 },
70 Vector { _reserved: 0 },
71 Vector { _reserved: 0 },
72 Vector { _reserved: 0 },
73 Vector { _handler: ADC },
74 Vector {
75 _handler: TIM1_BRK_UP_TRG_COM,
76 },
77 Vector { _handler: TIM1_CC },
78 Vector { _reserved: 0 },
79 Vector { _reserved: 0 },
80 Vector {
81 _handler: LPTIM1_DAC,
82 },
83 Vector { _reserved: 0 },
84 Vector { _handler: TIM14 },
85 Vector { _reserved: 0 },
86 Vector { _reserved: 0 },
87 Vector { _reserved: 0 },
88 Vector { _handler: I2C1 },
89 Vector { _reserved: 0 },
90 Vector { _handler: SPI1 },
91 Vector { _reserved: 0 },
92 Vector { _handler: USART1 },
93];
94#[doc = r"Enumeration of all the interrupts."]
95#[derive(Copy, Clone, Debug, PartialEq, Eq)]
96#[repr(u16)]
97pub enum Interrupt {
98 #[doc = "3 - FLASH global Interrupt"]
99 FLASH = 3,
100 #[doc = "4 - RCC global Interrupt"]
101 RCC = 4,
102 #[doc = "5 - EXTI Line 0 and 1 Interrupt"]
103 EXTI0_1 = 5,
104 #[doc = "6 - EXTI Line 2 and 3 Interrupt"]
105 EXTI2_3 = 6,
106 #[doc = "7 - EXTI Line 4 to 15 Interrupt"]
107 EXTI4_15 = 7,
108 #[doc = "12 - ADC Interrupt"]
109 ADC = 12,
110 #[doc = "13 - TIM1 Break, Update, Trigger and Commutation Interrupt"]
111 TIM1_BRK_UP_TRG_COM = 13,
112 #[doc = "14 - TIM1 Capture Compare Interrupt"]
113 TIM1_CC = 14,
114 #[doc = "17 - LPTIM1, DAC global Interrupts"]
115 LPTIM1_DAC = 17,
116 #[doc = "19 - TIM14 global Interrupt"]
117 TIM14 = 19,
118 #[doc = "23 - I2C1 global Interrupt"]
119 I2C1 = 23,
120 #[doc = "25 - SPI1 global Interrupt"]
121 SPI1 = 25,
122 #[doc = "27 - USART1 global Interrupt"]
123 USART1 = 27,
124}
125unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
126 #[inline(always)]
127 fn number(self) -> u16 {
128 self as u16
129 }
130}
131#[doc = "Analog to Digital Converter"]
132pub struct ADC {
133 _marker: PhantomData<*const ()>,
134}
135unsafe impl Send for ADC {}
136impl ADC {
137 #[doc = r"Pointer to the register block"]
138 pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
139 #[doc = r"Return the pointer to the register block"]
140 #[inline(always)]
141 pub const fn ptr() -> *const adc::RegisterBlock {
142 Self::PTR
143 }
144}
145impl Deref for ADC {
146 type Target = adc::RegisterBlock;
147 #[inline(always)]
148 fn deref(&self) -> &Self::Target {
149 unsafe { &*Self::PTR }
150 }
151}
152impl core::fmt::Debug for ADC {
153 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
154 f.debug_struct("ADC").finish()
155 }
156}
157#[doc = "Analog to Digital Converter"]
158pub mod adc;
159#[doc = "Reset and clock control"]
160pub struct RCC {
161 _marker: PhantomData<*const ()>,
162}
163unsafe impl Send for RCC {}
164impl RCC {
165 #[doc = r"Pointer to the register block"]
166 pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
167 #[doc = r"Return the pointer to the register block"]
168 #[inline(always)]
169 pub const fn ptr() -> *const rcc::RegisterBlock {
170 Self::PTR
171 }
172}
173impl Deref for RCC {
174 type Target = rcc::RegisterBlock;
175 #[inline(always)]
176 fn deref(&self) -> &Self::Target {
177 unsafe { &*Self::PTR }
178 }
179}
180impl core::fmt::Debug for RCC {
181 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
182 f.debug_struct("RCC").finish()
183 }
184}
185#[doc = "Reset and clock control"]
186pub mod rcc;
187#[doc = "Power control"]
188pub struct PWR {
189 _marker: PhantomData<*const ()>,
190}
191unsafe impl Send for PWR {}
192impl PWR {
193 #[doc = r"Pointer to the register block"]
194 pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
195 #[doc = r"Return the pointer to the register block"]
196 #[inline(always)]
197 pub const fn ptr() -> *const pwr::RegisterBlock {
198 Self::PTR
199 }
200}
201impl Deref for PWR {
202 type Target = pwr::RegisterBlock;
203 #[inline(always)]
204 fn deref(&self) -> &Self::Target {
205 unsafe { &*Self::PTR }
206 }
207}
208impl core::fmt::Debug for PWR {
209 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
210 f.debug_struct("PWR").finish()
211 }
212}
213#[doc = "Power control"]
214pub mod pwr;
215#[doc = "General-purpose I/Os"]
216pub struct GPIOA {
217 _marker: PhantomData<*const ()>,
218}
219unsafe impl Send for GPIOA {}
220impl GPIOA {
221 #[doc = r"Pointer to the register block"]
222 pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
223 #[doc = r"Return the pointer to the register block"]
224 #[inline(always)]
225 pub const fn ptr() -> *const gpioa::RegisterBlock {
226 Self::PTR
227 }
228}
229impl Deref for GPIOA {
230 type Target = gpioa::RegisterBlock;
231 #[inline(always)]
232 fn deref(&self) -> &Self::Target {
233 unsafe { &*Self::PTR }
234 }
235}
236impl core::fmt::Debug for GPIOA {
237 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
238 f.debug_struct("GPIOA").finish()
239 }
240}
241#[doc = "General-purpose I/Os"]
242pub mod gpioa;
243#[doc = "General-purpose I/Os"]
244pub struct GPIOB {
245 _marker: PhantomData<*const ()>,
246}
247unsafe impl Send for GPIOB {}
248impl GPIOB {
249 #[doc = r"Pointer to the register block"]
250 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
251 #[doc = r"Return the pointer to the register block"]
252 #[inline(always)]
253 pub const fn ptr() -> *const gpiob::RegisterBlock {
254 Self::PTR
255 }
256}
257impl Deref for GPIOB {
258 type Target = gpiob::RegisterBlock;
259 #[inline(always)]
260 fn deref(&self) -> &Self::Target {
261 unsafe { &*Self::PTR }
262 }
263}
264impl core::fmt::Debug for GPIOB {
265 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
266 f.debug_struct("GPIOB").finish()
267 }
268}
269#[doc = "General-purpose I/Os"]
270pub mod gpiob;
271#[doc = "General-purpose I/Os"]
272pub struct GPIOC {
273 _marker: PhantomData<*const ()>,
274}
275unsafe impl Send for GPIOC {}
276impl GPIOC {
277 #[doc = r"Pointer to the register block"]
278 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0800 as *const _;
279 #[doc = r"Return the pointer to the register block"]
280 #[inline(always)]
281 pub const fn ptr() -> *const gpiob::RegisterBlock {
282 Self::PTR
283 }
284}
285impl Deref for GPIOC {
286 type Target = gpiob::RegisterBlock;
287 #[inline(always)]
288 fn deref(&self) -> &Self::Target {
289 unsafe { &*Self::PTR }
290 }
291}
292impl core::fmt::Debug for GPIOC {
293 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
294 f.debug_struct("GPIOC").finish()
295 }
296}
297#[doc = "General-purpose I/Os"]
298pub use gpiob as gpioc;
299#[doc = "External interrupt/event controller"]
300pub struct EXTI {
301 _marker: PhantomData<*const ()>,
302}
303unsafe impl Send for EXTI {}
304impl EXTI {
305 #[doc = r"Pointer to the register block"]
306 pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
307 #[doc = r"Return the pointer to the register block"]
308 #[inline(always)]
309 pub const fn ptr() -> *const exti::RegisterBlock {
310 Self::PTR
311 }
312}
313impl Deref for EXTI {
314 type Target = exti::RegisterBlock;
315 #[inline(always)]
316 fn deref(&self) -> &Self::Target {
317 unsafe { &*Self::PTR }
318 }
319}
320impl core::fmt::Debug for EXTI {
321 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
322 f.debug_struct("EXTI").finish()
323 }
324}
325#[doc = "External interrupt/event controller"]
326pub mod exti;
327#[doc = "Low power timer"]
328pub struct LPTIM1 {
329 _marker: PhantomData<*const ()>,
330}
331unsafe impl Send for LPTIM1 {}
332impl LPTIM1 {
333 #[doc = r"Pointer to the register block"]
334 pub const PTR: *const lptim1::RegisterBlock = 0x4000_7c00 as *const _;
335 #[doc = r"Return the pointer to the register block"]
336 #[inline(always)]
337 pub const fn ptr() -> *const lptim1::RegisterBlock {
338 Self::PTR
339 }
340}
341impl Deref for LPTIM1 {
342 type Target = lptim1::RegisterBlock;
343 #[inline(always)]
344 fn deref(&self) -> &Self::Target {
345 unsafe { &*Self::PTR }
346 }
347}
348impl core::fmt::Debug for LPTIM1 {
349 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
350 f.debug_struct("LPTIM1").finish()
351 }
352}
353#[doc = "Low power timer"]
354pub mod lptim1;
355#[doc = "Universal synchronous asynchronous receiver transmitter"]
356pub struct USART1 {
357 _marker: PhantomData<*const ()>,
358}
359unsafe impl Send for USART1 {}
360impl USART1 {
361 #[doc = r"Pointer to the register block"]
362 pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
363 #[doc = r"Return the pointer to the register block"]
364 #[inline(always)]
365 pub const fn ptr() -> *const usart1::RegisterBlock {
366 Self::PTR
367 }
368}
369impl Deref for USART1 {
370 type Target = usart1::RegisterBlock;
371 #[inline(always)]
372 fn deref(&self) -> &Self::Target {
373 unsafe { &*Self::PTR }
374 }
375}
376impl core::fmt::Debug for USART1 {
377 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
378 f.debug_struct("USART1").finish()
379 }
380}
381#[doc = "Universal synchronous asynchronous receiver transmitter"]
382pub mod usart1;
383#[doc = "Independent watchdog"]
384pub struct IWDG {
385 _marker: PhantomData<*const ()>,
386}
387unsafe impl Send for IWDG {}
388impl IWDG {
389 #[doc = r"Pointer to the register block"]
390 pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
391 #[doc = r"Return the pointer to the register block"]
392 #[inline(always)]
393 pub const fn ptr() -> *const iwdg::RegisterBlock {
394 Self::PTR
395 }
396}
397impl Deref for IWDG {
398 type Target = iwdg::RegisterBlock;
399 #[inline(always)]
400 fn deref(&self) -> &Self::Target {
401 unsafe { &*Self::PTR }
402 }
403}
404impl core::fmt::Debug for IWDG {
405 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
406 f.debug_struct("IWDG").finish()
407 }
408}
409#[doc = "Independent watchdog"]
410pub mod iwdg;
411#[doc = "Advanced timer"]
412pub struct TIM1 {
413 _marker: PhantomData<*const ()>,
414}
415unsafe impl Send for TIM1 {}
416impl TIM1 {
417 #[doc = r"Pointer to the register block"]
418 pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
419 #[doc = r"Return the pointer to the register block"]
420 #[inline(always)]
421 pub const fn ptr() -> *const tim1::RegisterBlock {
422 Self::PTR
423 }
424}
425impl Deref for TIM1 {
426 type Target = tim1::RegisterBlock;
427 #[inline(always)]
428 fn deref(&self) -> &Self::Target {
429 unsafe { &*Self::PTR }
430 }
431}
432impl core::fmt::Debug for TIM1 {
433 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
434 f.debug_struct("TIM1").finish()
435 }
436}
437#[doc = "Advanced timer"]
438pub mod tim1;
439#[doc = "General purpose timer"]
440pub struct TIM14 {
441 _marker: PhantomData<*const ()>,
442}
443unsafe impl Send for TIM14 {}
444impl TIM14 {
445 #[doc = r"Pointer to the register block"]
446 pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
447 #[doc = r"Return the pointer to the register block"]
448 #[inline(always)]
449 pub const fn ptr() -> *const tim14::RegisterBlock {
450 Self::PTR
451 }
452}
453impl Deref for TIM14 {
454 type Target = tim14::RegisterBlock;
455 #[inline(always)]
456 fn deref(&self) -> &Self::Target {
457 unsafe { &*Self::PTR }
458 }
459}
460impl core::fmt::Debug for TIM14 {
461 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
462 f.debug_struct("TIM14").finish()
463 }
464}
465#[doc = "General purpose timer"]
466pub mod tim14;
467#[doc = "System configuration controller"]
468pub struct SYSCFG {
469 _marker: PhantomData<*const ()>,
470}
471unsafe impl Send for SYSCFG {}
472impl SYSCFG {
473 #[doc = r"Pointer to the register block"]
474 pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
475 #[doc = r"Return the pointer to the register block"]
476 #[inline(always)]
477 pub const fn ptr() -> *const syscfg::RegisterBlock {
478 Self::PTR
479 }
480}
481impl Deref for SYSCFG {
482 type Target = syscfg::RegisterBlock;
483 #[inline(always)]
484 fn deref(&self) -> &Self::Target {
485 unsafe { &*Self::PTR }
486 }
487}
488impl core::fmt::Debug for SYSCFG {
489 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
490 f.debug_struct("SYSCFG").finish()
491 }
492}
493#[doc = "System configuration controller"]
494pub mod syscfg;
495#[doc = "Flash"]
496pub struct FLASH {
497 _marker: PhantomData<*const ()>,
498}
499unsafe impl Send for FLASH {}
500impl FLASH {
501 #[doc = r"Pointer to the register block"]
502 pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
503 #[doc = r"Return the pointer to the register block"]
504 #[inline(always)]
505 pub const fn ptr() -> *const flash::RegisterBlock {
506 Self::PTR
507 }
508}
509impl Deref for FLASH {
510 type Target = flash::RegisterBlock;
511 #[inline(always)]
512 fn deref(&self) -> &Self::Target {
513 unsafe { &*Self::PTR }
514 }
515}
516impl core::fmt::Debug for FLASH {
517 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
518 f.debug_struct("FLASH").finish()
519 }
520}
521#[doc = "Flash"]
522pub mod flash;
523#[doc = "CRC calculation unit"]
524pub struct CRC {
525 _marker: PhantomData<*const ()>,
526}
527unsafe impl Send for CRC {}
528impl CRC {
529 #[doc = r"Pointer to the register block"]
530 pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
531 #[doc = r"Return the pointer to the register block"]
532 #[inline(always)]
533 pub const fn ptr() -> *const crc::RegisterBlock {
534 Self::PTR
535 }
536}
537impl Deref for CRC {
538 type Target = crc::RegisterBlock;
539 #[inline(always)]
540 fn deref(&self) -> &Self::Target {
541 unsafe { &*Self::PTR }
542 }
543}
544impl core::fmt::Debug for CRC {
545 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
546 f.debug_struct("CRC").finish()
547 }
548}
549#[doc = "CRC calculation unit"]
550pub mod crc;
551#[doc = "Serial peripheral interface"]
552pub struct SPI1 {
553 _marker: PhantomData<*const ()>,
554}
555unsafe impl Send for SPI1 {}
556impl SPI1 {
557 #[doc = r"Pointer to the register block"]
558 pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
559 #[doc = r"Return the pointer to the register block"]
560 #[inline(always)]
561 pub const fn ptr() -> *const spi1::RegisterBlock {
562 Self::PTR
563 }
564}
565impl Deref for SPI1 {
566 type Target = spi1::RegisterBlock;
567 #[inline(always)]
568 fn deref(&self) -> &Self::Target {
569 unsafe { &*Self::PTR }
570 }
571}
572impl core::fmt::Debug for SPI1 {
573 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
574 f.debug_struct("SPI1").finish()
575 }
576}
577#[doc = "Serial peripheral interface"]
578pub mod spi1;
579#[doc = "Inter integrated circuit"]
580pub struct I2C {
581 _marker: PhantomData<*const ()>,
582}
583unsafe impl Send for I2C {}
584impl I2C {
585 #[doc = r"Pointer to the register block"]
586 pub const PTR: *const i2c::RegisterBlock = 0x4000_5400 as *const _;
587 #[doc = r"Return the pointer to the register block"]
588 #[inline(always)]
589 pub const fn ptr() -> *const i2c::RegisterBlock {
590 Self::PTR
591 }
592}
593impl Deref for I2C {
594 type Target = i2c::RegisterBlock;
595 #[inline(always)]
596 fn deref(&self) -> &Self::Target {
597 unsafe { &*Self::PTR }
598 }
599}
600impl core::fmt::Debug for I2C {
601 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
602 f.debug_struct("I2C").finish()
603 }
604}
605#[doc = "Inter integrated circuit"]
606pub mod i2c;
607#[doc = "Debug support"]
608pub struct DBGMCU {
609 _marker: PhantomData<*const ()>,
610}
611unsafe impl Send for DBGMCU {}
612impl DBGMCU {
613 #[doc = r"Pointer to the register block"]
614 pub const PTR: *const dbgmcu::RegisterBlock = 0x4001_5800 as *const _;
615 #[doc = r"Return the pointer to the register block"]
616 #[inline(always)]
617 pub const fn ptr() -> *const dbgmcu::RegisterBlock {
618 Self::PTR
619 }
620}
621impl Deref for DBGMCU {
622 type Target = dbgmcu::RegisterBlock;
623 #[inline(always)]
624 fn deref(&self) -> &Self::Target {
625 unsafe { &*Self::PTR }
626 }
627}
628impl core::fmt::Debug for DBGMCU {
629 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
630 f.debug_struct("DBGMCU").finish()
631 }
632}
633#[doc = "Debug support"]
634pub mod dbgmcu;
635#[no_mangle]
636static mut DEVICE_PERIPHERALS: bool = false;
637#[doc = r"All the peripherals"]
638#[allow(non_snake_case)]
639pub struct Peripherals {
640 #[doc = "ADC"]
641 pub ADC: ADC,
642 #[doc = "RCC"]
643 pub RCC: RCC,
644 #[doc = "PWR"]
645 pub PWR: PWR,
646 #[doc = "GPIOA"]
647 pub GPIOA: GPIOA,
648 #[doc = "GPIOB"]
649 pub GPIOB: GPIOB,
650 #[doc = "GPIOC"]
651 pub GPIOC: GPIOC,
652 #[doc = "EXTI"]
653 pub EXTI: EXTI,
654 #[doc = "LPTIM1"]
655 pub LPTIM1: LPTIM1,
656 #[doc = "USART1"]
657 pub USART1: USART1,
658 #[doc = "IWDG"]
659 pub IWDG: IWDG,
660 #[doc = "TIM1"]
661 pub TIM1: TIM1,
662 #[doc = "TIM14"]
663 pub TIM14: TIM14,
664 #[doc = "SYSCFG"]
665 pub SYSCFG: SYSCFG,
666 #[doc = "FLASH"]
667 pub FLASH: FLASH,
668 #[doc = "CRC"]
669 pub CRC: CRC,
670 #[doc = "SPI1"]
671 pub SPI1: SPI1,
672 #[doc = "I2C"]
673 pub I2C: I2C,
674 #[doc = "DBGMCU"]
675 pub DBGMCU: DBGMCU,
676}
677impl Peripherals {
678 #[doc = r"Returns all the peripherals *once*"]
679 #[inline]
680 pub fn take() -> Option<Self> {
681 cortex_m::interrupt::free(|_| {
682 if unsafe { DEVICE_PERIPHERALS } {
683 None
684 } else {
685 Some(unsafe { Peripherals::steal() })
686 }
687 })
688 }
689 #[doc = r"Unchecked version of `Peripherals::take`"]
690 #[inline]
691 pub unsafe fn steal() -> Self {
692 DEVICE_PERIPHERALS = true;
693 Peripherals {
694 ADC: ADC {
695 _marker: PhantomData,
696 },
697 RCC: RCC {
698 _marker: PhantomData,
699 },
700 PWR: PWR {
701 _marker: PhantomData,
702 },
703 GPIOA: GPIOA {
704 _marker: PhantomData,
705 },
706 GPIOB: GPIOB {
707 _marker: PhantomData,
708 },
709 GPIOC: GPIOC {
710 _marker: PhantomData,
711 },
712 EXTI: EXTI {
713 _marker: PhantomData,
714 },
715 LPTIM1: LPTIM1 {
716 _marker: PhantomData,
717 },
718 USART1: USART1 {
719 _marker: PhantomData,
720 },
721 IWDG: IWDG {
722 _marker: PhantomData,
723 },
724 TIM1: TIM1 {
725 _marker: PhantomData,
726 },
727 TIM14: TIM14 {
728 _marker: PhantomData,
729 },
730 SYSCFG: SYSCFG {
731 _marker: PhantomData,
732 },
733 FLASH: FLASH {
734 _marker: PhantomData,
735 },
736 CRC: CRC {
737 _marker: PhantomData,
738 },
739 SPI1: SPI1 {
740 _marker: PhantomData,
741 },
742 I2C: I2C {
743 _marker: PhantomData,
744 },
745 DBGMCU: DBGMCU {
746 _marker: PhantomData,
747 },
748 }
749 }
750}