1#![doc = "Peripheral access API for AIR001XX_DFP microcontrollers (generated using svd2rust v0.30.2 ( ))\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.30.2/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(dead_code)]
4#![deny(improper_ctypes)]
5#![deny(missing_docs)]
6#![deny(no_mangle_generic_items)]
7#![deny(non_shorthand_field_patterns)]
8#![deny(overflowing_literals)]
9#![deny(path_statements)]
10#![deny(patterns_in_fns_without_body)]
11#![deny(private_bounds)]
12#![deny(private_interfaces)]
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 SPI2();
57 fn USART1();
58 fn USART2();
59 fn LED();
60}
61#[doc(hidden)]
62pub union Vector {
63 _handler: unsafe extern "C" fn(),
64 _reserved: u32,
65}
66#[cfg(feature = "rt")]
67#[doc(hidden)]
68#[link_section = ".vector_table.interrupts"]
69#[no_mangle]
70pub static __INTERRUPTS: [Vector; 31] = [
71 Vector { _handler: WWDG },
72 Vector { _handler: PVD },
73 Vector { _handler: RTC },
74 Vector { _handler: FLASH },
75 Vector { _handler: RCC },
76 Vector { _handler: EXTI0_1 },
77 Vector { _handler: EXTI2_3 },
78 Vector { _handler: EXTI4_15 },
79 Vector { _reserved: 0 },
80 Vector {
81 _handler: DMA_CHANNEL1,
82 },
83 Vector {
84 _handler: DMA_CHANNEL2_3,
85 },
86 Vector { _reserved: 0 },
87 Vector { _handler: ADC_COMP },
88 Vector {
89 _handler: TIM1_BRK_UP_TRG_COM,
90 },
91 Vector { _handler: TIM1_CC },
92 Vector { _reserved: 0 },
93 Vector { _handler: TIM3 },
94 Vector { _reserved: 0 },
95 Vector { _reserved: 0 },
96 Vector { _handler: TIM14 },
97 Vector { _reserved: 0 },
98 Vector { _handler: TIM16 },
99 Vector { _handler: TIM17 },
100 Vector { _handler: I2C1 },
101 Vector { _reserved: 0 },
102 Vector { _handler: SPI1 },
103 Vector { _handler: SPI2 },
104 Vector { _handler: USART1 },
105 Vector { _handler: USART2 },
106 Vector { _reserved: 0 },
107 Vector { _handler: LED },
108];
109#[doc = r"Enumeration of all the interrupts."]
110#[derive(Copy, Clone, Debug, PartialEq, Eq)]
111#[repr(u16)]
112pub enum Interrupt {
113 #[doc = "0 - Window WatchDog Interrupt"]
114 WWDG = 0,
115 #[doc = "1 - PVD Interrupt through EXTI Lines 16"]
116 PVD = 1,
117 #[doc = "2 - RTC Interrupt through EXTI Lines 19"]
118 RTC = 2,
119 #[doc = "3 - FLASH global Interrupt"]
120 FLASH = 3,
121 #[doc = "4 - RCC global Interrupt"]
122 RCC = 4,
123 #[doc = "5 - EXTI Line 0 and 1 Interrupt"]
124 EXTI0_1 = 5,
125 #[doc = "6 - EXTI Line 2 and 3 Interrupt"]
126 EXTI2_3 = 6,
127 #[doc = "7 - EXTI Line 4 to 15 Interrupt"]
128 EXTI4_15 = 7,
129 #[doc = "9 - DMA Channel 1 Interrupt"]
130 DMA_CHANNEL1 = 9,
131 #[doc = "10 - DMA Channel 2 and Channel 3 Interrupt"]
132 DMA_CHANNEL2_3 = 10,
133 #[doc = "12 - ADC and COMP Interrupt through EXTI Lines 17 and 18"]
134 ADC_COMP = 12,
135 #[doc = "13 - TIM1 Break, Update, Trigger and Commutation Interrupt"]
136 TIM1_BRK_UP_TRG_COM = 13,
137 #[doc = "14 - TIM1 Capture Compare Interrupt"]
138 TIM1_CC = 14,
139 #[doc = "16 - TIM3 global Interrupt"]
140 TIM3 = 16,
141 #[doc = "19 - TIM14 global Interrupt"]
142 TIM14 = 19,
143 #[doc = "21 - TIM16 global Interrupt"]
144 TIM16 = 21,
145 #[doc = "22 - TIM17 global Interrupt"]
146 TIM17 = 22,
147 #[doc = "23 - I2C1 global Interrupt"]
148 I2C1 = 23,
149 #[doc = "25 - SPI1 global Interrupt"]
150 SPI1 = 25,
151 #[doc = "26 - SPI2 global Interrupt"]
152 SPI2 = 26,
153 #[doc = "27 - USART1 global Interrupt"]
154 USART1 = 27,
155 #[doc = "28 - USART2 global Interrupt"]
156 USART2 = 28,
157 #[doc = "30 - LED global Interrupt"]
158 LED = 30,
159}
160unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
161 #[inline(always)]
162 fn number(self) -> u16 {
163 self as u16
164 }
165}
166#[doc = "Analog to Digital Converter"]
167pub struct ADC {
168 _marker: PhantomData<*const ()>,
169}
170unsafe impl Send for ADC {}
171impl ADC {
172 #[doc = r"Pointer to the register block"]
173 pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
174 #[doc = r"Return the pointer to the register block"]
175 #[inline(always)]
176 pub const fn ptr() -> *const adc::RegisterBlock {
177 Self::PTR
178 }
179 #[doc = r" Steal an instance of this peripheral"]
180 #[doc = r""]
181 #[doc = r" # Safety"]
182 #[doc = r""]
183 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
184 #[doc = r" that may race with any existing instances, for example by only"]
185 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
186 #[doc = r" original peripheral and using critical sections to coordinate"]
187 #[doc = r" access between multiple new instances."]
188 #[doc = r""]
189 #[doc = r" Additionally, other software such as HALs may rely on only one"]
190 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
191 #[doc = r" no stolen instances are passed to such software."]
192 pub unsafe fn steal() -> Self {
193 Self {
194 _marker: PhantomData,
195 }
196 }
197}
198impl Deref for ADC {
199 type Target = adc::RegisterBlock;
200 #[inline(always)]
201 fn deref(&self) -> &Self::Target {
202 unsafe { &*Self::PTR }
203 }
204}
205impl core::fmt::Debug for ADC {
206 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
207 f.debug_struct("ADC").finish()
208 }
209}
210#[doc = "Analog to Digital Converter"]
211pub mod adc;
212#[doc = "Comparator"]
213pub struct COMP1 {
214 _marker: PhantomData<*const ()>,
215}
216unsafe impl Send for COMP1 {}
217impl COMP1 {
218 #[doc = r"Pointer to the register block"]
219 pub const PTR: *const comp1::RegisterBlock = 0x4001_0200 as *const _;
220 #[doc = r"Return the pointer to the register block"]
221 #[inline(always)]
222 pub const fn ptr() -> *const comp1::RegisterBlock {
223 Self::PTR
224 }
225 #[doc = r" Steal an instance of this peripheral"]
226 #[doc = r""]
227 #[doc = r" # Safety"]
228 #[doc = r""]
229 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
230 #[doc = r" that may race with any existing instances, for example by only"]
231 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
232 #[doc = r" original peripheral and using critical sections to coordinate"]
233 #[doc = r" access between multiple new instances."]
234 #[doc = r""]
235 #[doc = r" Additionally, other software such as HALs may rely on only one"]
236 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
237 #[doc = r" no stolen instances are passed to such software."]
238 pub unsafe fn steal() -> Self {
239 Self {
240 _marker: PhantomData,
241 }
242 }
243}
244impl Deref for COMP1 {
245 type Target = comp1::RegisterBlock;
246 #[inline(always)]
247 fn deref(&self) -> &Self::Target {
248 unsafe { &*Self::PTR }
249 }
250}
251impl core::fmt::Debug for COMP1 {
252 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
253 f.debug_struct("COMP1").finish()
254 }
255}
256#[doc = "Comparator"]
257pub mod comp1;
258#[doc = "Comparator"]
259pub struct COMP2 {
260 _marker: PhantomData<*const ()>,
261}
262unsafe impl Send for COMP2 {}
263impl COMP2 {
264 #[doc = r"Pointer to the register block"]
265 pub const PTR: *const comp2::RegisterBlock = 0x4001_0210 as *const _;
266 #[doc = r"Return the pointer to the register block"]
267 #[inline(always)]
268 pub const fn ptr() -> *const comp2::RegisterBlock {
269 Self::PTR
270 }
271 #[doc = r" Steal an instance of this peripheral"]
272 #[doc = r""]
273 #[doc = r" # Safety"]
274 #[doc = r""]
275 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
276 #[doc = r" that may race with any existing instances, for example by only"]
277 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
278 #[doc = r" original peripheral and using critical sections to coordinate"]
279 #[doc = r" access between multiple new instances."]
280 #[doc = r""]
281 #[doc = r" Additionally, other software such as HALs may rely on only one"]
282 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
283 #[doc = r" no stolen instances are passed to such software."]
284 pub unsafe fn steal() -> Self {
285 Self {
286 _marker: PhantomData,
287 }
288 }
289}
290impl Deref for COMP2 {
291 type Target = comp2::RegisterBlock;
292 #[inline(always)]
293 fn deref(&self) -> &Self::Target {
294 unsafe { &*Self::PTR }
295 }
296}
297impl core::fmt::Debug for COMP2 {
298 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
299 f.debug_struct("COMP2").finish()
300 }
301}
302#[doc = "Comparator"]
303pub mod comp2;
304#[doc = "Reset and clock control"]
305pub struct RCC {
306 _marker: PhantomData<*const ()>,
307}
308unsafe impl Send for RCC {}
309impl RCC {
310 #[doc = r"Pointer to the register block"]
311 pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
312 #[doc = r"Return the pointer to the register block"]
313 #[inline(always)]
314 pub const fn ptr() -> *const rcc::RegisterBlock {
315 Self::PTR
316 }
317 #[doc = r" Steal an instance of this peripheral"]
318 #[doc = r""]
319 #[doc = r" # Safety"]
320 #[doc = r""]
321 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
322 #[doc = r" that may race with any existing instances, for example by only"]
323 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
324 #[doc = r" original peripheral and using critical sections to coordinate"]
325 #[doc = r" access between multiple new instances."]
326 #[doc = r""]
327 #[doc = r" Additionally, other software such as HALs may rely on only one"]
328 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
329 #[doc = r" no stolen instances are passed to such software."]
330 pub unsafe fn steal() -> Self {
331 Self {
332 _marker: PhantomData,
333 }
334 }
335}
336impl Deref for RCC {
337 type Target = rcc::RegisterBlock;
338 #[inline(always)]
339 fn deref(&self) -> &Self::Target {
340 unsafe { &*Self::PTR }
341 }
342}
343impl core::fmt::Debug for RCC {
344 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
345 f.debug_struct("RCC").finish()
346 }
347}
348#[doc = "Reset and clock control"]
349pub mod rcc;
350#[doc = "Power control"]
351pub struct PWR {
352 _marker: PhantomData<*const ()>,
353}
354unsafe impl Send for PWR {}
355impl PWR {
356 #[doc = r"Pointer to the register block"]
357 pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
358 #[doc = r"Return the pointer to the register block"]
359 #[inline(always)]
360 pub const fn ptr() -> *const pwr::RegisterBlock {
361 Self::PTR
362 }
363 #[doc = r" Steal an instance of this peripheral"]
364 #[doc = r""]
365 #[doc = r" # Safety"]
366 #[doc = r""]
367 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
368 #[doc = r" that may race with any existing instances, for example by only"]
369 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
370 #[doc = r" original peripheral and using critical sections to coordinate"]
371 #[doc = r" access between multiple new instances."]
372 #[doc = r""]
373 #[doc = r" Additionally, other software such as HALs may rely on only one"]
374 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
375 #[doc = r" no stolen instances are passed to such software."]
376 pub unsafe fn steal() -> Self {
377 Self {
378 _marker: PhantomData,
379 }
380 }
381}
382impl Deref for PWR {
383 type Target = pwr::RegisterBlock;
384 #[inline(always)]
385 fn deref(&self) -> &Self::Target {
386 unsafe { &*Self::PTR }
387 }
388}
389impl core::fmt::Debug for PWR {
390 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
391 f.debug_struct("PWR").finish()
392 }
393}
394#[doc = "Power control"]
395pub mod pwr;
396#[doc = "General-purpose I/Os"]
397pub struct GPIOA {
398 _marker: PhantomData<*const ()>,
399}
400unsafe impl Send for GPIOA {}
401impl GPIOA {
402 #[doc = r"Pointer to the register block"]
403 pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
404 #[doc = r"Return the pointer to the register block"]
405 #[inline(always)]
406 pub const fn ptr() -> *const gpioa::RegisterBlock {
407 Self::PTR
408 }
409 #[doc = r" Steal an instance of this peripheral"]
410 #[doc = r""]
411 #[doc = r" # Safety"]
412 #[doc = r""]
413 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
414 #[doc = r" that may race with any existing instances, for example by only"]
415 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
416 #[doc = r" original peripheral and using critical sections to coordinate"]
417 #[doc = r" access between multiple new instances."]
418 #[doc = r""]
419 #[doc = r" Additionally, other software such as HALs may rely on only one"]
420 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
421 #[doc = r" no stolen instances are passed to such software."]
422 pub unsafe fn steal() -> Self {
423 Self {
424 _marker: PhantomData,
425 }
426 }
427}
428impl Deref for GPIOA {
429 type Target = gpioa::RegisterBlock;
430 #[inline(always)]
431 fn deref(&self) -> &Self::Target {
432 unsafe { &*Self::PTR }
433 }
434}
435impl core::fmt::Debug for GPIOA {
436 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
437 f.debug_struct("GPIOA").finish()
438 }
439}
440#[doc = "General-purpose I/Os"]
441pub mod gpioa;
442#[doc = "General-purpose I/Os"]
443pub struct GPIOB {
444 _marker: PhantomData<*const ()>,
445}
446unsafe impl Send for GPIOB {}
447impl GPIOB {
448 #[doc = r"Pointer to the register block"]
449 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
450 #[doc = r"Return the pointer to the register block"]
451 #[inline(always)]
452 pub const fn ptr() -> *const gpiob::RegisterBlock {
453 Self::PTR
454 }
455 #[doc = r" Steal an instance of this peripheral"]
456 #[doc = r""]
457 #[doc = r" # Safety"]
458 #[doc = r""]
459 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
460 #[doc = r" that may race with any existing instances, for example by only"]
461 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
462 #[doc = r" original peripheral and using critical sections to coordinate"]
463 #[doc = r" access between multiple new instances."]
464 #[doc = r""]
465 #[doc = r" Additionally, other software such as HALs may rely on only one"]
466 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
467 #[doc = r" no stolen instances are passed to such software."]
468 pub unsafe fn steal() -> Self {
469 Self {
470 _marker: PhantomData,
471 }
472 }
473}
474impl Deref for GPIOB {
475 type Target = gpiob::RegisterBlock;
476 #[inline(always)]
477 fn deref(&self) -> &Self::Target {
478 unsafe { &*Self::PTR }
479 }
480}
481impl core::fmt::Debug for GPIOB {
482 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
483 f.debug_struct("GPIOB").finish()
484 }
485}
486#[doc = "General-purpose I/Os"]
487pub mod gpiob;
488#[doc = "General-purpose I/Os"]
489pub struct GPIOF {
490 _marker: PhantomData<*const ()>,
491}
492unsafe impl Send for GPIOF {}
493impl GPIOF {
494 #[doc = r"Pointer to the register block"]
495 pub const PTR: *const gpiob::RegisterBlock = 0x5000_1400 as *const _;
496 #[doc = r"Return the pointer to the register block"]
497 #[inline(always)]
498 pub const fn ptr() -> *const gpiob::RegisterBlock {
499 Self::PTR
500 }
501 #[doc = r" Steal an instance of this peripheral"]
502 #[doc = r""]
503 #[doc = r" # Safety"]
504 #[doc = r""]
505 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
506 #[doc = r" that may race with any existing instances, for example by only"]
507 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
508 #[doc = r" original peripheral and using critical sections to coordinate"]
509 #[doc = r" access between multiple new instances."]
510 #[doc = r""]
511 #[doc = r" Additionally, other software such as HALs may rely on only one"]
512 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
513 #[doc = r" no stolen instances are passed to such software."]
514 pub unsafe fn steal() -> Self {
515 Self {
516 _marker: PhantomData,
517 }
518 }
519}
520impl Deref for GPIOF {
521 type Target = gpiob::RegisterBlock;
522 #[inline(always)]
523 fn deref(&self) -> &Self::Target {
524 unsafe { &*Self::PTR }
525 }
526}
527impl core::fmt::Debug for GPIOF {
528 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
529 f.debug_struct("GPIOF").finish()
530 }
531}
532#[doc = "General-purpose I/Os"]
533pub use self::gpiob as gpiof;
534#[doc = "External interrupt/event controller"]
535pub struct EXTI {
536 _marker: PhantomData<*const ()>,
537}
538unsafe impl Send for EXTI {}
539impl EXTI {
540 #[doc = r"Pointer to the register block"]
541 pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
542 #[doc = r"Return the pointer to the register block"]
543 #[inline(always)]
544 pub const fn ptr() -> *const exti::RegisterBlock {
545 Self::PTR
546 }
547 #[doc = r" Steal an instance of this peripheral"]
548 #[doc = r""]
549 #[doc = r" # Safety"]
550 #[doc = r""]
551 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
552 #[doc = r" that may race with any existing instances, for example by only"]
553 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
554 #[doc = r" original peripheral and using critical sections to coordinate"]
555 #[doc = r" access between multiple new instances."]
556 #[doc = r""]
557 #[doc = r" Additionally, other software such as HALs may rely on only one"]
558 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
559 #[doc = r" no stolen instances are passed to such software."]
560 pub unsafe fn steal() -> Self {
561 Self {
562 _marker: PhantomData,
563 }
564 }
565}
566impl Deref for EXTI {
567 type Target = exti::RegisterBlock;
568 #[inline(always)]
569 fn deref(&self) -> &Self::Target {
570 unsafe { &*Self::PTR }
571 }
572}
573impl core::fmt::Debug for EXTI {
574 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
575 f.debug_struct("EXTI").finish()
576 }
577}
578#[doc = "External interrupt/event controller"]
579pub mod exti;
580#[doc = "Low power timer"]
581pub struct LPTIM {
582 _marker: PhantomData<*const ()>,
583}
584unsafe impl Send for LPTIM {}
585impl LPTIM {
586 #[doc = r"Pointer to the register block"]
587 pub const PTR: *const lptim::RegisterBlock = 0x4000_7c00 as *const _;
588 #[doc = r"Return the pointer to the register block"]
589 #[inline(always)]
590 pub const fn ptr() -> *const lptim::RegisterBlock {
591 Self::PTR
592 }
593 #[doc = r" Steal an instance of this peripheral"]
594 #[doc = r""]
595 #[doc = r" # Safety"]
596 #[doc = r""]
597 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
598 #[doc = r" that may race with any existing instances, for example by only"]
599 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
600 #[doc = r" original peripheral and using critical sections to coordinate"]
601 #[doc = r" access between multiple new instances."]
602 #[doc = r""]
603 #[doc = r" Additionally, other software such as HALs may rely on only one"]
604 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
605 #[doc = r" no stolen instances are passed to such software."]
606 pub unsafe fn steal() -> Self {
607 Self {
608 _marker: PhantomData,
609 }
610 }
611}
612impl Deref for LPTIM {
613 type Target = lptim::RegisterBlock;
614 #[inline(always)]
615 fn deref(&self) -> &Self::Target {
616 unsafe { &*Self::PTR }
617 }
618}
619impl core::fmt::Debug for LPTIM {
620 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
621 f.debug_struct("LPTIM").finish()
622 }
623}
624#[doc = "Low power timer"]
625pub mod lptim;
626#[doc = "Universal synchronous asynchronous receiver transmitter"]
627pub struct USART1 {
628 _marker: PhantomData<*const ()>,
629}
630unsafe impl Send for USART1 {}
631impl USART1 {
632 #[doc = r"Pointer to the register block"]
633 pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
634 #[doc = r"Return the pointer to the register block"]
635 #[inline(always)]
636 pub const fn ptr() -> *const usart1::RegisterBlock {
637 Self::PTR
638 }
639 #[doc = r" Steal an instance of this peripheral"]
640 #[doc = r""]
641 #[doc = r" # Safety"]
642 #[doc = r""]
643 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
644 #[doc = r" that may race with any existing instances, for example by only"]
645 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
646 #[doc = r" original peripheral and using critical sections to coordinate"]
647 #[doc = r" access between multiple new instances."]
648 #[doc = r""]
649 #[doc = r" Additionally, other software such as HALs may rely on only one"]
650 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
651 #[doc = r" no stolen instances are passed to such software."]
652 pub unsafe fn steal() -> Self {
653 Self {
654 _marker: PhantomData,
655 }
656 }
657}
658impl Deref for USART1 {
659 type Target = usart1::RegisterBlock;
660 #[inline(always)]
661 fn deref(&self) -> &Self::Target {
662 unsafe { &*Self::PTR }
663 }
664}
665impl core::fmt::Debug for USART1 {
666 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
667 f.debug_struct("USART1").finish()
668 }
669}
670#[doc = "Universal synchronous asynchronous receiver transmitter"]
671pub mod usart1;
672#[doc = "Universal synchronous asynchronous receiver transmitter"]
673pub struct USART2 {
674 _marker: PhantomData<*const ()>,
675}
676unsafe impl Send for USART2 {}
677impl USART2 {
678 #[doc = r"Pointer to the register block"]
679 pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
680 #[doc = r"Return the pointer to the register block"]
681 #[inline(always)]
682 pub const fn ptr() -> *const usart1::RegisterBlock {
683 Self::PTR
684 }
685 #[doc = r" Steal an instance of this peripheral"]
686 #[doc = r""]
687 #[doc = r" # Safety"]
688 #[doc = r""]
689 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
690 #[doc = r" that may race with any existing instances, for example by only"]
691 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
692 #[doc = r" original peripheral and using critical sections to coordinate"]
693 #[doc = r" access between multiple new instances."]
694 #[doc = r""]
695 #[doc = r" Additionally, other software such as HALs may rely on only one"]
696 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
697 #[doc = r" no stolen instances are passed to such software."]
698 pub unsafe fn steal() -> Self {
699 Self {
700 _marker: PhantomData,
701 }
702 }
703}
704impl Deref for USART2 {
705 type Target = usart1::RegisterBlock;
706 #[inline(always)]
707 fn deref(&self) -> &Self::Target {
708 unsafe { &*Self::PTR }
709 }
710}
711impl core::fmt::Debug for USART2 {
712 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
713 f.debug_struct("USART2").finish()
714 }
715}
716#[doc = "Universal synchronous asynchronous receiver transmitter"]
717pub use self::usart1 as usart2;
718#[doc = "Real time clock"]
719pub struct RTC {
720 _marker: PhantomData<*const ()>,
721}
722unsafe impl Send for RTC {}
723impl RTC {
724 #[doc = r"Pointer to the register block"]
725 pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
726 #[doc = r"Return the pointer to the register block"]
727 #[inline(always)]
728 pub const fn ptr() -> *const rtc::RegisterBlock {
729 Self::PTR
730 }
731 #[doc = r" Steal an instance of this peripheral"]
732 #[doc = r""]
733 #[doc = r" # Safety"]
734 #[doc = r""]
735 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
736 #[doc = r" that may race with any existing instances, for example by only"]
737 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
738 #[doc = r" original peripheral and using critical sections to coordinate"]
739 #[doc = r" access between multiple new instances."]
740 #[doc = r""]
741 #[doc = r" Additionally, other software such as HALs may rely on only one"]
742 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
743 #[doc = r" no stolen instances are passed to such software."]
744 pub unsafe fn steal() -> Self {
745 Self {
746 _marker: PhantomData,
747 }
748 }
749}
750impl Deref for RTC {
751 type Target = rtc::RegisterBlock;
752 #[inline(always)]
753 fn deref(&self) -> &Self::Target {
754 unsafe { &*Self::PTR }
755 }
756}
757impl core::fmt::Debug for RTC {
758 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
759 f.debug_struct("RTC").finish()
760 }
761}
762#[doc = "Real time clock"]
763pub mod rtc;
764#[doc = "Independent watchdog"]
765pub struct IWDG {
766 _marker: PhantomData<*const ()>,
767}
768unsafe impl Send for IWDG {}
769impl IWDG {
770 #[doc = r"Pointer to the register block"]
771 pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
772 #[doc = r"Return the pointer to the register block"]
773 #[inline(always)]
774 pub const fn ptr() -> *const iwdg::RegisterBlock {
775 Self::PTR
776 }
777 #[doc = r" Steal an instance of this peripheral"]
778 #[doc = r""]
779 #[doc = r" # Safety"]
780 #[doc = r""]
781 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
782 #[doc = r" that may race with any existing instances, for example by only"]
783 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
784 #[doc = r" original peripheral and using critical sections to coordinate"]
785 #[doc = r" access between multiple new instances."]
786 #[doc = r""]
787 #[doc = r" Additionally, other software such as HALs may rely on only one"]
788 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
789 #[doc = r" no stolen instances are passed to such software."]
790 pub unsafe fn steal() -> Self {
791 Self {
792 _marker: PhantomData,
793 }
794 }
795}
796impl Deref for IWDG {
797 type Target = iwdg::RegisterBlock;
798 #[inline(always)]
799 fn deref(&self) -> &Self::Target {
800 unsafe { &*Self::PTR }
801 }
802}
803impl core::fmt::Debug for IWDG {
804 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
805 f.debug_struct("IWDG").finish()
806 }
807}
808#[doc = "Independent watchdog"]
809pub mod iwdg;
810#[doc = "Window watchdog"]
811pub struct WWDG {
812 _marker: PhantomData<*const ()>,
813}
814unsafe impl Send for WWDG {}
815impl WWDG {
816 #[doc = r"Pointer to the register block"]
817 pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
818 #[doc = r"Return the pointer to the register block"]
819 #[inline(always)]
820 pub const fn ptr() -> *const wwdg::RegisterBlock {
821 Self::PTR
822 }
823 #[doc = r" Steal an instance of this peripheral"]
824 #[doc = r""]
825 #[doc = r" # Safety"]
826 #[doc = r""]
827 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
828 #[doc = r" that may race with any existing instances, for example by only"]
829 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
830 #[doc = r" original peripheral and using critical sections to coordinate"]
831 #[doc = r" access between multiple new instances."]
832 #[doc = r""]
833 #[doc = r" Additionally, other software such as HALs may rely on only one"]
834 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
835 #[doc = r" no stolen instances are passed to such software."]
836 pub unsafe fn steal() -> Self {
837 Self {
838 _marker: PhantomData,
839 }
840 }
841}
842impl Deref for WWDG {
843 type Target = wwdg::RegisterBlock;
844 #[inline(always)]
845 fn deref(&self) -> &Self::Target {
846 unsafe { &*Self::PTR }
847 }
848}
849impl core::fmt::Debug for WWDG {
850 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
851 f.debug_struct("WWDG").finish()
852 }
853}
854#[doc = "Window watchdog"]
855pub mod wwdg;
856#[doc = "Advanced timer"]
857pub struct TIM1 {
858 _marker: PhantomData<*const ()>,
859}
860unsafe impl Send for TIM1 {}
861impl TIM1 {
862 #[doc = r"Pointer to the register block"]
863 pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
864 #[doc = r"Return the pointer to the register block"]
865 #[inline(always)]
866 pub const fn ptr() -> *const tim1::RegisterBlock {
867 Self::PTR
868 }
869 #[doc = r" Steal an instance of this peripheral"]
870 #[doc = r""]
871 #[doc = r" # Safety"]
872 #[doc = r""]
873 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
874 #[doc = r" that may race with any existing instances, for example by only"]
875 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
876 #[doc = r" original peripheral and using critical sections to coordinate"]
877 #[doc = r" access between multiple new instances."]
878 #[doc = r""]
879 #[doc = r" Additionally, other software such as HALs may rely on only one"]
880 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
881 #[doc = r" no stolen instances are passed to such software."]
882 pub unsafe fn steal() -> Self {
883 Self {
884 _marker: PhantomData,
885 }
886 }
887}
888impl Deref for TIM1 {
889 type Target = tim1::RegisterBlock;
890 #[inline(always)]
891 fn deref(&self) -> &Self::Target {
892 unsafe { &*Self::PTR }
893 }
894}
895impl core::fmt::Debug for TIM1 {
896 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
897 f.debug_struct("TIM1").finish()
898 }
899}
900#[doc = "Advanced timer"]
901pub mod tim1;
902#[doc = "General purpose timer"]
903pub struct TIM3 {
904 _marker: PhantomData<*const ()>,
905}
906unsafe impl Send for TIM3 {}
907impl TIM3 {
908 #[doc = r"Pointer to the register block"]
909 pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
910 #[doc = r"Return the pointer to the register block"]
911 #[inline(always)]
912 pub const fn ptr() -> *const tim3::RegisterBlock {
913 Self::PTR
914 }
915 #[doc = r" Steal an instance of this peripheral"]
916 #[doc = r""]
917 #[doc = r" # Safety"]
918 #[doc = r""]
919 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
920 #[doc = r" that may race with any existing instances, for example by only"]
921 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
922 #[doc = r" original peripheral and using critical sections to coordinate"]
923 #[doc = r" access between multiple new instances."]
924 #[doc = r""]
925 #[doc = r" Additionally, other software such as HALs may rely on only one"]
926 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
927 #[doc = r" no stolen instances are passed to such software."]
928 pub unsafe fn steal() -> Self {
929 Self {
930 _marker: PhantomData,
931 }
932 }
933}
934impl Deref for TIM3 {
935 type Target = tim3::RegisterBlock;
936 #[inline(always)]
937 fn deref(&self) -> &Self::Target {
938 unsafe { &*Self::PTR }
939 }
940}
941impl core::fmt::Debug for TIM3 {
942 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
943 f.debug_struct("TIM3").finish()
944 }
945}
946#[doc = "General purpose timer"]
947pub mod tim3;
948#[doc = "General purpose timer"]
949pub struct TIM14 {
950 _marker: PhantomData<*const ()>,
951}
952unsafe impl Send for TIM14 {}
953impl TIM14 {
954 #[doc = r"Pointer to the register block"]
955 pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
956 #[doc = r"Return the pointer to the register block"]
957 #[inline(always)]
958 pub const fn ptr() -> *const tim14::RegisterBlock {
959 Self::PTR
960 }
961 #[doc = r" Steal an instance of this peripheral"]
962 #[doc = r""]
963 #[doc = r" # Safety"]
964 #[doc = r""]
965 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
966 #[doc = r" that may race with any existing instances, for example by only"]
967 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
968 #[doc = r" original peripheral and using critical sections to coordinate"]
969 #[doc = r" access between multiple new instances."]
970 #[doc = r""]
971 #[doc = r" Additionally, other software such as HALs may rely on only one"]
972 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
973 #[doc = r" no stolen instances are passed to such software."]
974 pub unsafe fn steal() -> Self {
975 Self {
976 _marker: PhantomData,
977 }
978 }
979}
980impl Deref for TIM14 {
981 type Target = tim14::RegisterBlock;
982 #[inline(always)]
983 fn deref(&self) -> &Self::Target {
984 unsafe { &*Self::PTR }
985 }
986}
987impl core::fmt::Debug for TIM14 {
988 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
989 f.debug_struct("TIM14").finish()
990 }
991}
992#[doc = "General purpose timer"]
993pub mod tim14;
994#[doc = "General purpose timer"]
995pub struct TIM16 {
996 _marker: PhantomData<*const ()>,
997}
998unsafe impl Send for TIM16 {}
999impl TIM16 {
1000 #[doc = r"Pointer to the register block"]
1001 pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
1002 #[doc = r"Return the pointer to the register block"]
1003 #[inline(always)]
1004 pub const fn ptr() -> *const tim16::RegisterBlock {
1005 Self::PTR
1006 }
1007 #[doc = r" Steal an instance of this peripheral"]
1008 #[doc = r""]
1009 #[doc = r" # Safety"]
1010 #[doc = r""]
1011 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1012 #[doc = r" that may race with any existing instances, for example by only"]
1013 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1014 #[doc = r" original peripheral and using critical sections to coordinate"]
1015 #[doc = r" access between multiple new instances."]
1016 #[doc = r""]
1017 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1018 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1019 #[doc = r" no stolen instances are passed to such software."]
1020 pub unsafe fn steal() -> Self {
1021 Self {
1022 _marker: PhantomData,
1023 }
1024 }
1025}
1026impl Deref for TIM16 {
1027 type Target = tim16::RegisterBlock;
1028 #[inline(always)]
1029 fn deref(&self) -> &Self::Target {
1030 unsafe { &*Self::PTR }
1031 }
1032}
1033impl core::fmt::Debug for TIM16 {
1034 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1035 f.debug_struct("TIM16").finish()
1036 }
1037}
1038#[doc = "General purpose timer"]
1039pub mod tim16;
1040#[doc = "General purpose timer"]
1041pub struct TIM17 {
1042 _marker: PhantomData<*const ()>,
1043}
1044unsafe impl Send for TIM17 {}
1045impl TIM17 {
1046 #[doc = r"Pointer to the register block"]
1047 pub const PTR: *const tim16::RegisterBlock = 0x4001_4800 as *const _;
1048 #[doc = r"Return the pointer to the register block"]
1049 #[inline(always)]
1050 pub const fn ptr() -> *const tim16::RegisterBlock {
1051 Self::PTR
1052 }
1053 #[doc = r" Steal an instance of this peripheral"]
1054 #[doc = r""]
1055 #[doc = r" # Safety"]
1056 #[doc = r""]
1057 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1058 #[doc = r" that may race with any existing instances, for example by only"]
1059 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1060 #[doc = r" original peripheral and using critical sections to coordinate"]
1061 #[doc = r" access between multiple new instances."]
1062 #[doc = r""]
1063 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1064 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1065 #[doc = r" no stolen instances are passed to such software."]
1066 pub unsafe fn steal() -> Self {
1067 Self {
1068 _marker: PhantomData,
1069 }
1070 }
1071}
1072impl Deref for TIM17 {
1073 type Target = tim16::RegisterBlock;
1074 #[inline(always)]
1075 fn deref(&self) -> &Self::Target {
1076 unsafe { &*Self::PTR }
1077 }
1078}
1079impl core::fmt::Debug for TIM17 {
1080 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1081 f.debug_struct("TIM17").finish()
1082 }
1083}
1084#[doc = "General purpose timer"]
1085pub use self::tim16 as tim17;
1086#[doc = "System configuration controller"]
1087pub struct SYSCFG {
1088 _marker: PhantomData<*const ()>,
1089}
1090unsafe impl Send for SYSCFG {}
1091impl SYSCFG {
1092 #[doc = r"Pointer to the register block"]
1093 pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
1094 #[doc = r"Return the pointer to the register block"]
1095 #[inline(always)]
1096 pub const fn ptr() -> *const syscfg::RegisterBlock {
1097 Self::PTR
1098 }
1099 #[doc = r" Steal an instance of this peripheral"]
1100 #[doc = r""]
1101 #[doc = r" # Safety"]
1102 #[doc = r""]
1103 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1104 #[doc = r" that may race with any existing instances, for example by only"]
1105 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1106 #[doc = r" original peripheral and using critical sections to coordinate"]
1107 #[doc = r" access between multiple new instances."]
1108 #[doc = r""]
1109 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1110 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1111 #[doc = r" no stolen instances are passed to such software."]
1112 pub unsafe fn steal() -> Self {
1113 Self {
1114 _marker: PhantomData,
1115 }
1116 }
1117}
1118impl Deref for SYSCFG {
1119 type Target = syscfg::RegisterBlock;
1120 #[inline(always)]
1121 fn deref(&self) -> &Self::Target {
1122 unsafe { &*Self::PTR }
1123 }
1124}
1125impl core::fmt::Debug for SYSCFG {
1126 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1127 f.debug_struct("SYSCFG").finish()
1128 }
1129}
1130#[doc = "System configuration controller"]
1131pub mod syscfg;
1132#[doc = "Direct memory access"]
1133pub struct DMA {
1134 _marker: PhantomData<*const ()>,
1135}
1136unsafe impl Send for DMA {}
1137impl DMA {
1138 #[doc = r"Pointer to the register block"]
1139 pub const PTR: *const dma::RegisterBlock = 0x4002_0000 as *const _;
1140 #[doc = r"Return the pointer to the register block"]
1141 #[inline(always)]
1142 pub const fn ptr() -> *const dma::RegisterBlock {
1143 Self::PTR
1144 }
1145 #[doc = r" Steal an instance of this peripheral"]
1146 #[doc = r""]
1147 #[doc = r" # Safety"]
1148 #[doc = r""]
1149 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1150 #[doc = r" that may race with any existing instances, for example by only"]
1151 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1152 #[doc = r" original peripheral and using critical sections to coordinate"]
1153 #[doc = r" access between multiple new instances."]
1154 #[doc = r""]
1155 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1156 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1157 #[doc = r" no stolen instances are passed to such software."]
1158 pub unsafe fn steal() -> Self {
1159 Self {
1160 _marker: PhantomData,
1161 }
1162 }
1163}
1164impl Deref for DMA {
1165 type Target = dma::RegisterBlock;
1166 #[inline(always)]
1167 fn deref(&self) -> &Self::Target {
1168 unsafe { &*Self::PTR }
1169 }
1170}
1171impl core::fmt::Debug for DMA {
1172 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1173 f.debug_struct("DMA").finish()
1174 }
1175}
1176#[doc = "Direct memory access"]
1177pub mod dma;
1178#[doc = "Flash"]
1179pub struct FLASH {
1180 _marker: PhantomData<*const ()>,
1181}
1182unsafe impl Send for FLASH {}
1183impl FLASH {
1184 #[doc = r"Pointer to the register block"]
1185 pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
1186 #[doc = r"Return the pointer to the register block"]
1187 #[inline(always)]
1188 pub const fn ptr() -> *const flash::RegisterBlock {
1189 Self::PTR
1190 }
1191 #[doc = r" Steal an instance of this peripheral"]
1192 #[doc = r""]
1193 #[doc = r" # Safety"]
1194 #[doc = r""]
1195 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1196 #[doc = r" that may race with any existing instances, for example by only"]
1197 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1198 #[doc = r" original peripheral and using critical sections to coordinate"]
1199 #[doc = r" access between multiple new instances."]
1200 #[doc = r""]
1201 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1202 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1203 #[doc = r" no stolen instances are passed to such software."]
1204 pub unsafe fn steal() -> Self {
1205 Self {
1206 _marker: PhantomData,
1207 }
1208 }
1209}
1210impl Deref for FLASH {
1211 type Target = flash::RegisterBlock;
1212 #[inline(always)]
1213 fn deref(&self) -> &Self::Target {
1214 unsafe { &*Self::PTR }
1215 }
1216}
1217impl core::fmt::Debug for FLASH {
1218 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1219 f.debug_struct("FLASH").finish()
1220 }
1221}
1222#[doc = "Flash"]
1223pub mod flash;
1224#[doc = "CRC calculation unit"]
1225pub struct CRC {
1226 _marker: PhantomData<*const ()>,
1227}
1228unsafe impl Send for CRC {}
1229impl CRC {
1230 #[doc = r"Pointer to the register block"]
1231 pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
1232 #[doc = r"Return the pointer to the register block"]
1233 #[inline(always)]
1234 pub const fn ptr() -> *const crc::RegisterBlock {
1235 Self::PTR
1236 }
1237 #[doc = r" Steal an instance of this peripheral"]
1238 #[doc = r""]
1239 #[doc = r" # Safety"]
1240 #[doc = r""]
1241 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1242 #[doc = r" that may race with any existing instances, for example by only"]
1243 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1244 #[doc = r" original peripheral and using critical sections to coordinate"]
1245 #[doc = r" access between multiple new instances."]
1246 #[doc = r""]
1247 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1248 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1249 #[doc = r" no stolen instances are passed to such software."]
1250 pub unsafe fn steal() -> Self {
1251 Self {
1252 _marker: PhantomData,
1253 }
1254 }
1255}
1256impl Deref for CRC {
1257 type Target = crc::RegisterBlock;
1258 #[inline(always)]
1259 fn deref(&self) -> &Self::Target {
1260 unsafe { &*Self::PTR }
1261 }
1262}
1263impl core::fmt::Debug for CRC {
1264 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1265 f.debug_struct("CRC").finish()
1266 }
1267}
1268#[doc = "CRC calculation unit"]
1269pub mod crc;
1270#[doc = "Serial peripheral interface"]
1271pub struct SPI1 {
1272 _marker: PhantomData<*const ()>,
1273}
1274unsafe impl Send for SPI1 {}
1275impl SPI1 {
1276 #[doc = r"Pointer to the register block"]
1277 pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
1278 #[doc = r"Return the pointer to the register block"]
1279 #[inline(always)]
1280 pub const fn ptr() -> *const spi1::RegisterBlock {
1281 Self::PTR
1282 }
1283 #[doc = r" Steal an instance of this peripheral"]
1284 #[doc = r""]
1285 #[doc = r" # Safety"]
1286 #[doc = r""]
1287 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1288 #[doc = r" that may race with any existing instances, for example by only"]
1289 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1290 #[doc = r" original peripheral and using critical sections to coordinate"]
1291 #[doc = r" access between multiple new instances."]
1292 #[doc = r""]
1293 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1294 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1295 #[doc = r" no stolen instances are passed to such software."]
1296 pub unsafe fn steal() -> Self {
1297 Self {
1298 _marker: PhantomData,
1299 }
1300 }
1301}
1302impl Deref for SPI1 {
1303 type Target = spi1::RegisterBlock;
1304 #[inline(always)]
1305 fn deref(&self) -> &Self::Target {
1306 unsafe { &*Self::PTR }
1307 }
1308}
1309impl core::fmt::Debug for SPI1 {
1310 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1311 f.debug_struct("SPI1").finish()
1312 }
1313}
1314#[doc = "Serial peripheral interface"]
1315pub mod spi1;
1316#[doc = "Serial peripheral interface"]
1317pub struct SPI2 {
1318 _marker: PhantomData<*const ()>,
1319}
1320unsafe impl Send for SPI2 {}
1321impl SPI2 {
1322 #[doc = r"Pointer to the register block"]
1323 pub const PTR: *const spi1::RegisterBlock = 0x4000_3800 as *const _;
1324 #[doc = r"Return the pointer to the register block"]
1325 #[inline(always)]
1326 pub const fn ptr() -> *const spi1::RegisterBlock {
1327 Self::PTR
1328 }
1329 #[doc = r" Steal an instance of this peripheral"]
1330 #[doc = r""]
1331 #[doc = r" # Safety"]
1332 #[doc = r""]
1333 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1334 #[doc = r" that may race with any existing instances, for example by only"]
1335 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1336 #[doc = r" original peripheral and using critical sections to coordinate"]
1337 #[doc = r" access between multiple new instances."]
1338 #[doc = r""]
1339 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1340 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1341 #[doc = r" no stolen instances are passed to such software."]
1342 pub unsafe fn steal() -> Self {
1343 Self {
1344 _marker: PhantomData,
1345 }
1346 }
1347}
1348impl Deref for SPI2 {
1349 type Target = spi1::RegisterBlock;
1350 #[inline(always)]
1351 fn deref(&self) -> &Self::Target {
1352 unsafe { &*Self::PTR }
1353 }
1354}
1355impl core::fmt::Debug for SPI2 {
1356 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1357 f.debug_struct("SPI2").finish()
1358 }
1359}
1360#[doc = "Serial peripheral interface"]
1361pub use self::spi1 as spi2;
1362#[doc = "Inter integrated circuit"]
1363pub struct I2C {
1364 _marker: PhantomData<*const ()>,
1365}
1366unsafe impl Send for I2C {}
1367impl I2C {
1368 #[doc = r"Pointer to the register block"]
1369 pub const PTR: *const i2c::RegisterBlock = 0x4000_5400 as *const _;
1370 #[doc = r"Return the pointer to the register block"]
1371 #[inline(always)]
1372 pub const fn ptr() -> *const i2c::RegisterBlock {
1373 Self::PTR
1374 }
1375 #[doc = r" Steal an instance of this peripheral"]
1376 #[doc = r""]
1377 #[doc = r" # Safety"]
1378 #[doc = r""]
1379 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1380 #[doc = r" that may race with any existing instances, for example by only"]
1381 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1382 #[doc = r" original peripheral and using critical sections to coordinate"]
1383 #[doc = r" access between multiple new instances."]
1384 #[doc = r""]
1385 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1386 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1387 #[doc = r" no stolen instances are passed to such software."]
1388 pub unsafe fn steal() -> Self {
1389 Self {
1390 _marker: PhantomData,
1391 }
1392 }
1393}
1394impl Deref for I2C {
1395 type Target = i2c::RegisterBlock;
1396 #[inline(always)]
1397 fn deref(&self) -> &Self::Target {
1398 unsafe { &*Self::PTR }
1399 }
1400}
1401impl core::fmt::Debug for I2C {
1402 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1403 f.debug_struct("I2C").finish()
1404 }
1405}
1406#[doc = "Inter integrated circuit"]
1407pub mod i2c;
1408#[doc = "LED CONTROLLER"]
1409pub struct LED {
1410 _marker: PhantomData<*const ()>,
1411}
1412unsafe impl Send for LED {}
1413impl LED {
1414 #[doc = r"Pointer to the register block"]
1415 pub const PTR: *const led::RegisterBlock = 0x4000_2400 as *const _;
1416 #[doc = r"Return the pointer to the register block"]
1417 #[inline(always)]
1418 pub const fn ptr() -> *const led::RegisterBlock {
1419 Self::PTR
1420 }
1421 #[doc = r" Steal an instance of this peripheral"]
1422 #[doc = r""]
1423 #[doc = r" # Safety"]
1424 #[doc = r""]
1425 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1426 #[doc = r" that may race with any existing instances, for example by only"]
1427 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1428 #[doc = r" original peripheral and using critical sections to coordinate"]
1429 #[doc = r" access between multiple new instances."]
1430 #[doc = r""]
1431 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1432 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1433 #[doc = r" no stolen instances are passed to such software."]
1434 pub unsafe fn steal() -> Self {
1435 Self {
1436 _marker: PhantomData,
1437 }
1438 }
1439}
1440impl Deref for LED {
1441 type Target = led::RegisterBlock;
1442 #[inline(always)]
1443 fn deref(&self) -> &Self::Target {
1444 unsafe { &*Self::PTR }
1445 }
1446}
1447impl core::fmt::Debug for LED {
1448 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1449 f.debug_struct("LED").finish()
1450 }
1451}
1452#[doc = "LED CONTROLLER"]
1453pub mod led;
1454#[doc = "Debug support"]
1455pub struct DBGMCU {
1456 _marker: PhantomData<*const ()>,
1457}
1458unsafe impl Send for DBGMCU {}
1459impl DBGMCU {
1460 #[doc = r"Pointer to the register block"]
1461 pub const PTR: *const dbgmcu::RegisterBlock = 0x4001_5800 as *const _;
1462 #[doc = r"Return the pointer to the register block"]
1463 #[inline(always)]
1464 pub const fn ptr() -> *const dbgmcu::RegisterBlock {
1465 Self::PTR
1466 }
1467 #[doc = r" Steal an instance of this peripheral"]
1468 #[doc = r""]
1469 #[doc = r" # Safety"]
1470 #[doc = r""]
1471 #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1472 #[doc = r" that may race with any existing instances, for example by only"]
1473 #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1474 #[doc = r" original peripheral and using critical sections to coordinate"]
1475 #[doc = r" access between multiple new instances."]
1476 #[doc = r""]
1477 #[doc = r" Additionally, other software such as HALs may rely on only one"]
1478 #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1479 #[doc = r" no stolen instances are passed to such software."]
1480 pub unsafe fn steal() -> Self {
1481 Self {
1482 _marker: PhantomData,
1483 }
1484 }
1485}
1486impl Deref for DBGMCU {
1487 type Target = dbgmcu::RegisterBlock;
1488 #[inline(always)]
1489 fn deref(&self) -> &Self::Target {
1490 unsafe { &*Self::PTR }
1491 }
1492}
1493impl core::fmt::Debug for DBGMCU {
1494 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1495 f.debug_struct("DBGMCU").finish()
1496 }
1497}
1498#[doc = "Debug support"]
1499pub mod dbgmcu;
1500#[no_mangle]
1501static mut DEVICE_PERIPHERALS: bool = false;
1502#[doc = r" All the peripherals."]
1503#[allow(non_snake_case)]
1504pub struct Peripherals {
1505 #[doc = "ADC"]
1506 pub ADC: ADC,
1507 #[doc = "COMP1"]
1508 pub COMP1: COMP1,
1509 #[doc = "COMP2"]
1510 pub COMP2: COMP2,
1511 #[doc = "RCC"]
1512 pub RCC: RCC,
1513 #[doc = "PWR"]
1514 pub PWR: PWR,
1515 #[doc = "GPIOA"]
1516 pub GPIOA: GPIOA,
1517 #[doc = "GPIOB"]
1518 pub GPIOB: GPIOB,
1519 #[doc = "GPIOF"]
1520 pub GPIOF: GPIOF,
1521 #[doc = "EXTI"]
1522 pub EXTI: EXTI,
1523 #[doc = "LPTIM"]
1524 pub LPTIM: LPTIM,
1525 #[doc = "USART1"]
1526 pub USART1: USART1,
1527 #[doc = "USART2"]
1528 pub USART2: USART2,
1529 #[doc = "RTC"]
1530 pub RTC: RTC,
1531 #[doc = "IWDG"]
1532 pub IWDG: IWDG,
1533 #[doc = "WWDG"]
1534 pub WWDG: WWDG,
1535 #[doc = "TIM1"]
1536 pub TIM1: TIM1,
1537 #[doc = "TIM3"]
1538 pub TIM3: TIM3,
1539 #[doc = "TIM14"]
1540 pub TIM14: TIM14,
1541 #[doc = "TIM16"]
1542 pub TIM16: TIM16,
1543 #[doc = "TIM17"]
1544 pub TIM17: TIM17,
1545 #[doc = "SYSCFG"]
1546 pub SYSCFG: SYSCFG,
1547 #[doc = "DMA"]
1548 pub DMA: DMA,
1549 #[doc = "FLASH"]
1550 pub FLASH: FLASH,
1551 #[doc = "CRC"]
1552 pub CRC: CRC,
1553 #[doc = "SPI1"]
1554 pub SPI1: SPI1,
1555 #[doc = "SPI2"]
1556 pub SPI2: SPI2,
1557 #[doc = "I2C"]
1558 pub I2C: I2C,
1559 #[doc = "LED"]
1560 pub LED: LED,
1561 #[doc = "DBGMCU"]
1562 pub DBGMCU: DBGMCU,
1563}
1564impl Peripherals {
1565 #[doc = r" Returns all the peripherals *once*."]
1566 #[cfg(feature = "critical-section")]
1567 #[inline]
1568 pub fn take() -> Option<Self> {
1569 critical_section::with(|_| {
1570 if unsafe { DEVICE_PERIPHERALS } {
1571 return None;
1572 }
1573 Some(unsafe { Peripherals::steal() })
1574 })
1575 }
1576 #[doc = r" Unchecked version of `Peripherals::take`."]
1577 #[doc = r""]
1578 #[doc = r" # Safety"]
1579 #[doc = r""]
1580 #[doc = r" Each of the returned peripherals must be used at most once."]
1581 #[inline]
1582 pub unsafe fn steal() -> Self {
1583 DEVICE_PERIPHERALS = true;
1584 Peripherals {
1585 ADC: ADC {
1586 _marker: PhantomData,
1587 },
1588 COMP1: COMP1 {
1589 _marker: PhantomData,
1590 },
1591 COMP2: COMP2 {
1592 _marker: PhantomData,
1593 },
1594 RCC: RCC {
1595 _marker: PhantomData,
1596 },
1597 PWR: PWR {
1598 _marker: PhantomData,
1599 },
1600 GPIOA: GPIOA {
1601 _marker: PhantomData,
1602 },
1603 GPIOB: GPIOB {
1604 _marker: PhantomData,
1605 },
1606 GPIOF: GPIOF {
1607 _marker: PhantomData,
1608 },
1609 EXTI: EXTI {
1610 _marker: PhantomData,
1611 },
1612 LPTIM: LPTIM {
1613 _marker: PhantomData,
1614 },
1615 USART1: USART1 {
1616 _marker: PhantomData,
1617 },
1618 USART2: USART2 {
1619 _marker: PhantomData,
1620 },
1621 RTC: RTC {
1622 _marker: PhantomData,
1623 },
1624 IWDG: IWDG {
1625 _marker: PhantomData,
1626 },
1627 WWDG: WWDG {
1628 _marker: PhantomData,
1629 },
1630 TIM1: TIM1 {
1631 _marker: PhantomData,
1632 },
1633 TIM3: TIM3 {
1634 _marker: PhantomData,
1635 },
1636 TIM14: TIM14 {
1637 _marker: PhantomData,
1638 },
1639 TIM16: TIM16 {
1640 _marker: PhantomData,
1641 },
1642 TIM17: TIM17 {
1643 _marker: PhantomData,
1644 },
1645 SYSCFG: SYSCFG {
1646 _marker: PhantomData,
1647 },
1648 DMA: DMA {
1649 _marker: PhantomData,
1650 },
1651 FLASH: FLASH {
1652 _marker: PhantomData,
1653 },
1654 CRC: CRC {
1655 _marker: PhantomData,
1656 },
1657 SPI1: SPI1 {
1658 _marker: PhantomData,
1659 },
1660 SPI2: SPI2 {
1661 _marker: PhantomData,
1662 },
1663 I2C: I2C {
1664 _marker: PhantomData,
1665 },
1666 LED: LED {
1667 _marker: PhantomData,
1668 },
1669 DBGMCU: DBGMCU {
1670 _marker: PhantomData,
1671 },
1672 }
1673 }
1674}