stm32f3_staging/stm32f302/mod.rs
1/*!Peripheral access API for STM32F302 microcontrollers (generated using svd2rust v0.35.0 (c94dc77 2025-01-15))
2
3You can find an overview of the generated API [here].
4
5API features to be included in the [next]
6svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.
7
8[here]: https://docs.rs/svd2rust/0.35.0/svd2rust/#peripheral-api
9[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased
10[repository]: https://github.com/rust-embedded/svd2rust*/
11use core::marker::PhantomData;
12use core::ops::Deref;
13///Number available in the NVIC for configuring priority
14pub const NVIC_PRIO_BITS: u8 = 4;
15#[cfg(feature = "rt")]
16pub use self::Interrupt as interrupt;
17pub use cortex_m::peripheral::Peripherals as CorePeripherals;
18pub use cortex_m::peripheral::{
19 CBP, CPUID, DCB, DWT, FPB, FPU, ITM, MPU, NVIC, SCB, SYST, TPIU,
20};
21#[cfg(feature = "rt")]
22pub use cortex_m_rt::interrupt;
23#[cfg(feature = "rt")]
24extern "C" {
25 fn WWDG();
26 fn PVD();
27 fn TAMP_STAMP();
28 fn RTC_WKUP();
29 fn FLASH();
30 fn RCC();
31 fn EXTI0();
32 fn EXTI1();
33 fn EXTI2_TSC();
34 fn EXTI3();
35 fn EXTI4();
36 fn DMA1_CH1();
37 fn DMA1_CH2();
38 fn DMA1_CH3();
39 fn DMA1_CH4();
40 fn DMA1_CH5();
41 fn DMA1_CH6();
42 fn DMA1_CH7();
43 fn ADC1_2();
44 fn USB_HP_CAN_TX();
45 fn USB_LP_CAN_RX0();
46 fn CAN_RX1();
47 fn CAN_SCE();
48 fn EXTI9_5();
49 fn TIM1_BRK_TIM15();
50 fn TIM1_UP_TIM16();
51 fn TIM1_TRG_COM_TIM17();
52 fn TIM1_CC();
53 fn TIM2();
54 fn TIM3();
55 fn TIM4();
56 fn I2C1_EV_EXTI23();
57 fn I2C1_ER();
58 fn I2C2_EV_EXTI24();
59 fn I2C2_ER();
60 fn SPI1();
61 fn SPI2();
62 fn USART1_EXTI25();
63 fn USART2_EXTI26();
64 fn USART3_EXTI28();
65 fn EXTI15_10();
66 fn RTCALARM();
67 fn USB_WKUP();
68 fn TIM8_BRK();
69 fn TIM8_UP();
70 fn TIM8_TRG_COM();
71 fn TIM8_CC();
72 fn FMC();
73 fn SPI3();
74 fn UART4_EXTI34();
75 fn UART5_EXTI35();
76 fn TIM6_DACUNDER();
77 fn TIM7();
78 fn DMA2_CH1();
79 fn DMA2_CH2();
80 fn DMA2_CH3();
81 fn DMA2_CH4();
82 fn DMA2_CH5();
83 fn COMP1_2_3();
84 fn COMP4_5_6();
85 fn USB_HP();
86 fn USB_LP();
87 fn USB_WKUP_EXTI();
88 fn FPU();
89}
90#[doc(hidden)]
91#[repr(C)]
92pub union Vector {
93 _handler: unsafe extern "C" fn(),
94 _reserved: u32,
95}
96#[cfg(feature = "rt")]
97#[doc(hidden)]
98#[link_section = ".vector_table.interrupts"]
99#[no_mangle]
100pub static __INTERRUPTS: [Vector; 82] = [
101 Vector { _handler: WWDG },
102 Vector { _handler: PVD },
103 Vector { _handler: TAMP_STAMP },
104 Vector { _handler: RTC_WKUP },
105 Vector { _handler: FLASH },
106 Vector { _handler: RCC },
107 Vector { _handler: EXTI0 },
108 Vector { _handler: EXTI1 },
109 Vector { _handler: EXTI2_TSC },
110 Vector { _handler: EXTI3 },
111 Vector { _handler: EXTI4 },
112 Vector { _handler: DMA1_CH1 },
113 Vector { _handler: DMA1_CH2 },
114 Vector { _handler: DMA1_CH3 },
115 Vector { _handler: DMA1_CH4 },
116 Vector { _handler: DMA1_CH5 },
117 Vector { _handler: DMA1_CH6 },
118 Vector { _handler: DMA1_CH7 },
119 Vector { _handler: ADC1_2 },
120 Vector { _handler: USB_HP_CAN_TX },
121 Vector { _handler: USB_LP_CAN_RX0 },
122 Vector { _handler: CAN_RX1 },
123 Vector { _handler: CAN_SCE },
124 Vector { _handler: EXTI9_5 },
125 Vector { _handler: TIM1_BRK_TIM15 },
126 Vector { _handler: TIM1_UP_TIM16 },
127 Vector {
128 _handler: TIM1_TRG_COM_TIM17,
129 },
130 Vector { _handler: TIM1_CC },
131 Vector { _handler: TIM2 },
132 Vector { _handler: TIM3 },
133 Vector { _handler: TIM4 },
134 Vector { _handler: I2C1_EV_EXTI23 },
135 Vector { _handler: I2C1_ER },
136 Vector { _handler: I2C2_EV_EXTI24 },
137 Vector { _handler: I2C2_ER },
138 Vector { _handler: SPI1 },
139 Vector { _handler: SPI2 },
140 Vector { _handler: USART1_EXTI25 },
141 Vector { _handler: USART2_EXTI26 },
142 Vector { _handler: USART3_EXTI28 },
143 Vector { _handler: EXTI15_10 },
144 Vector { _handler: RTCALARM },
145 Vector { _handler: USB_WKUP },
146 Vector { _handler: TIM8_BRK },
147 Vector { _handler: TIM8_UP },
148 Vector { _handler: TIM8_TRG_COM },
149 Vector { _handler: TIM8_CC },
150 Vector { _reserved: 0 },
151 Vector { _handler: FMC },
152 Vector { _reserved: 0 },
153 Vector { _reserved: 0 },
154 Vector { _handler: SPI3 },
155 Vector { _handler: UART4_EXTI34 },
156 Vector { _handler: UART5_EXTI35 },
157 Vector { _handler: TIM6_DACUNDER },
158 Vector { _handler: TIM7 },
159 Vector { _handler: DMA2_CH1 },
160 Vector { _handler: DMA2_CH2 },
161 Vector { _handler: DMA2_CH3 },
162 Vector { _handler: DMA2_CH4 },
163 Vector { _handler: DMA2_CH5 },
164 Vector { _reserved: 0 },
165 Vector { _reserved: 0 },
166 Vector { _reserved: 0 },
167 Vector { _handler: COMP1_2_3 },
168 Vector { _handler: COMP4_5_6 },
169 Vector { _reserved: 0 },
170 Vector { _reserved: 0 },
171 Vector { _reserved: 0 },
172 Vector { _reserved: 0 },
173 Vector { _reserved: 0 },
174 Vector { _reserved: 0 },
175 Vector { _reserved: 0 },
176 Vector { _reserved: 0 },
177 Vector { _handler: USB_HP },
178 Vector { _handler: USB_LP },
179 Vector { _handler: USB_WKUP_EXTI },
180 Vector { _reserved: 0 },
181 Vector { _reserved: 0 },
182 Vector { _reserved: 0 },
183 Vector { _reserved: 0 },
184 Vector { _handler: FPU },
185];
186///Enumeration of all the interrupts.
187#[cfg_attr(feature = "defmt", derive(defmt::Format))]
188#[derive(Copy, Clone, Debug, PartialEq, Eq)]
189#[repr(u16)]
190pub enum Interrupt {
191 ///0 - Window Watchdog interrupt
192 WWDG = 0,
193 ///1 - PVD through EXTI line detection interrupt
194 PVD = 1,
195 ///2 - Tamper and TimeStamp interrupts
196 TAMP_STAMP = 2,
197 ///3 - RTC Wakeup interrupt through the EXTI line
198 RTC_WKUP = 3,
199 ///4 - Flash global interrupt
200 FLASH = 4,
201 ///5 - RCC global interrupt
202 RCC = 5,
203 ///6 - EXTI Line0 interrupt
204 EXTI0 = 6,
205 ///7 - EXTI Line3 interrupt
206 EXTI1 = 7,
207 ///8 - EXTI Line2 and Touch sensing interrupts
208 EXTI2_TSC = 8,
209 ///9 - EXTI Line3 interrupt
210 EXTI3 = 9,
211 ///10 - EXTI Line4 interrupt
212 EXTI4 = 10,
213 ///11 - DMA1 channel 1 interrupt
214 DMA1_CH1 = 11,
215 ///12 - DMA1 channel 2 interrupt
216 DMA1_CH2 = 12,
217 ///13 - DMA1 channel 3 interrupt
218 DMA1_CH3 = 13,
219 ///14 - DMA1 channel 4 interrupt
220 DMA1_CH4 = 14,
221 ///15 - DMA1 channel 5 interrupt
222 DMA1_CH5 = 15,
223 ///16 - DMA1 channel 6 interrupt
224 DMA1_CH6 = 16,
225 ///17 - DMA1 channel 7interrupt
226 DMA1_CH7 = 17,
227 ///18 - ADC1 and ADC2 global interrupt
228 ADC1_2 = 18,
229 ///19 - USB High Priority/CAN_TX interrupts
230 USB_HP_CAN_TX = 19,
231 ///20 - USB Low Priority/CAN_RX0 interrupts
232 USB_LP_CAN_RX0 = 20,
233 ///21 - CAN_RX1 interrupt
234 CAN_RX1 = 21,
235 ///22 - CAN_SCE interrupt
236 CAN_SCE = 22,
237 ///23 - EXTI Line5 to Line9 interrupts
238 EXTI9_5 = 23,
239 ///24 - TIM1 Break/TIM15 global interruts
240 TIM1_BRK_TIM15 = 24,
241 ///25 - TIM1 Update/TIM16 global interrupts
242 TIM1_UP_TIM16 = 25,
243 ///26 - TIM1 trigger and commutation/TIM17 interrupts
244 TIM1_TRG_COM_TIM17 = 26,
245 ///27 - TIM1 capture compare interrupt
246 TIM1_CC = 27,
247 ///28 - TIM2 global interrupt
248 TIM2 = 28,
249 ///29 - TIM3 global interrupt
250 TIM3 = 29,
251 ///30 - TIM4 global interrupt
252 TIM4 = 30,
253 ///31 - I2C1 event interrupt and EXTI Line23 interrupt
254 I2C1_EV_EXTI23 = 31,
255 ///32 - I2C1 error interrupt
256 I2C1_ER = 32,
257 ///33 - I2C2 event interrupt & EXTI Line24 interrupt
258 I2C2_EV_EXTI24 = 33,
259 ///34 - I2C2 error interrupt
260 I2C2_ER = 34,
261 ///35 - SPI1 global interrupt
262 SPI1 = 35,
263 ///36 - SPI2 global interrupt
264 SPI2 = 36,
265 ///37 - USART1 global interrupt and EXTI Line 25 interrupt
266 USART1_EXTI25 = 37,
267 ///38 - USART2 global interrupt and EXTI Line 26 interrupt
268 USART2_EXTI26 = 38,
269 ///39 - USART3 global interrupt and EXTI Line 28 interrupt
270 USART3_EXTI28 = 39,
271 ///40 - EXTI Line15 to Line10 interrupts
272 EXTI15_10 = 40,
273 ///41 - RTC alarm interrupt
274 RTCALARM = 41,
275 ///42 - USB wakeup from Suspend
276 USB_WKUP = 42,
277 ///43 - TIM8 break interrupt
278 TIM8_BRK = 43,
279 ///44 - TIM8 update interrupt
280 TIM8_UP = 44,
281 ///45 - TIM8 Trigger and commutation interrupts
282 TIM8_TRG_COM = 45,
283 ///46 - TIM8 capture compare interrupt
284 TIM8_CC = 46,
285 ///48 - FSMC global interrupt
286 FMC = 48,
287 ///51 - SPI3 global interrupt
288 SPI3 = 51,
289 ///52 - UART4 global and EXTI Line 34 interrupts
290 UART4_EXTI34 = 52,
291 ///53 - UART5 global and EXTI Line 35 interrupts
292 UART5_EXTI35 = 53,
293 ///54 - TIM6 global and DAC12 underrun interrupts
294 TIM6_DACUNDER = 54,
295 ///55 - TIM7 global interrupt
296 TIM7 = 55,
297 ///56 - DMA2 channel1 global interrupt
298 DMA2_CH1 = 56,
299 ///57 - DMA2 channel2 global interrupt
300 DMA2_CH2 = 57,
301 ///58 - DMA2 channel3 global interrupt
302 DMA2_CH3 = 58,
303 ///59 - DMA2 channel4 global interrupt
304 DMA2_CH4 = 59,
305 ///60 - DMA2 channel5 global interrupt
306 DMA2_CH5 = 60,
307 ///64 - COMP1_2_3 interrupt combined with EXTI lines 21, 22, 29
308 COMP1_2_3 = 64,
309 ///65 - COMP4_5_6 interrupt combined with EXTI lines 30, 31, 32
310 COMP4_5_6 = 65,
311 ///74 - USB High priority interrupt
312 USB_HP = 74,
313 ///75 - USB Low priority interrupt
314 USB_LP = 75,
315 ///76 - USB wakeup from Suspend and EXTI Line 18
316 USB_WKUP_EXTI = 76,
317 ///81 - Floating point unit interrupt
318 FPU = 81,
319}
320unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
321 #[inline(always)]
322 fn number(self) -> u16 {
323 self as u16
324 }
325}
326///General-purpose I/Os
327///
328///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOA)
329pub struct GPIOA {
330 _marker: PhantomData<*const ()>,
331}
332unsafe impl Send for GPIOA {}
333impl GPIOA {
334 ///Pointer to the register block
335 pub const PTR: *const gpioa::RegisterBlock = 0x4800_0000 as *const _;
336 ///Return the pointer to the register block
337 #[inline(always)]
338 pub const fn ptr() -> *const gpioa::RegisterBlock {
339 Self::PTR
340 }
341 /// Steal an instance of this peripheral
342 ///
343 /// # Safety
344 ///
345 /// Ensure that the new instance of the peripheral cannot be used in a way
346 /// that may race with any existing instances, for example by only
347 /// accessing read-only or write-only registers, or by consuming the
348 /// original peripheral and using critical sections to coordinate
349 /// access between multiple new instances.
350 ///
351 /// Additionally, other software such as HALs may rely on only one
352 /// peripheral instance existing to ensure memory safety; ensure
353 /// no stolen instances are passed to such software.
354 pub unsafe fn steal() -> Self {
355 Self { _marker: PhantomData }
356 }
357}
358impl Deref for GPIOA {
359 type Target = gpioa::RegisterBlock;
360 #[inline(always)]
361 fn deref(&self) -> &Self::Target {
362 unsafe { &*Self::PTR }
363 }
364}
365impl core::fmt::Debug for GPIOA {
366 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
367 f.debug_struct("GPIOA").finish()
368 }
369}
370///General-purpose I/Os
371pub mod gpioa;
372///General-purpose I/Os
373///
374///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOB)
375pub struct GPIOB {
376 _marker: PhantomData<*const ()>,
377}
378unsafe impl Send for GPIOB {}
379impl GPIOB {
380 ///Pointer to the register block
381 pub const PTR: *const gpiob::RegisterBlock = 0x4800_0400 as *const _;
382 ///Return the pointer to the register block
383 #[inline(always)]
384 pub const fn ptr() -> *const gpiob::RegisterBlock {
385 Self::PTR
386 }
387 /// Steal an instance of this peripheral
388 ///
389 /// # Safety
390 ///
391 /// Ensure that the new instance of the peripheral cannot be used in a way
392 /// that may race with any existing instances, for example by only
393 /// accessing read-only or write-only registers, or by consuming the
394 /// original peripheral and using critical sections to coordinate
395 /// access between multiple new instances.
396 ///
397 /// Additionally, other software such as HALs may rely on only one
398 /// peripheral instance existing to ensure memory safety; ensure
399 /// no stolen instances are passed to such software.
400 pub unsafe fn steal() -> Self {
401 Self { _marker: PhantomData }
402 }
403}
404impl Deref for GPIOB {
405 type Target = gpiob::RegisterBlock;
406 #[inline(always)]
407 fn deref(&self) -> &Self::Target {
408 unsafe { &*Self::PTR }
409 }
410}
411impl core::fmt::Debug for GPIOB {
412 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
413 f.debug_struct("GPIOB").finish()
414 }
415}
416///General-purpose I/Os
417pub mod gpiob;
418///General-purpose I/Os
419///
420///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOC)
421pub struct GPIOC {
422 _marker: PhantomData<*const ()>,
423}
424unsafe impl Send for GPIOC {}
425impl GPIOC {
426 ///Pointer to the register block
427 pub const PTR: *const gpioc::RegisterBlock = 0x4800_0800 as *const _;
428 ///Return the pointer to the register block
429 #[inline(always)]
430 pub const fn ptr() -> *const gpioc::RegisterBlock {
431 Self::PTR
432 }
433 /// Steal an instance of this peripheral
434 ///
435 /// # Safety
436 ///
437 /// Ensure that the new instance of the peripheral cannot be used in a way
438 /// that may race with any existing instances, for example by only
439 /// accessing read-only or write-only registers, or by consuming the
440 /// original peripheral and using critical sections to coordinate
441 /// access between multiple new instances.
442 ///
443 /// Additionally, other software such as HALs may rely on only one
444 /// peripheral instance existing to ensure memory safety; ensure
445 /// no stolen instances are passed to such software.
446 pub unsafe fn steal() -> Self {
447 Self { _marker: PhantomData }
448 }
449}
450impl Deref for GPIOC {
451 type Target = gpioc::RegisterBlock;
452 #[inline(always)]
453 fn deref(&self) -> &Self::Target {
454 unsafe { &*Self::PTR }
455 }
456}
457impl core::fmt::Debug for GPIOC {
458 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
459 f.debug_struct("GPIOC").finish()
460 }
461}
462///General-purpose I/Os
463pub mod gpioc;
464///General-purpose I/Os
465///
466///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOC)
467pub struct GPIOD {
468 _marker: PhantomData<*const ()>,
469}
470unsafe impl Send for GPIOD {}
471impl GPIOD {
472 ///Pointer to the register block
473 pub const PTR: *const gpioc::RegisterBlock = 0x4800_0c00 as *const _;
474 ///Return the pointer to the register block
475 #[inline(always)]
476 pub const fn ptr() -> *const gpioc::RegisterBlock {
477 Self::PTR
478 }
479 /// Steal an instance of this peripheral
480 ///
481 /// # Safety
482 ///
483 /// Ensure that the new instance of the peripheral cannot be used in a way
484 /// that may race with any existing instances, for example by only
485 /// accessing read-only or write-only registers, or by consuming the
486 /// original peripheral and using critical sections to coordinate
487 /// access between multiple new instances.
488 ///
489 /// Additionally, other software such as HALs may rely on only one
490 /// peripheral instance existing to ensure memory safety; ensure
491 /// no stolen instances are passed to such software.
492 pub unsafe fn steal() -> Self {
493 Self { _marker: PhantomData }
494 }
495}
496impl Deref for GPIOD {
497 type Target = gpioc::RegisterBlock;
498 #[inline(always)]
499 fn deref(&self) -> &Self::Target {
500 unsafe { &*Self::PTR }
501 }
502}
503impl core::fmt::Debug for GPIOD {
504 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
505 f.debug_struct("GPIOD").finish()
506 }
507}
508///General-purpose I/Os
509pub use self::gpioc as gpiod;
510///General-purpose I/Os
511///
512///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOC)
513pub struct GPIOE {
514 _marker: PhantomData<*const ()>,
515}
516unsafe impl Send for GPIOE {}
517impl GPIOE {
518 ///Pointer to the register block
519 pub const PTR: *const gpioc::RegisterBlock = 0x4800_1000 as *const _;
520 ///Return the pointer to the register block
521 #[inline(always)]
522 pub const fn ptr() -> *const gpioc::RegisterBlock {
523 Self::PTR
524 }
525 /// Steal an instance of this peripheral
526 ///
527 /// # Safety
528 ///
529 /// Ensure that the new instance of the peripheral cannot be used in a way
530 /// that may race with any existing instances, for example by only
531 /// accessing read-only or write-only registers, or by consuming the
532 /// original peripheral and using critical sections to coordinate
533 /// access between multiple new instances.
534 ///
535 /// Additionally, other software such as HALs may rely on only one
536 /// peripheral instance existing to ensure memory safety; ensure
537 /// no stolen instances are passed to such software.
538 pub unsafe fn steal() -> Self {
539 Self { _marker: PhantomData }
540 }
541}
542impl Deref for GPIOE {
543 type Target = gpioc::RegisterBlock;
544 #[inline(always)]
545 fn deref(&self) -> &Self::Target {
546 unsafe { &*Self::PTR }
547 }
548}
549impl core::fmt::Debug for GPIOE {
550 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
551 f.debug_struct("GPIOE").finish()
552 }
553}
554///General-purpose I/Os
555pub use self::gpioc as gpioe;
556///General-purpose I/Os
557///
558///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOC)
559pub struct GPIOF {
560 _marker: PhantomData<*const ()>,
561}
562unsafe impl Send for GPIOF {}
563impl GPIOF {
564 ///Pointer to the register block
565 pub const PTR: *const gpioc::RegisterBlock = 0x4800_1400 as *const _;
566 ///Return the pointer to the register block
567 #[inline(always)]
568 pub const fn ptr() -> *const gpioc::RegisterBlock {
569 Self::PTR
570 }
571 /// Steal an instance of this peripheral
572 ///
573 /// # Safety
574 ///
575 /// Ensure that the new instance of the peripheral cannot be used in a way
576 /// that may race with any existing instances, for example by only
577 /// accessing read-only or write-only registers, or by consuming the
578 /// original peripheral and using critical sections to coordinate
579 /// access between multiple new instances.
580 ///
581 /// Additionally, other software such as HALs may rely on only one
582 /// peripheral instance existing to ensure memory safety; ensure
583 /// no stolen instances are passed to such software.
584 pub unsafe fn steal() -> Self {
585 Self { _marker: PhantomData }
586 }
587}
588impl Deref for GPIOF {
589 type Target = gpioc::RegisterBlock;
590 #[inline(always)]
591 fn deref(&self) -> &Self::Target {
592 unsafe { &*Self::PTR }
593 }
594}
595impl core::fmt::Debug for GPIOF {
596 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
597 f.debug_struct("GPIOF").finish()
598 }
599}
600///General-purpose I/Os
601pub use self::gpioc as gpiof;
602///General-purpose I/Os
603///
604///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOC)
605pub struct GPIOG {
606 _marker: PhantomData<*const ()>,
607}
608unsafe impl Send for GPIOG {}
609impl GPIOG {
610 ///Pointer to the register block
611 pub const PTR: *const gpioc::RegisterBlock = 0x4800_1800 as *const _;
612 ///Return the pointer to the register block
613 #[inline(always)]
614 pub const fn ptr() -> *const gpioc::RegisterBlock {
615 Self::PTR
616 }
617 /// Steal an instance of this peripheral
618 ///
619 /// # Safety
620 ///
621 /// Ensure that the new instance of the peripheral cannot be used in a way
622 /// that may race with any existing instances, for example by only
623 /// accessing read-only or write-only registers, or by consuming the
624 /// original peripheral and using critical sections to coordinate
625 /// access between multiple new instances.
626 ///
627 /// Additionally, other software such as HALs may rely on only one
628 /// peripheral instance existing to ensure memory safety; ensure
629 /// no stolen instances are passed to such software.
630 pub unsafe fn steal() -> Self {
631 Self { _marker: PhantomData }
632 }
633}
634impl Deref for GPIOG {
635 type Target = gpioc::RegisterBlock;
636 #[inline(always)]
637 fn deref(&self) -> &Self::Target {
638 unsafe { &*Self::PTR }
639 }
640}
641impl core::fmt::Debug for GPIOG {
642 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
643 f.debug_struct("GPIOG").finish()
644 }
645}
646///General-purpose I/Os
647pub use self::gpioc as gpiog;
648///General-purpose I/Os
649///
650///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#GPIOC)
651pub struct GPIOH {
652 _marker: PhantomData<*const ()>,
653}
654unsafe impl Send for GPIOH {}
655impl GPIOH {
656 ///Pointer to the register block
657 pub const PTR: *const gpioc::RegisterBlock = 0x4800_1c00 as *const _;
658 ///Return the pointer to the register block
659 #[inline(always)]
660 pub const fn ptr() -> *const gpioc::RegisterBlock {
661 Self::PTR
662 }
663 /// Steal an instance of this peripheral
664 ///
665 /// # Safety
666 ///
667 /// Ensure that the new instance of the peripheral cannot be used in a way
668 /// that may race with any existing instances, for example by only
669 /// accessing read-only or write-only registers, or by consuming the
670 /// original peripheral and using critical sections to coordinate
671 /// access between multiple new instances.
672 ///
673 /// Additionally, other software such as HALs may rely on only one
674 /// peripheral instance existing to ensure memory safety; ensure
675 /// no stolen instances are passed to such software.
676 pub unsafe fn steal() -> Self {
677 Self { _marker: PhantomData }
678 }
679}
680impl Deref for GPIOH {
681 type Target = gpioc::RegisterBlock;
682 #[inline(always)]
683 fn deref(&self) -> &Self::Target {
684 unsafe { &*Self::PTR }
685 }
686}
687impl core::fmt::Debug for GPIOH {
688 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
689 f.debug_struct("GPIOH").finish()
690 }
691}
692///General-purpose I/Os
693pub use self::gpioc as gpioh;
694///Touch sensing controller
695///
696///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TSC)
697pub struct TSC {
698 _marker: PhantomData<*const ()>,
699}
700unsafe impl Send for TSC {}
701impl TSC {
702 ///Pointer to the register block
703 pub const PTR: *const tsc::RegisterBlock = 0x4002_4000 as *const _;
704 ///Return the pointer to the register block
705 #[inline(always)]
706 pub const fn ptr() -> *const tsc::RegisterBlock {
707 Self::PTR
708 }
709 /// Steal an instance of this peripheral
710 ///
711 /// # Safety
712 ///
713 /// Ensure that the new instance of the peripheral cannot be used in a way
714 /// that may race with any existing instances, for example by only
715 /// accessing read-only or write-only registers, or by consuming the
716 /// original peripheral and using critical sections to coordinate
717 /// access between multiple new instances.
718 ///
719 /// Additionally, other software such as HALs may rely on only one
720 /// peripheral instance existing to ensure memory safety; ensure
721 /// no stolen instances are passed to such software.
722 pub unsafe fn steal() -> Self {
723 Self { _marker: PhantomData }
724 }
725}
726impl Deref for TSC {
727 type Target = tsc::RegisterBlock;
728 #[inline(always)]
729 fn deref(&self) -> &Self::Target {
730 unsafe { &*Self::PTR }
731 }
732}
733impl core::fmt::Debug for TSC {
734 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
735 f.debug_struct("TSC").finish()
736 }
737}
738///Touch sensing controller
739pub mod tsc;
740///cyclic redundancy check calculation unit
741///
742///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#CRC)
743pub struct CRC {
744 _marker: PhantomData<*const ()>,
745}
746unsafe impl Send for CRC {}
747impl CRC {
748 ///Pointer to the register block
749 pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
750 ///Return the pointer to the register block
751 #[inline(always)]
752 pub const fn ptr() -> *const crc::RegisterBlock {
753 Self::PTR
754 }
755 /// Steal an instance of this peripheral
756 ///
757 /// # Safety
758 ///
759 /// Ensure that the new instance of the peripheral cannot be used in a way
760 /// that may race with any existing instances, for example by only
761 /// accessing read-only or write-only registers, or by consuming the
762 /// original peripheral and using critical sections to coordinate
763 /// access between multiple new instances.
764 ///
765 /// Additionally, other software such as HALs may rely on only one
766 /// peripheral instance existing to ensure memory safety; ensure
767 /// no stolen instances are passed to such software.
768 pub unsafe fn steal() -> Self {
769 Self { _marker: PhantomData }
770 }
771}
772impl Deref for CRC {
773 type Target = crc::RegisterBlock;
774 #[inline(always)]
775 fn deref(&self) -> &Self::Target {
776 unsafe { &*Self::PTR }
777 }
778}
779impl core::fmt::Debug for CRC {
780 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
781 f.debug_struct("CRC").finish()
782 }
783}
784///cyclic redundancy check calculation unit
785pub mod crc;
786///Flash
787///
788///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#FLASH)
789pub struct FLASH {
790 _marker: PhantomData<*const ()>,
791}
792unsafe impl Send for FLASH {}
793impl FLASH {
794 ///Pointer to the register block
795 pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
796 ///Return the pointer to the register block
797 #[inline(always)]
798 pub const fn ptr() -> *const flash::RegisterBlock {
799 Self::PTR
800 }
801 /// Steal an instance of this peripheral
802 ///
803 /// # Safety
804 ///
805 /// Ensure that the new instance of the peripheral cannot be used in a way
806 /// that may race with any existing instances, for example by only
807 /// accessing read-only or write-only registers, or by consuming the
808 /// original peripheral and using critical sections to coordinate
809 /// access between multiple new instances.
810 ///
811 /// Additionally, other software such as HALs may rely on only one
812 /// peripheral instance existing to ensure memory safety; ensure
813 /// no stolen instances are passed to such software.
814 pub unsafe fn steal() -> Self {
815 Self { _marker: PhantomData }
816 }
817}
818impl Deref for FLASH {
819 type Target = flash::RegisterBlock;
820 #[inline(always)]
821 fn deref(&self) -> &Self::Target {
822 unsafe { &*Self::PTR }
823 }
824}
825impl core::fmt::Debug for FLASH {
826 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
827 f.debug_struct("FLASH").finish()
828 }
829}
830///Flash
831pub mod flash;
832///Reset and clock control
833///
834///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#RCC)
835pub struct RCC {
836 _marker: PhantomData<*const ()>,
837}
838unsafe impl Send for RCC {}
839impl RCC {
840 ///Pointer to the register block
841 pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
842 ///Return the pointer to the register block
843 #[inline(always)]
844 pub const fn ptr() -> *const rcc::RegisterBlock {
845 Self::PTR
846 }
847 /// Steal an instance of this peripheral
848 ///
849 /// # Safety
850 ///
851 /// Ensure that the new instance of the peripheral cannot be used in a way
852 /// that may race with any existing instances, for example by only
853 /// accessing read-only or write-only registers, or by consuming the
854 /// original peripheral and using critical sections to coordinate
855 /// access between multiple new instances.
856 ///
857 /// Additionally, other software such as HALs may rely on only one
858 /// peripheral instance existing to ensure memory safety; ensure
859 /// no stolen instances are passed to such software.
860 pub unsafe fn steal() -> Self {
861 Self { _marker: PhantomData }
862 }
863}
864impl Deref for RCC {
865 type Target = rcc::RegisterBlock;
866 #[inline(always)]
867 fn deref(&self) -> &Self::Target {
868 unsafe { &*Self::PTR }
869 }
870}
871impl core::fmt::Debug for RCC {
872 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
873 f.debug_struct("RCC").finish()
874 }
875}
876///Reset and clock control
877pub mod rcc;
878///DMA controller 1
879///
880///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#DMA1)
881pub struct DMA1 {
882 _marker: PhantomData<*const ()>,
883}
884unsafe impl Send for DMA1 {}
885impl DMA1 {
886 ///Pointer to the register block
887 pub const PTR: *const dma1::RegisterBlock = 0x4002_0000 as *const _;
888 ///Return the pointer to the register block
889 #[inline(always)]
890 pub const fn ptr() -> *const dma1::RegisterBlock {
891 Self::PTR
892 }
893 /// Steal an instance of this peripheral
894 ///
895 /// # Safety
896 ///
897 /// Ensure that the new instance of the peripheral cannot be used in a way
898 /// that may race with any existing instances, for example by only
899 /// accessing read-only or write-only registers, or by consuming the
900 /// original peripheral and using critical sections to coordinate
901 /// access between multiple new instances.
902 ///
903 /// Additionally, other software such as HALs may rely on only one
904 /// peripheral instance existing to ensure memory safety; ensure
905 /// no stolen instances are passed to such software.
906 pub unsafe fn steal() -> Self {
907 Self { _marker: PhantomData }
908 }
909}
910impl Deref for DMA1 {
911 type Target = dma1::RegisterBlock;
912 #[inline(always)]
913 fn deref(&self) -> &Self::Target {
914 unsafe { &*Self::PTR }
915 }
916}
917impl core::fmt::Debug for DMA1 {
918 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
919 f.debug_struct("DMA1").finish()
920 }
921}
922///DMA controller 1
923pub mod dma1;
924///DMA controller 1
925///
926///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#DMA1)
927pub struct DMA2 {
928 _marker: PhantomData<*const ()>,
929}
930unsafe impl Send for DMA2 {}
931impl DMA2 {
932 ///Pointer to the register block
933 pub const PTR: *const dma1::RegisterBlock = 0x4002_0400 as *const _;
934 ///Return the pointer to the register block
935 #[inline(always)]
936 pub const fn ptr() -> *const dma1::RegisterBlock {
937 Self::PTR
938 }
939 /// Steal an instance of this peripheral
940 ///
941 /// # Safety
942 ///
943 /// Ensure that the new instance of the peripheral cannot be used in a way
944 /// that may race with any existing instances, for example by only
945 /// accessing read-only or write-only registers, or by consuming the
946 /// original peripheral and using critical sections to coordinate
947 /// access between multiple new instances.
948 ///
949 /// Additionally, other software such as HALs may rely on only one
950 /// peripheral instance existing to ensure memory safety; ensure
951 /// no stolen instances are passed to such software.
952 pub unsafe fn steal() -> Self {
953 Self { _marker: PhantomData }
954 }
955}
956impl Deref for DMA2 {
957 type Target = dma1::RegisterBlock;
958 #[inline(always)]
959 fn deref(&self) -> &Self::Target {
960 unsafe { &*Self::PTR }
961 }
962}
963impl core::fmt::Debug for DMA2 {
964 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
965 f.debug_struct("DMA2").finish()
966 }
967}
968///DMA controller 1
969pub use self::dma1 as dma2;
970///General purpose timer
971///
972///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM2)
973pub struct TIM2 {
974 _marker: PhantomData<*const ()>,
975}
976unsafe impl Send for TIM2 {}
977impl TIM2 {
978 ///Pointer to the register block
979 pub const PTR: *const tim2::RegisterBlock = 0x4000_0000 as *const _;
980 ///Return the pointer to the register block
981 #[inline(always)]
982 pub const fn ptr() -> *const tim2::RegisterBlock {
983 Self::PTR
984 }
985 /// Steal an instance of this peripheral
986 ///
987 /// # Safety
988 ///
989 /// Ensure that the new instance of the peripheral cannot be used in a way
990 /// that may race with any existing instances, for example by only
991 /// accessing read-only or write-only registers, or by consuming the
992 /// original peripheral and using critical sections to coordinate
993 /// access between multiple new instances.
994 ///
995 /// Additionally, other software such as HALs may rely on only one
996 /// peripheral instance existing to ensure memory safety; ensure
997 /// no stolen instances are passed to such software.
998 pub unsafe fn steal() -> Self {
999 Self { _marker: PhantomData }
1000 }
1001}
1002impl Deref for TIM2 {
1003 type Target = tim2::RegisterBlock;
1004 #[inline(always)]
1005 fn deref(&self) -> &Self::Target {
1006 unsafe { &*Self::PTR }
1007 }
1008}
1009impl core::fmt::Debug for TIM2 {
1010 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1011 f.debug_struct("TIM2").finish()
1012 }
1013}
1014///General purpose timer
1015pub mod tim2;
1016///General purpose timer
1017///
1018///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM3)
1019pub struct TIM3 {
1020 _marker: PhantomData<*const ()>,
1021}
1022unsafe impl Send for TIM3 {}
1023impl TIM3 {
1024 ///Pointer to the register block
1025 pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
1026 ///Return the pointer to the register block
1027 #[inline(always)]
1028 pub const fn ptr() -> *const tim3::RegisterBlock {
1029 Self::PTR
1030 }
1031 /// Steal an instance of this peripheral
1032 ///
1033 /// # Safety
1034 ///
1035 /// Ensure that the new instance of the peripheral cannot be used in a way
1036 /// that may race with any existing instances, for example by only
1037 /// accessing read-only or write-only registers, or by consuming the
1038 /// original peripheral and using critical sections to coordinate
1039 /// access between multiple new instances.
1040 ///
1041 /// Additionally, other software such as HALs may rely on only one
1042 /// peripheral instance existing to ensure memory safety; ensure
1043 /// no stolen instances are passed to such software.
1044 pub unsafe fn steal() -> Self {
1045 Self { _marker: PhantomData }
1046 }
1047}
1048impl Deref for TIM3 {
1049 type Target = tim3::RegisterBlock;
1050 #[inline(always)]
1051 fn deref(&self) -> &Self::Target {
1052 unsafe { &*Self::PTR }
1053 }
1054}
1055impl core::fmt::Debug for TIM3 {
1056 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1057 f.debug_struct("TIM3").finish()
1058 }
1059}
1060///General purpose timer
1061pub mod tim3;
1062///General purpose timer
1063///
1064///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM3)
1065pub struct TIM4 {
1066 _marker: PhantomData<*const ()>,
1067}
1068unsafe impl Send for TIM4 {}
1069impl TIM4 {
1070 ///Pointer to the register block
1071 pub const PTR: *const tim3::RegisterBlock = 0x4000_0800 as *const _;
1072 ///Return the pointer to the register block
1073 #[inline(always)]
1074 pub const fn ptr() -> *const tim3::RegisterBlock {
1075 Self::PTR
1076 }
1077 /// Steal an instance of this peripheral
1078 ///
1079 /// # Safety
1080 ///
1081 /// Ensure that the new instance of the peripheral cannot be used in a way
1082 /// that may race with any existing instances, for example by only
1083 /// accessing read-only or write-only registers, or by consuming the
1084 /// original peripheral and using critical sections to coordinate
1085 /// access between multiple new instances.
1086 ///
1087 /// Additionally, other software such as HALs may rely on only one
1088 /// peripheral instance existing to ensure memory safety; ensure
1089 /// no stolen instances are passed to such software.
1090 pub unsafe fn steal() -> Self {
1091 Self { _marker: PhantomData }
1092 }
1093}
1094impl Deref for TIM4 {
1095 type Target = tim3::RegisterBlock;
1096 #[inline(always)]
1097 fn deref(&self) -> &Self::Target {
1098 unsafe { &*Self::PTR }
1099 }
1100}
1101impl core::fmt::Debug for TIM4 {
1102 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1103 f.debug_struct("TIM4").finish()
1104 }
1105}
1106///General purpose timer
1107pub use self::tim3 as tim4;
1108///General purpose timers
1109///
1110///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM15)
1111pub struct TIM15 {
1112 _marker: PhantomData<*const ()>,
1113}
1114unsafe impl Send for TIM15 {}
1115impl TIM15 {
1116 ///Pointer to the register block
1117 pub const PTR: *const tim15::RegisterBlock = 0x4001_4000 as *const _;
1118 ///Return the pointer to the register block
1119 #[inline(always)]
1120 pub const fn ptr() -> *const tim15::RegisterBlock {
1121 Self::PTR
1122 }
1123 /// Steal an instance of this peripheral
1124 ///
1125 /// # Safety
1126 ///
1127 /// Ensure that the new instance of the peripheral cannot be used in a way
1128 /// that may race with any existing instances, for example by only
1129 /// accessing read-only or write-only registers, or by consuming the
1130 /// original peripheral and using critical sections to coordinate
1131 /// access between multiple new instances.
1132 ///
1133 /// Additionally, other software such as HALs may rely on only one
1134 /// peripheral instance existing to ensure memory safety; ensure
1135 /// no stolen instances are passed to such software.
1136 pub unsafe fn steal() -> Self {
1137 Self { _marker: PhantomData }
1138 }
1139}
1140impl Deref for TIM15 {
1141 type Target = tim15::RegisterBlock;
1142 #[inline(always)]
1143 fn deref(&self) -> &Self::Target {
1144 unsafe { &*Self::PTR }
1145 }
1146}
1147impl core::fmt::Debug for TIM15 {
1148 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1149 f.debug_struct("TIM15").finish()
1150 }
1151}
1152///General purpose timers
1153pub mod tim15;
1154///General-purpose-timers
1155///
1156///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM16)
1157pub struct TIM16 {
1158 _marker: PhantomData<*const ()>,
1159}
1160unsafe impl Send for TIM16 {}
1161impl TIM16 {
1162 ///Pointer to the register block
1163 pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
1164 ///Return the pointer to the register block
1165 #[inline(always)]
1166 pub const fn ptr() -> *const tim16::RegisterBlock {
1167 Self::PTR
1168 }
1169 /// Steal an instance of this peripheral
1170 ///
1171 /// # Safety
1172 ///
1173 /// Ensure that the new instance of the peripheral cannot be used in a way
1174 /// that may race with any existing instances, for example by only
1175 /// accessing read-only or write-only registers, or by consuming the
1176 /// original peripheral and using critical sections to coordinate
1177 /// access between multiple new instances.
1178 ///
1179 /// Additionally, other software such as HALs may rely on only one
1180 /// peripheral instance existing to ensure memory safety; ensure
1181 /// no stolen instances are passed to such software.
1182 pub unsafe fn steal() -> Self {
1183 Self { _marker: PhantomData }
1184 }
1185}
1186impl Deref for TIM16 {
1187 type Target = tim16::RegisterBlock;
1188 #[inline(always)]
1189 fn deref(&self) -> &Self::Target {
1190 unsafe { &*Self::PTR }
1191 }
1192}
1193impl core::fmt::Debug for TIM16 {
1194 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1195 f.debug_struct("TIM16").finish()
1196 }
1197}
1198///General-purpose-timers
1199pub mod tim16;
1200///General purpose timer
1201///
1202///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM17)
1203pub struct TIM17 {
1204 _marker: PhantomData<*const ()>,
1205}
1206unsafe impl Send for TIM17 {}
1207impl TIM17 {
1208 ///Pointer to the register block
1209 pub const PTR: *const tim17::RegisterBlock = 0x4001_4800 as *const _;
1210 ///Return the pointer to the register block
1211 #[inline(always)]
1212 pub const fn ptr() -> *const tim17::RegisterBlock {
1213 Self::PTR
1214 }
1215 /// Steal an instance of this peripheral
1216 ///
1217 /// # Safety
1218 ///
1219 /// Ensure that the new instance of the peripheral cannot be used in a way
1220 /// that may race with any existing instances, for example by only
1221 /// accessing read-only or write-only registers, or by consuming the
1222 /// original peripheral and using critical sections to coordinate
1223 /// access between multiple new instances.
1224 ///
1225 /// Additionally, other software such as HALs may rely on only one
1226 /// peripheral instance existing to ensure memory safety; ensure
1227 /// no stolen instances are passed to such software.
1228 pub unsafe fn steal() -> Self {
1229 Self { _marker: PhantomData }
1230 }
1231}
1232impl Deref for TIM17 {
1233 type Target = tim17::RegisterBlock;
1234 #[inline(always)]
1235 fn deref(&self) -> &Self::Target {
1236 unsafe { &*Self::PTR }
1237 }
1238}
1239impl core::fmt::Debug for TIM17 {
1240 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1241 f.debug_struct("TIM17").finish()
1242 }
1243}
1244///General purpose timer
1245pub mod tim17;
1246///Universal synchronous asynchronous receiver transmitter
1247///
1248///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#USART1)
1249pub struct USART1 {
1250 _marker: PhantomData<*const ()>,
1251}
1252unsafe impl Send for USART1 {}
1253impl USART1 {
1254 ///Pointer to the register block
1255 pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
1256 ///Return the pointer to the register block
1257 #[inline(always)]
1258 pub const fn ptr() -> *const usart1::RegisterBlock {
1259 Self::PTR
1260 }
1261 /// Steal an instance of this peripheral
1262 ///
1263 /// # Safety
1264 ///
1265 /// Ensure that the new instance of the peripheral cannot be used in a way
1266 /// that may race with any existing instances, for example by only
1267 /// accessing read-only or write-only registers, or by consuming the
1268 /// original peripheral and using critical sections to coordinate
1269 /// access between multiple new instances.
1270 ///
1271 /// Additionally, other software such as HALs may rely on only one
1272 /// peripheral instance existing to ensure memory safety; ensure
1273 /// no stolen instances are passed to such software.
1274 pub unsafe fn steal() -> Self {
1275 Self { _marker: PhantomData }
1276 }
1277}
1278impl Deref for USART1 {
1279 type Target = usart1::RegisterBlock;
1280 #[inline(always)]
1281 fn deref(&self) -> &Self::Target {
1282 unsafe { &*Self::PTR }
1283 }
1284}
1285impl core::fmt::Debug for USART1 {
1286 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1287 f.debug_struct("USART1").finish()
1288 }
1289}
1290///Universal synchronous asynchronous receiver transmitter
1291pub mod usart1;
1292///Universal synchronous asynchronous receiver transmitter
1293///
1294///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#USART1)
1295pub struct USART2 {
1296 _marker: PhantomData<*const ()>,
1297}
1298unsafe impl Send for USART2 {}
1299impl USART2 {
1300 ///Pointer to the register block
1301 pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
1302 ///Return the pointer to the register block
1303 #[inline(always)]
1304 pub const fn ptr() -> *const usart1::RegisterBlock {
1305 Self::PTR
1306 }
1307 /// Steal an instance of this peripheral
1308 ///
1309 /// # Safety
1310 ///
1311 /// Ensure that the new instance of the peripheral cannot be used in a way
1312 /// that may race with any existing instances, for example by only
1313 /// accessing read-only or write-only registers, or by consuming the
1314 /// original peripheral and using critical sections to coordinate
1315 /// access between multiple new instances.
1316 ///
1317 /// Additionally, other software such as HALs may rely on only one
1318 /// peripheral instance existing to ensure memory safety; ensure
1319 /// no stolen instances are passed to such software.
1320 pub unsafe fn steal() -> Self {
1321 Self { _marker: PhantomData }
1322 }
1323}
1324impl Deref for USART2 {
1325 type Target = usart1::RegisterBlock;
1326 #[inline(always)]
1327 fn deref(&self) -> &Self::Target {
1328 unsafe { &*Self::PTR }
1329 }
1330}
1331impl core::fmt::Debug for USART2 {
1332 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1333 f.debug_struct("USART2").finish()
1334 }
1335}
1336///Universal synchronous asynchronous receiver transmitter
1337pub use self::usart1 as usart2;
1338///Universal synchronous asynchronous receiver transmitter
1339///
1340///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#USART1)
1341pub struct USART3 {
1342 _marker: PhantomData<*const ()>,
1343}
1344unsafe impl Send for USART3 {}
1345impl USART3 {
1346 ///Pointer to the register block
1347 pub const PTR: *const usart1::RegisterBlock = 0x4000_4800 as *const _;
1348 ///Return the pointer to the register block
1349 #[inline(always)]
1350 pub const fn ptr() -> *const usart1::RegisterBlock {
1351 Self::PTR
1352 }
1353 /// Steal an instance of this peripheral
1354 ///
1355 /// # Safety
1356 ///
1357 /// Ensure that the new instance of the peripheral cannot be used in a way
1358 /// that may race with any existing instances, for example by only
1359 /// accessing read-only or write-only registers, or by consuming the
1360 /// original peripheral and using critical sections to coordinate
1361 /// access between multiple new instances.
1362 ///
1363 /// Additionally, other software such as HALs may rely on only one
1364 /// peripheral instance existing to ensure memory safety; ensure
1365 /// no stolen instances are passed to such software.
1366 pub unsafe fn steal() -> Self {
1367 Self { _marker: PhantomData }
1368 }
1369}
1370impl Deref for USART3 {
1371 type Target = usart1::RegisterBlock;
1372 #[inline(always)]
1373 fn deref(&self) -> &Self::Target {
1374 unsafe { &*Self::PTR }
1375 }
1376}
1377impl core::fmt::Debug for USART3 {
1378 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1379 f.debug_struct("USART3").finish()
1380 }
1381}
1382///Universal synchronous asynchronous receiver transmitter
1383pub use self::usart1 as usart3;
1384///Universal synchronous asynchronous receiver transmitter
1385///
1386///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#USART1)
1387pub struct UART4 {
1388 _marker: PhantomData<*const ()>,
1389}
1390unsafe impl Send for UART4 {}
1391impl UART4 {
1392 ///Pointer to the register block
1393 pub const PTR: *const usart1::RegisterBlock = 0x4000_4c00 as *const _;
1394 ///Return the pointer to the register block
1395 #[inline(always)]
1396 pub const fn ptr() -> *const usart1::RegisterBlock {
1397 Self::PTR
1398 }
1399 /// Steal an instance of this peripheral
1400 ///
1401 /// # Safety
1402 ///
1403 /// Ensure that the new instance of the peripheral cannot be used in a way
1404 /// that may race with any existing instances, for example by only
1405 /// accessing read-only or write-only registers, or by consuming the
1406 /// original peripheral and using critical sections to coordinate
1407 /// access between multiple new instances.
1408 ///
1409 /// Additionally, other software such as HALs may rely on only one
1410 /// peripheral instance existing to ensure memory safety; ensure
1411 /// no stolen instances are passed to such software.
1412 pub unsafe fn steal() -> Self {
1413 Self { _marker: PhantomData }
1414 }
1415}
1416impl Deref for UART4 {
1417 type Target = usart1::RegisterBlock;
1418 #[inline(always)]
1419 fn deref(&self) -> &Self::Target {
1420 unsafe { &*Self::PTR }
1421 }
1422}
1423impl core::fmt::Debug for UART4 {
1424 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1425 f.debug_struct("UART4").finish()
1426 }
1427}
1428///Universal synchronous asynchronous receiver transmitter
1429pub use self::usart1 as uart4;
1430///Universal synchronous asynchronous receiver transmitter
1431///
1432///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#USART1)
1433pub struct UART5 {
1434 _marker: PhantomData<*const ()>,
1435}
1436unsafe impl Send for UART5 {}
1437impl UART5 {
1438 ///Pointer to the register block
1439 pub const PTR: *const usart1::RegisterBlock = 0x4000_5000 as *const _;
1440 ///Return the pointer to the register block
1441 #[inline(always)]
1442 pub const fn ptr() -> *const usart1::RegisterBlock {
1443 Self::PTR
1444 }
1445 /// Steal an instance of this peripheral
1446 ///
1447 /// # Safety
1448 ///
1449 /// Ensure that the new instance of the peripheral cannot be used in a way
1450 /// that may race with any existing instances, for example by only
1451 /// accessing read-only or write-only registers, or by consuming the
1452 /// original peripheral and using critical sections to coordinate
1453 /// access between multiple new instances.
1454 ///
1455 /// Additionally, other software such as HALs may rely on only one
1456 /// peripheral instance existing to ensure memory safety; ensure
1457 /// no stolen instances are passed to such software.
1458 pub unsafe fn steal() -> Self {
1459 Self { _marker: PhantomData }
1460 }
1461}
1462impl Deref for UART5 {
1463 type Target = usart1::RegisterBlock;
1464 #[inline(always)]
1465 fn deref(&self) -> &Self::Target {
1466 unsafe { &*Self::PTR }
1467 }
1468}
1469impl core::fmt::Debug for UART5 {
1470 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1471 f.debug_struct("UART5").finish()
1472 }
1473}
1474///Universal synchronous asynchronous receiver transmitter
1475pub use self::usart1 as uart5;
1476///Serial peripheral interface/Inter-IC sound
1477///
1478///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#SPI1)
1479pub struct SPI1 {
1480 _marker: PhantomData<*const ()>,
1481}
1482unsafe impl Send for SPI1 {}
1483impl SPI1 {
1484 ///Pointer to the register block
1485 pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
1486 ///Return the pointer to the register block
1487 #[inline(always)]
1488 pub const fn ptr() -> *const spi1::RegisterBlock {
1489 Self::PTR
1490 }
1491 /// Steal an instance of this peripheral
1492 ///
1493 /// # Safety
1494 ///
1495 /// Ensure that the new instance of the peripheral cannot be used in a way
1496 /// that may race with any existing instances, for example by only
1497 /// accessing read-only or write-only registers, or by consuming the
1498 /// original peripheral and using critical sections to coordinate
1499 /// access between multiple new instances.
1500 ///
1501 /// Additionally, other software such as HALs may rely on only one
1502 /// peripheral instance existing to ensure memory safety; ensure
1503 /// no stolen instances are passed to such software.
1504 pub unsafe fn steal() -> Self {
1505 Self { _marker: PhantomData }
1506 }
1507}
1508impl Deref for SPI1 {
1509 type Target = spi1::RegisterBlock;
1510 #[inline(always)]
1511 fn deref(&self) -> &Self::Target {
1512 unsafe { &*Self::PTR }
1513 }
1514}
1515impl core::fmt::Debug for SPI1 {
1516 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1517 f.debug_struct("SPI1").finish()
1518 }
1519}
1520///Serial peripheral interface/Inter-IC sound
1521pub mod spi1;
1522///Serial peripheral interface/Inter-IC sound
1523///
1524///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#SPI1)
1525pub struct SPI2 {
1526 _marker: PhantomData<*const ()>,
1527}
1528unsafe impl Send for SPI2 {}
1529impl SPI2 {
1530 ///Pointer to the register block
1531 pub const PTR: *const spi1::RegisterBlock = 0x4000_3800 as *const _;
1532 ///Return the pointer to the register block
1533 #[inline(always)]
1534 pub const fn ptr() -> *const spi1::RegisterBlock {
1535 Self::PTR
1536 }
1537 /// Steal an instance of this peripheral
1538 ///
1539 /// # Safety
1540 ///
1541 /// Ensure that the new instance of the peripheral cannot be used in a way
1542 /// that may race with any existing instances, for example by only
1543 /// accessing read-only or write-only registers, or by consuming the
1544 /// original peripheral and using critical sections to coordinate
1545 /// access between multiple new instances.
1546 ///
1547 /// Additionally, other software such as HALs may rely on only one
1548 /// peripheral instance existing to ensure memory safety; ensure
1549 /// no stolen instances are passed to such software.
1550 pub unsafe fn steal() -> Self {
1551 Self { _marker: PhantomData }
1552 }
1553}
1554impl Deref for SPI2 {
1555 type Target = spi1::RegisterBlock;
1556 #[inline(always)]
1557 fn deref(&self) -> &Self::Target {
1558 unsafe { &*Self::PTR }
1559 }
1560}
1561impl core::fmt::Debug for SPI2 {
1562 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1563 f.debug_struct("SPI2").finish()
1564 }
1565}
1566///Serial peripheral interface/Inter-IC sound
1567pub use self::spi1 as spi2;
1568///Serial peripheral interface/Inter-IC sound
1569///
1570///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#SPI1)
1571pub struct SPI3 {
1572 _marker: PhantomData<*const ()>,
1573}
1574unsafe impl Send for SPI3 {}
1575impl SPI3 {
1576 ///Pointer to the register block
1577 pub const PTR: *const spi1::RegisterBlock = 0x4000_3c00 as *const _;
1578 ///Return the pointer to the register block
1579 #[inline(always)]
1580 pub const fn ptr() -> *const spi1::RegisterBlock {
1581 Self::PTR
1582 }
1583 /// Steal an instance of this peripheral
1584 ///
1585 /// # Safety
1586 ///
1587 /// Ensure that the new instance of the peripheral cannot be used in a way
1588 /// that may race with any existing instances, for example by only
1589 /// accessing read-only or write-only registers, or by consuming the
1590 /// original peripheral and using critical sections to coordinate
1591 /// access between multiple new instances.
1592 ///
1593 /// Additionally, other software such as HALs may rely on only one
1594 /// peripheral instance existing to ensure memory safety; ensure
1595 /// no stolen instances are passed to such software.
1596 pub unsafe fn steal() -> Self {
1597 Self { _marker: PhantomData }
1598 }
1599}
1600impl Deref for SPI3 {
1601 type Target = spi1::RegisterBlock;
1602 #[inline(always)]
1603 fn deref(&self) -> &Self::Target {
1604 unsafe { &*Self::PTR }
1605 }
1606}
1607impl core::fmt::Debug for SPI3 {
1608 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1609 f.debug_struct("SPI3").finish()
1610 }
1611}
1612///Serial peripheral interface/Inter-IC sound
1613pub use self::spi1 as spi3;
1614///Serial peripheral interface/Inter-IC sound
1615///
1616///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#SPI1)
1617pub struct SPI4 {
1618 _marker: PhantomData<*const ()>,
1619}
1620unsafe impl Send for SPI4 {}
1621impl SPI4 {
1622 ///Pointer to the register block
1623 pub const PTR: *const spi1::RegisterBlock = 0x4001_3c00 as *const _;
1624 ///Return the pointer to the register block
1625 #[inline(always)]
1626 pub const fn ptr() -> *const spi1::RegisterBlock {
1627 Self::PTR
1628 }
1629 /// Steal an instance of this peripheral
1630 ///
1631 /// # Safety
1632 ///
1633 /// Ensure that the new instance of the peripheral cannot be used in a way
1634 /// that may race with any existing instances, for example by only
1635 /// accessing read-only or write-only registers, or by consuming the
1636 /// original peripheral and using critical sections to coordinate
1637 /// access between multiple new instances.
1638 ///
1639 /// Additionally, other software such as HALs may rely on only one
1640 /// peripheral instance existing to ensure memory safety; ensure
1641 /// no stolen instances are passed to such software.
1642 pub unsafe fn steal() -> Self {
1643 Self { _marker: PhantomData }
1644 }
1645}
1646impl Deref for SPI4 {
1647 type Target = spi1::RegisterBlock;
1648 #[inline(always)]
1649 fn deref(&self) -> &Self::Target {
1650 unsafe { &*Self::PTR }
1651 }
1652}
1653impl core::fmt::Debug for SPI4 {
1654 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1655 f.debug_struct("SPI4").finish()
1656 }
1657}
1658///Serial peripheral interface/Inter-IC sound
1659pub use self::spi1 as spi4;
1660///Serial peripheral interface/Inter-IC sound
1661///
1662///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#I2S2ext)
1663pub struct I2S2EXT {
1664 _marker: PhantomData<*const ()>,
1665}
1666unsafe impl Send for I2S2EXT {}
1667impl I2S2EXT {
1668 ///Pointer to the register block
1669 pub const PTR: *const i2s2ext::RegisterBlock = 0x4000_3400 as *const _;
1670 ///Return the pointer to the register block
1671 #[inline(always)]
1672 pub const fn ptr() -> *const i2s2ext::RegisterBlock {
1673 Self::PTR
1674 }
1675 /// Steal an instance of this peripheral
1676 ///
1677 /// # Safety
1678 ///
1679 /// Ensure that the new instance of the peripheral cannot be used in a way
1680 /// that may race with any existing instances, for example by only
1681 /// accessing read-only or write-only registers, or by consuming the
1682 /// original peripheral and using critical sections to coordinate
1683 /// access between multiple new instances.
1684 ///
1685 /// Additionally, other software such as HALs may rely on only one
1686 /// peripheral instance existing to ensure memory safety; ensure
1687 /// no stolen instances are passed to such software.
1688 pub unsafe fn steal() -> Self {
1689 Self { _marker: PhantomData }
1690 }
1691}
1692impl Deref for I2S2EXT {
1693 type Target = i2s2ext::RegisterBlock;
1694 #[inline(always)]
1695 fn deref(&self) -> &Self::Target {
1696 unsafe { &*Self::PTR }
1697 }
1698}
1699impl core::fmt::Debug for I2S2EXT {
1700 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1701 f.debug_struct("I2S2EXT").finish()
1702 }
1703}
1704///Serial peripheral interface/Inter-IC sound
1705pub mod i2s2ext;
1706///Serial peripheral interface/Inter-IC sound
1707///
1708///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#I2S2ext)
1709pub struct I2S3EXT {
1710 _marker: PhantomData<*const ()>,
1711}
1712unsafe impl Send for I2S3EXT {}
1713impl I2S3EXT {
1714 ///Pointer to the register block
1715 pub const PTR: *const i2s2ext::RegisterBlock = 0x4000_4000 as *const _;
1716 ///Return the pointer to the register block
1717 #[inline(always)]
1718 pub const fn ptr() -> *const i2s2ext::RegisterBlock {
1719 Self::PTR
1720 }
1721 /// Steal an instance of this peripheral
1722 ///
1723 /// # Safety
1724 ///
1725 /// Ensure that the new instance of the peripheral cannot be used in a way
1726 /// that may race with any existing instances, for example by only
1727 /// accessing read-only or write-only registers, or by consuming the
1728 /// original peripheral and using critical sections to coordinate
1729 /// access between multiple new instances.
1730 ///
1731 /// Additionally, other software such as HALs may rely on only one
1732 /// peripheral instance existing to ensure memory safety; ensure
1733 /// no stolen instances are passed to such software.
1734 pub unsafe fn steal() -> Self {
1735 Self { _marker: PhantomData }
1736 }
1737}
1738impl Deref for I2S3EXT {
1739 type Target = i2s2ext::RegisterBlock;
1740 #[inline(always)]
1741 fn deref(&self) -> &Self::Target {
1742 unsafe { &*Self::PTR }
1743 }
1744}
1745impl core::fmt::Debug for I2S3EXT {
1746 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1747 f.debug_struct("I2S3EXT").finish()
1748 }
1749}
1750///Serial peripheral interface/Inter-IC sound
1751pub use self::i2s2ext as i2s3ext;
1752///External interrupt/event controller
1753///
1754///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#EXTI)
1755pub struct EXTI {
1756 _marker: PhantomData<*const ()>,
1757}
1758unsafe impl Send for EXTI {}
1759impl EXTI {
1760 ///Pointer to the register block
1761 pub const PTR: *const exti::RegisterBlock = 0x4001_0400 as *const _;
1762 ///Return the pointer to the register block
1763 #[inline(always)]
1764 pub const fn ptr() -> *const exti::RegisterBlock {
1765 Self::PTR
1766 }
1767 /// Steal an instance of this peripheral
1768 ///
1769 /// # Safety
1770 ///
1771 /// Ensure that the new instance of the peripheral cannot be used in a way
1772 /// that may race with any existing instances, for example by only
1773 /// accessing read-only or write-only registers, or by consuming the
1774 /// original peripheral and using critical sections to coordinate
1775 /// access between multiple new instances.
1776 ///
1777 /// Additionally, other software such as HALs may rely on only one
1778 /// peripheral instance existing to ensure memory safety; ensure
1779 /// no stolen instances are passed to such software.
1780 pub unsafe fn steal() -> Self {
1781 Self { _marker: PhantomData }
1782 }
1783}
1784impl Deref for EXTI {
1785 type Target = exti::RegisterBlock;
1786 #[inline(always)]
1787 fn deref(&self) -> &Self::Target {
1788 unsafe { &*Self::PTR }
1789 }
1790}
1791impl core::fmt::Debug for EXTI {
1792 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1793 f.debug_struct("EXTI").finish()
1794 }
1795}
1796///External interrupt/event controller
1797pub mod exti;
1798///Power control
1799///
1800///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#PWR)
1801pub struct PWR {
1802 _marker: PhantomData<*const ()>,
1803}
1804unsafe impl Send for PWR {}
1805impl PWR {
1806 ///Pointer to the register block
1807 pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
1808 ///Return the pointer to the register block
1809 #[inline(always)]
1810 pub const fn ptr() -> *const pwr::RegisterBlock {
1811 Self::PTR
1812 }
1813 /// Steal an instance of this peripheral
1814 ///
1815 /// # Safety
1816 ///
1817 /// Ensure that the new instance of the peripheral cannot be used in a way
1818 /// that may race with any existing instances, for example by only
1819 /// accessing read-only or write-only registers, or by consuming the
1820 /// original peripheral and using critical sections to coordinate
1821 /// access between multiple new instances.
1822 ///
1823 /// Additionally, other software such as HALs may rely on only one
1824 /// peripheral instance existing to ensure memory safety; ensure
1825 /// no stolen instances are passed to such software.
1826 pub unsafe fn steal() -> Self {
1827 Self { _marker: PhantomData }
1828 }
1829}
1830impl Deref for PWR {
1831 type Target = pwr::RegisterBlock;
1832 #[inline(always)]
1833 fn deref(&self) -> &Self::Target {
1834 unsafe { &*Self::PTR }
1835 }
1836}
1837impl core::fmt::Debug for PWR {
1838 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1839 f.debug_struct("PWR").finish()
1840 }
1841}
1842///Power control
1843pub mod pwr;
1844///Controller area network
1845///
1846///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#CAN)
1847pub struct CAN {
1848 _marker: PhantomData<*const ()>,
1849}
1850unsafe impl Send for CAN {}
1851impl CAN {
1852 ///Pointer to the register block
1853 pub const PTR: *const can::RegisterBlock = 0x4000_6400 as *const _;
1854 ///Return the pointer to the register block
1855 #[inline(always)]
1856 pub const fn ptr() -> *const can::RegisterBlock {
1857 Self::PTR
1858 }
1859 /// Steal an instance of this peripheral
1860 ///
1861 /// # Safety
1862 ///
1863 /// Ensure that the new instance of the peripheral cannot be used in a way
1864 /// that may race with any existing instances, for example by only
1865 /// accessing read-only or write-only registers, or by consuming the
1866 /// original peripheral and using critical sections to coordinate
1867 /// access between multiple new instances.
1868 ///
1869 /// Additionally, other software such as HALs may rely on only one
1870 /// peripheral instance existing to ensure memory safety; ensure
1871 /// no stolen instances are passed to such software.
1872 pub unsafe fn steal() -> Self {
1873 Self { _marker: PhantomData }
1874 }
1875}
1876impl Deref for CAN {
1877 type Target = can::RegisterBlock;
1878 #[inline(always)]
1879 fn deref(&self) -> &Self::Target {
1880 unsafe { &*Self::PTR }
1881 }
1882}
1883impl core::fmt::Debug for CAN {
1884 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1885 f.debug_struct("CAN").finish()
1886 }
1887}
1888///Controller area network
1889pub mod can;
1890///Universal serial bus full-speed device interface
1891///
1892///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#USB)
1893pub struct USB {
1894 _marker: PhantomData<*const ()>,
1895}
1896unsafe impl Send for USB {}
1897impl USB {
1898 ///Pointer to the register block
1899 pub const PTR: *const usb::RegisterBlock = 0x4000_5c00 as *const _;
1900 ///Return the pointer to the register block
1901 #[inline(always)]
1902 pub const fn ptr() -> *const usb::RegisterBlock {
1903 Self::PTR
1904 }
1905 /// Steal an instance of this peripheral
1906 ///
1907 /// # Safety
1908 ///
1909 /// Ensure that the new instance of the peripheral cannot be used in a way
1910 /// that may race with any existing instances, for example by only
1911 /// accessing read-only or write-only registers, or by consuming the
1912 /// original peripheral and using critical sections to coordinate
1913 /// access between multiple new instances.
1914 ///
1915 /// Additionally, other software such as HALs may rely on only one
1916 /// peripheral instance existing to ensure memory safety; ensure
1917 /// no stolen instances are passed to such software.
1918 pub unsafe fn steal() -> Self {
1919 Self { _marker: PhantomData }
1920 }
1921}
1922impl Deref for USB {
1923 type Target = usb::RegisterBlock;
1924 #[inline(always)]
1925 fn deref(&self) -> &Self::Target {
1926 unsafe { &*Self::PTR }
1927 }
1928}
1929impl core::fmt::Debug for USB {
1930 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1931 f.debug_struct("USB").finish()
1932 }
1933}
1934///Universal serial bus full-speed device interface
1935pub mod usb;
1936///Inter-integrated circuit
1937///
1938///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#I2C1)
1939pub struct I2C1 {
1940 _marker: PhantomData<*const ()>,
1941}
1942unsafe impl Send for I2C1 {}
1943impl I2C1 {
1944 ///Pointer to the register block
1945 pub const PTR: *const i2c1::RegisterBlock = 0x4000_5400 as *const _;
1946 ///Return the pointer to the register block
1947 #[inline(always)]
1948 pub const fn ptr() -> *const i2c1::RegisterBlock {
1949 Self::PTR
1950 }
1951 /// Steal an instance of this peripheral
1952 ///
1953 /// # Safety
1954 ///
1955 /// Ensure that the new instance of the peripheral cannot be used in a way
1956 /// that may race with any existing instances, for example by only
1957 /// accessing read-only or write-only registers, or by consuming the
1958 /// original peripheral and using critical sections to coordinate
1959 /// access between multiple new instances.
1960 ///
1961 /// Additionally, other software such as HALs may rely on only one
1962 /// peripheral instance existing to ensure memory safety; ensure
1963 /// no stolen instances are passed to such software.
1964 pub unsafe fn steal() -> Self {
1965 Self { _marker: PhantomData }
1966 }
1967}
1968impl Deref for I2C1 {
1969 type Target = i2c1::RegisterBlock;
1970 #[inline(always)]
1971 fn deref(&self) -> &Self::Target {
1972 unsafe { &*Self::PTR }
1973 }
1974}
1975impl core::fmt::Debug for I2C1 {
1976 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1977 f.debug_struct("I2C1").finish()
1978 }
1979}
1980///Inter-integrated circuit
1981pub mod i2c1;
1982///Inter-integrated circuit
1983///
1984///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#I2C1)
1985pub struct I2C2 {
1986 _marker: PhantomData<*const ()>,
1987}
1988unsafe impl Send for I2C2 {}
1989impl I2C2 {
1990 ///Pointer to the register block
1991 pub const PTR: *const i2c1::RegisterBlock = 0x4000_5800 as *const _;
1992 ///Return the pointer to the register block
1993 #[inline(always)]
1994 pub const fn ptr() -> *const i2c1::RegisterBlock {
1995 Self::PTR
1996 }
1997 /// Steal an instance of this peripheral
1998 ///
1999 /// # Safety
2000 ///
2001 /// Ensure that the new instance of the peripheral cannot be used in a way
2002 /// that may race with any existing instances, for example by only
2003 /// accessing read-only or write-only registers, or by consuming the
2004 /// original peripheral and using critical sections to coordinate
2005 /// access between multiple new instances.
2006 ///
2007 /// Additionally, other software such as HALs may rely on only one
2008 /// peripheral instance existing to ensure memory safety; ensure
2009 /// no stolen instances are passed to such software.
2010 pub unsafe fn steal() -> Self {
2011 Self { _marker: PhantomData }
2012 }
2013}
2014impl Deref for I2C2 {
2015 type Target = i2c1::RegisterBlock;
2016 #[inline(always)]
2017 fn deref(&self) -> &Self::Target {
2018 unsafe { &*Self::PTR }
2019 }
2020}
2021impl core::fmt::Debug for I2C2 {
2022 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2023 f.debug_struct("I2C2").finish()
2024 }
2025}
2026///Inter-integrated circuit
2027pub use self::i2c1 as i2c2;
2028///Inter-integrated circuit
2029///
2030///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#I2C1)
2031pub struct I2C3 {
2032 _marker: PhantomData<*const ()>,
2033}
2034unsafe impl Send for I2C3 {}
2035impl I2C3 {
2036 ///Pointer to the register block
2037 pub const PTR: *const i2c1::RegisterBlock = 0x4000_7800 as *const _;
2038 ///Return the pointer to the register block
2039 #[inline(always)]
2040 pub const fn ptr() -> *const i2c1::RegisterBlock {
2041 Self::PTR
2042 }
2043 /// Steal an instance of this peripheral
2044 ///
2045 /// # Safety
2046 ///
2047 /// Ensure that the new instance of the peripheral cannot be used in a way
2048 /// that may race with any existing instances, for example by only
2049 /// accessing read-only or write-only registers, or by consuming the
2050 /// original peripheral and using critical sections to coordinate
2051 /// access between multiple new instances.
2052 ///
2053 /// Additionally, other software such as HALs may rely on only one
2054 /// peripheral instance existing to ensure memory safety; ensure
2055 /// no stolen instances are passed to such software.
2056 pub unsafe fn steal() -> Self {
2057 Self { _marker: PhantomData }
2058 }
2059}
2060impl Deref for I2C3 {
2061 type Target = i2c1::RegisterBlock;
2062 #[inline(always)]
2063 fn deref(&self) -> &Self::Target {
2064 unsafe { &*Self::PTR }
2065 }
2066}
2067impl core::fmt::Debug for I2C3 {
2068 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2069 f.debug_struct("I2C3").finish()
2070 }
2071}
2072///Inter-integrated circuit
2073pub use self::i2c1 as i2c3;
2074///Independent watchdog
2075///
2076///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#IWDG)
2077pub struct IWDG {
2078 _marker: PhantomData<*const ()>,
2079}
2080unsafe impl Send for IWDG {}
2081impl IWDG {
2082 ///Pointer to the register block
2083 pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
2084 ///Return the pointer to the register block
2085 #[inline(always)]
2086 pub const fn ptr() -> *const iwdg::RegisterBlock {
2087 Self::PTR
2088 }
2089 /// Steal an instance of this peripheral
2090 ///
2091 /// # Safety
2092 ///
2093 /// Ensure that the new instance of the peripheral cannot be used in a way
2094 /// that may race with any existing instances, for example by only
2095 /// accessing read-only or write-only registers, or by consuming the
2096 /// original peripheral and using critical sections to coordinate
2097 /// access between multiple new instances.
2098 ///
2099 /// Additionally, other software such as HALs may rely on only one
2100 /// peripheral instance existing to ensure memory safety; ensure
2101 /// no stolen instances are passed to such software.
2102 pub unsafe fn steal() -> Self {
2103 Self { _marker: PhantomData }
2104 }
2105}
2106impl Deref for IWDG {
2107 type Target = iwdg::RegisterBlock;
2108 #[inline(always)]
2109 fn deref(&self) -> &Self::Target {
2110 unsafe { &*Self::PTR }
2111 }
2112}
2113impl core::fmt::Debug for IWDG {
2114 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2115 f.debug_struct("IWDG").finish()
2116 }
2117}
2118///Independent watchdog
2119pub mod iwdg;
2120///Window watchdog
2121///
2122///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#WWDG)
2123pub struct WWDG {
2124 _marker: PhantomData<*const ()>,
2125}
2126unsafe impl Send for WWDG {}
2127impl WWDG {
2128 ///Pointer to the register block
2129 pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
2130 ///Return the pointer to the register block
2131 #[inline(always)]
2132 pub const fn ptr() -> *const wwdg::RegisterBlock {
2133 Self::PTR
2134 }
2135 /// Steal an instance of this peripheral
2136 ///
2137 /// # Safety
2138 ///
2139 /// Ensure that the new instance of the peripheral cannot be used in a way
2140 /// that may race with any existing instances, for example by only
2141 /// accessing read-only or write-only registers, or by consuming the
2142 /// original peripheral and using critical sections to coordinate
2143 /// access between multiple new instances.
2144 ///
2145 /// Additionally, other software such as HALs may rely on only one
2146 /// peripheral instance existing to ensure memory safety; ensure
2147 /// no stolen instances are passed to such software.
2148 pub unsafe fn steal() -> Self {
2149 Self { _marker: PhantomData }
2150 }
2151}
2152impl Deref for WWDG {
2153 type Target = wwdg::RegisterBlock;
2154 #[inline(always)]
2155 fn deref(&self) -> &Self::Target {
2156 unsafe { &*Self::PTR }
2157 }
2158}
2159impl core::fmt::Debug for WWDG {
2160 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2161 f.debug_struct("WWDG").finish()
2162 }
2163}
2164///Window watchdog
2165pub mod wwdg;
2166///Real-time clock
2167///
2168///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#RTC)
2169pub struct RTC {
2170 _marker: PhantomData<*const ()>,
2171}
2172unsafe impl Send for RTC {}
2173impl RTC {
2174 ///Pointer to the register block
2175 pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
2176 ///Return the pointer to the register block
2177 #[inline(always)]
2178 pub const fn ptr() -> *const rtc::RegisterBlock {
2179 Self::PTR
2180 }
2181 /// Steal an instance of this peripheral
2182 ///
2183 /// # Safety
2184 ///
2185 /// Ensure that the new instance of the peripheral cannot be used in a way
2186 /// that may race with any existing instances, for example by only
2187 /// accessing read-only or write-only registers, or by consuming the
2188 /// original peripheral and using critical sections to coordinate
2189 /// access between multiple new instances.
2190 ///
2191 /// Additionally, other software such as HALs may rely on only one
2192 /// peripheral instance existing to ensure memory safety; ensure
2193 /// no stolen instances are passed to such software.
2194 pub unsafe fn steal() -> Self {
2195 Self { _marker: PhantomData }
2196 }
2197}
2198impl Deref for RTC {
2199 type Target = rtc::RegisterBlock;
2200 #[inline(always)]
2201 fn deref(&self) -> &Self::Target {
2202 unsafe { &*Self::PTR }
2203 }
2204}
2205impl core::fmt::Debug for RTC {
2206 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2207 f.debug_struct("RTC").finish()
2208 }
2209}
2210///Real-time clock
2211pub mod rtc;
2212///Basic timers
2213///
2214///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM6)
2215pub struct TIM6 {
2216 _marker: PhantomData<*const ()>,
2217}
2218unsafe impl Send for TIM6 {}
2219impl TIM6 {
2220 ///Pointer to the register block
2221 pub const PTR: *const tim6::RegisterBlock = 0x4000_1000 as *const _;
2222 ///Return the pointer to the register block
2223 #[inline(always)]
2224 pub const fn ptr() -> *const tim6::RegisterBlock {
2225 Self::PTR
2226 }
2227 /// Steal an instance of this peripheral
2228 ///
2229 /// # Safety
2230 ///
2231 /// Ensure that the new instance of the peripheral cannot be used in a way
2232 /// that may race with any existing instances, for example by only
2233 /// accessing read-only or write-only registers, or by consuming the
2234 /// original peripheral and using critical sections to coordinate
2235 /// access between multiple new instances.
2236 ///
2237 /// Additionally, other software such as HALs may rely on only one
2238 /// peripheral instance existing to ensure memory safety; ensure
2239 /// no stolen instances are passed to such software.
2240 pub unsafe fn steal() -> Self {
2241 Self { _marker: PhantomData }
2242 }
2243}
2244impl Deref for TIM6 {
2245 type Target = tim6::RegisterBlock;
2246 #[inline(always)]
2247 fn deref(&self) -> &Self::Target {
2248 unsafe { &*Self::PTR }
2249 }
2250}
2251impl core::fmt::Debug for TIM6 {
2252 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2253 f.debug_struct("TIM6").finish()
2254 }
2255}
2256///Basic timers
2257pub mod tim6;
2258///Basic timers
2259///
2260///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM6)
2261pub struct TIM7 {
2262 _marker: PhantomData<*const ()>,
2263}
2264unsafe impl Send for TIM7 {}
2265impl TIM7 {
2266 ///Pointer to the register block
2267 pub const PTR: *const tim6::RegisterBlock = 0x4000_1400 as *const _;
2268 ///Return the pointer to the register block
2269 #[inline(always)]
2270 pub const fn ptr() -> *const tim6::RegisterBlock {
2271 Self::PTR
2272 }
2273 /// Steal an instance of this peripheral
2274 ///
2275 /// # Safety
2276 ///
2277 /// Ensure that the new instance of the peripheral cannot be used in a way
2278 /// that may race with any existing instances, for example by only
2279 /// accessing read-only or write-only registers, or by consuming the
2280 /// original peripheral and using critical sections to coordinate
2281 /// access between multiple new instances.
2282 ///
2283 /// Additionally, other software such as HALs may rely on only one
2284 /// peripheral instance existing to ensure memory safety; ensure
2285 /// no stolen instances are passed to such software.
2286 pub unsafe fn steal() -> Self {
2287 Self { _marker: PhantomData }
2288 }
2289}
2290impl Deref for TIM7 {
2291 type Target = tim6::RegisterBlock;
2292 #[inline(always)]
2293 fn deref(&self) -> &Self::Target {
2294 unsafe { &*Self::PTR }
2295 }
2296}
2297impl core::fmt::Debug for TIM7 {
2298 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2299 f.debug_struct("TIM7").finish()
2300 }
2301}
2302///Basic timers
2303pub use self::tim6 as tim7;
2304///Digital-to-analog converter
2305///
2306///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#DAC1)
2307pub struct DAC1 {
2308 _marker: PhantomData<*const ()>,
2309}
2310unsafe impl Send for DAC1 {}
2311impl DAC1 {
2312 ///Pointer to the register block
2313 pub const PTR: *const dac1::RegisterBlock = 0x4000_7400 as *const _;
2314 ///Return the pointer to the register block
2315 #[inline(always)]
2316 pub const fn ptr() -> *const dac1::RegisterBlock {
2317 Self::PTR
2318 }
2319 /// Steal an instance of this peripheral
2320 ///
2321 /// # Safety
2322 ///
2323 /// Ensure that the new instance of the peripheral cannot be used in a way
2324 /// that may race with any existing instances, for example by only
2325 /// accessing read-only or write-only registers, or by consuming the
2326 /// original peripheral and using critical sections to coordinate
2327 /// access between multiple new instances.
2328 ///
2329 /// Additionally, other software such as HALs may rely on only one
2330 /// peripheral instance existing to ensure memory safety; ensure
2331 /// no stolen instances are passed to such software.
2332 pub unsafe fn steal() -> Self {
2333 Self { _marker: PhantomData }
2334 }
2335}
2336impl Deref for DAC1 {
2337 type Target = dac1::RegisterBlock;
2338 #[inline(always)]
2339 fn deref(&self) -> &Self::Target {
2340 unsafe { &*Self::PTR }
2341 }
2342}
2343impl core::fmt::Debug for DAC1 {
2344 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2345 f.debug_struct("DAC1").finish()
2346 }
2347}
2348///Digital-to-analog converter
2349pub mod dac1;
2350///Debug support
2351///
2352///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#DBGMCU)
2353pub struct DBGMCU {
2354 _marker: PhantomData<*const ()>,
2355}
2356unsafe impl Send for DBGMCU {}
2357impl DBGMCU {
2358 ///Pointer to the register block
2359 pub const PTR: *const dbgmcu::RegisterBlock = 0xe004_2000 as *const _;
2360 ///Return the pointer to the register block
2361 #[inline(always)]
2362 pub const fn ptr() -> *const dbgmcu::RegisterBlock {
2363 Self::PTR
2364 }
2365 /// Steal an instance of this peripheral
2366 ///
2367 /// # Safety
2368 ///
2369 /// Ensure that the new instance of the peripheral cannot be used in a way
2370 /// that may race with any existing instances, for example by only
2371 /// accessing read-only or write-only registers, or by consuming the
2372 /// original peripheral and using critical sections to coordinate
2373 /// access between multiple new instances.
2374 ///
2375 /// Additionally, other software such as HALs may rely on only one
2376 /// peripheral instance existing to ensure memory safety; ensure
2377 /// no stolen instances are passed to such software.
2378 pub unsafe fn steal() -> Self {
2379 Self { _marker: PhantomData }
2380 }
2381}
2382impl Deref for DBGMCU {
2383 type Target = dbgmcu::RegisterBlock;
2384 #[inline(always)]
2385 fn deref(&self) -> &Self::Target {
2386 unsafe { &*Self::PTR }
2387 }
2388}
2389impl core::fmt::Debug for DBGMCU {
2390 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2391 f.debug_struct("DBGMCU").finish()
2392 }
2393}
2394///Debug support
2395pub mod dbgmcu;
2396///Advanced timer
2397///
2398///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM1)
2399pub struct TIM1 {
2400 _marker: PhantomData<*const ()>,
2401}
2402unsafe impl Send for TIM1 {}
2403impl TIM1 {
2404 ///Pointer to the register block
2405 pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
2406 ///Return the pointer to the register block
2407 #[inline(always)]
2408 pub const fn ptr() -> *const tim1::RegisterBlock {
2409 Self::PTR
2410 }
2411 /// Steal an instance of this peripheral
2412 ///
2413 /// # Safety
2414 ///
2415 /// Ensure that the new instance of the peripheral cannot be used in a way
2416 /// that may race with any existing instances, for example by only
2417 /// accessing read-only or write-only registers, or by consuming the
2418 /// original peripheral and using critical sections to coordinate
2419 /// access between multiple new instances.
2420 ///
2421 /// Additionally, other software such as HALs may rely on only one
2422 /// peripheral instance existing to ensure memory safety; ensure
2423 /// no stolen instances are passed to such software.
2424 pub unsafe fn steal() -> Self {
2425 Self { _marker: PhantomData }
2426 }
2427}
2428impl Deref for TIM1 {
2429 type Target = tim1::RegisterBlock;
2430 #[inline(always)]
2431 fn deref(&self) -> &Self::Target {
2432 unsafe { &*Self::PTR }
2433 }
2434}
2435impl core::fmt::Debug for TIM1 {
2436 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2437 f.debug_struct("TIM1").finish()
2438 }
2439}
2440///Advanced timer
2441pub mod tim1;
2442///Advanced timer
2443///
2444///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM1)
2445pub struct TIM20 {
2446 _marker: PhantomData<*const ()>,
2447}
2448unsafe impl Send for TIM20 {}
2449impl TIM20 {
2450 ///Pointer to the register block
2451 pub const PTR: *const tim1::RegisterBlock = 0x4001_5000 as *const _;
2452 ///Return the pointer to the register block
2453 #[inline(always)]
2454 pub const fn ptr() -> *const tim1::RegisterBlock {
2455 Self::PTR
2456 }
2457 /// Steal an instance of this peripheral
2458 ///
2459 /// # Safety
2460 ///
2461 /// Ensure that the new instance of the peripheral cannot be used in a way
2462 /// that may race with any existing instances, for example by only
2463 /// accessing read-only or write-only registers, or by consuming the
2464 /// original peripheral and using critical sections to coordinate
2465 /// access between multiple new instances.
2466 ///
2467 /// Additionally, other software such as HALs may rely on only one
2468 /// peripheral instance existing to ensure memory safety; ensure
2469 /// no stolen instances are passed to such software.
2470 pub unsafe fn steal() -> Self {
2471 Self { _marker: PhantomData }
2472 }
2473}
2474impl Deref for TIM20 {
2475 type Target = tim1::RegisterBlock;
2476 #[inline(always)]
2477 fn deref(&self) -> &Self::Target {
2478 unsafe { &*Self::PTR }
2479 }
2480}
2481impl core::fmt::Debug for TIM20 {
2482 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2483 f.debug_struct("TIM20").finish()
2484 }
2485}
2486///Advanced timer
2487pub use self::tim1 as tim20;
2488///Advanced-timers
2489///
2490///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#TIM8)
2491pub struct TIM8 {
2492 _marker: PhantomData<*const ()>,
2493}
2494unsafe impl Send for TIM8 {}
2495impl TIM8 {
2496 ///Pointer to the register block
2497 pub const PTR: *const tim8::RegisterBlock = 0x4001_3400 as *const _;
2498 ///Return the pointer to the register block
2499 #[inline(always)]
2500 pub const fn ptr() -> *const tim8::RegisterBlock {
2501 Self::PTR
2502 }
2503 /// Steal an instance of this peripheral
2504 ///
2505 /// # Safety
2506 ///
2507 /// Ensure that the new instance of the peripheral cannot be used in a way
2508 /// that may race with any existing instances, for example by only
2509 /// accessing read-only or write-only registers, or by consuming the
2510 /// original peripheral and using critical sections to coordinate
2511 /// access between multiple new instances.
2512 ///
2513 /// Additionally, other software such as HALs may rely on only one
2514 /// peripheral instance existing to ensure memory safety; ensure
2515 /// no stolen instances are passed to such software.
2516 pub unsafe fn steal() -> Self {
2517 Self { _marker: PhantomData }
2518 }
2519}
2520impl Deref for TIM8 {
2521 type Target = tim8::RegisterBlock;
2522 #[inline(always)]
2523 fn deref(&self) -> &Self::Target {
2524 unsafe { &*Self::PTR }
2525 }
2526}
2527impl core::fmt::Debug for TIM8 {
2528 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2529 f.debug_struct("TIM8").finish()
2530 }
2531}
2532///Advanced-timers
2533pub mod tim8;
2534///Analog-to-Digital Converter
2535///
2536///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#ADC1)
2537pub struct ADC1 {
2538 _marker: PhantomData<*const ()>,
2539}
2540unsafe impl Send for ADC1 {}
2541impl ADC1 {
2542 ///Pointer to the register block
2543 pub const PTR: *const adc1::RegisterBlock = 0x5000_0000 as *const _;
2544 ///Return the pointer to the register block
2545 #[inline(always)]
2546 pub const fn ptr() -> *const adc1::RegisterBlock {
2547 Self::PTR
2548 }
2549 /// Steal an instance of this peripheral
2550 ///
2551 /// # Safety
2552 ///
2553 /// Ensure that the new instance of the peripheral cannot be used in a way
2554 /// that may race with any existing instances, for example by only
2555 /// accessing read-only or write-only registers, or by consuming the
2556 /// original peripheral and using critical sections to coordinate
2557 /// access between multiple new instances.
2558 ///
2559 /// Additionally, other software such as HALs may rely on only one
2560 /// peripheral instance existing to ensure memory safety; ensure
2561 /// no stolen instances are passed to such software.
2562 pub unsafe fn steal() -> Self {
2563 Self { _marker: PhantomData }
2564 }
2565}
2566impl Deref for ADC1 {
2567 type Target = adc1::RegisterBlock;
2568 #[inline(always)]
2569 fn deref(&self) -> &Self::Target {
2570 unsafe { &*Self::PTR }
2571 }
2572}
2573impl core::fmt::Debug for ADC1 {
2574 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2575 f.debug_struct("ADC1").finish()
2576 }
2577}
2578///Analog-to-Digital Converter
2579pub mod adc1;
2580///Analog-to-Digital Converter
2581///
2582///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#ADC1)
2583pub struct ADC2 {
2584 _marker: PhantomData<*const ()>,
2585}
2586unsafe impl Send for ADC2 {}
2587impl ADC2 {
2588 ///Pointer to the register block
2589 pub const PTR: *const adc1::RegisterBlock = 0x5000_0100 as *const _;
2590 ///Return the pointer to the register block
2591 #[inline(always)]
2592 pub const fn ptr() -> *const adc1::RegisterBlock {
2593 Self::PTR
2594 }
2595 /// Steal an instance of this peripheral
2596 ///
2597 /// # Safety
2598 ///
2599 /// Ensure that the new instance of the peripheral cannot be used in a way
2600 /// that may race with any existing instances, for example by only
2601 /// accessing read-only or write-only registers, or by consuming the
2602 /// original peripheral and using critical sections to coordinate
2603 /// access between multiple new instances.
2604 ///
2605 /// Additionally, other software such as HALs may rely on only one
2606 /// peripheral instance existing to ensure memory safety; ensure
2607 /// no stolen instances are passed to such software.
2608 pub unsafe fn steal() -> Self {
2609 Self { _marker: PhantomData }
2610 }
2611}
2612impl Deref for ADC2 {
2613 type Target = adc1::RegisterBlock;
2614 #[inline(always)]
2615 fn deref(&self) -> &Self::Target {
2616 unsafe { &*Self::PTR }
2617 }
2618}
2619impl core::fmt::Debug for ADC2 {
2620 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2621 f.debug_struct("ADC2").finish()
2622 }
2623}
2624///Analog-to-Digital Converter
2625pub use self::adc1 as adc2;
2626///Analog-to-Digital Converter
2627///
2628///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#ADC1_2)
2629pub struct ADC1_2 {
2630 _marker: PhantomData<*const ()>,
2631}
2632unsafe impl Send for ADC1_2 {}
2633impl ADC1_2 {
2634 ///Pointer to the register block
2635 pub const PTR: *const adc1_2::RegisterBlock = 0x5000_0300 as *const _;
2636 ///Return the pointer to the register block
2637 #[inline(always)]
2638 pub const fn ptr() -> *const adc1_2::RegisterBlock {
2639 Self::PTR
2640 }
2641 /// Steal an instance of this peripheral
2642 ///
2643 /// # Safety
2644 ///
2645 /// Ensure that the new instance of the peripheral cannot be used in a way
2646 /// that may race with any existing instances, for example by only
2647 /// accessing read-only or write-only registers, or by consuming the
2648 /// original peripheral and using critical sections to coordinate
2649 /// access between multiple new instances.
2650 ///
2651 /// Additionally, other software such as HALs may rely on only one
2652 /// peripheral instance existing to ensure memory safety; ensure
2653 /// no stolen instances are passed to such software.
2654 pub unsafe fn steal() -> Self {
2655 Self { _marker: PhantomData }
2656 }
2657}
2658impl Deref for ADC1_2 {
2659 type Target = adc1_2::RegisterBlock;
2660 #[inline(always)]
2661 fn deref(&self) -> &Self::Target {
2662 unsafe { &*Self::PTR }
2663 }
2664}
2665impl core::fmt::Debug for ADC1_2 {
2666 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2667 f.debug_struct("ADC1_2").finish()
2668 }
2669}
2670///Analog-to-Digital Converter
2671pub mod adc1_2;
2672///Flexible memory controller
2673///
2674///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#FMC)
2675pub struct FMC {
2676 _marker: PhantomData<*const ()>,
2677}
2678unsafe impl Send for FMC {}
2679impl FMC {
2680 ///Pointer to the register block
2681 pub const PTR: *const fmc::RegisterBlock = 0xa000_0000 as *const _;
2682 ///Return the pointer to the register block
2683 #[inline(always)]
2684 pub const fn ptr() -> *const fmc::RegisterBlock {
2685 Self::PTR
2686 }
2687 /// Steal an instance of this peripheral
2688 ///
2689 /// # Safety
2690 ///
2691 /// Ensure that the new instance of the peripheral cannot be used in a way
2692 /// that may race with any existing instances, for example by only
2693 /// accessing read-only or write-only registers, or by consuming the
2694 /// original peripheral and using critical sections to coordinate
2695 /// access between multiple new instances.
2696 ///
2697 /// Additionally, other software such as HALs may rely on only one
2698 /// peripheral instance existing to ensure memory safety; ensure
2699 /// no stolen instances are passed to such software.
2700 pub unsafe fn steal() -> Self {
2701 Self { _marker: PhantomData }
2702 }
2703}
2704impl Deref for FMC {
2705 type Target = fmc::RegisterBlock;
2706 #[inline(always)]
2707 fn deref(&self) -> &Self::Target {
2708 unsafe { &*Self::PTR }
2709 }
2710}
2711impl core::fmt::Debug for FMC {
2712 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2713 f.debug_struct("FMC").finish()
2714 }
2715}
2716///Flexible memory controller
2717pub mod fmc;
2718///System configuration controller
2719///
2720///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#SYSCFG)
2721pub struct SYSCFG {
2722 _marker: PhantomData<*const ()>,
2723}
2724unsafe impl Send for SYSCFG {}
2725impl SYSCFG {
2726 ///Pointer to the register block
2727 pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
2728 ///Return the pointer to the register block
2729 #[inline(always)]
2730 pub const fn ptr() -> *const syscfg::RegisterBlock {
2731 Self::PTR
2732 }
2733 /// Steal an instance of this peripheral
2734 ///
2735 /// # Safety
2736 ///
2737 /// Ensure that the new instance of the peripheral cannot be used in a way
2738 /// that may race with any existing instances, for example by only
2739 /// accessing read-only or write-only registers, or by consuming the
2740 /// original peripheral and using critical sections to coordinate
2741 /// access between multiple new instances.
2742 ///
2743 /// Additionally, other software such as HALs may rely on only one
2744 /// peripheral instance existing to ensure memory safety; ensure
2745 /// no stolen instances are passed to such software.
2746 pub unsafe fn steal() -> Self {
2747 Self { _marker: PhantomData }
2748 }
2749}
2750impl Deref for SYSCFG {
2751 type Target = syscfg::RegisterBlock;
2752 #[inline(always)]
2753 fn deref(&self) -> &Self::Target {
2754 unsafe { &*Self::PTR }
2755 }
2756}
2757impl core::fmt::Debug for SYSCFG {
2758 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2759 f.debug_struct("SYSCFG").finish()
2760 }
2761}
2762///System configuration controller
2763pub mod syscfg;
2764///Operational Amplifier
2765///
2766///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#OPAMP)
2767pub struct OPAMP {
2768 _marker: PhantomData<*const ()>,
2769}
2770unsafe impl Send for OPAMP {}
2771impl OPAMP {
2772 ///Pointer to the register block
2773 pub const PTR: *const opamp::RegisterBlock = 0x4001_0000 as *const _;
2774 ///Return the pointer to the register block
2775 #[inline(always)]
2776 pub const fn ptr() -> *const opamp::RegisterBlock {
2777 Self::PTR
2778 }
2779 /// Steal an instance of this peripheral
2780 ///
2781 /// # Safety
2782 ///
2783 /// Ensure that the new instance of the peripheral cannot be used in a way
2784 /// that may race with any existing instances, for example by only
2785 /// accessing read-only or write-only registers, or by consuming the
2786 /// original peripheral and using critical sections to coordinate
2787 /// access between multiple new instances.
2788 ///
2789 /// Additionally, other software such as HALs may rely on only one
2790 /// peripheral instance existing to ensure memory safety; ensure
2791 /// no stolen instances are passed to such software.
2792 pub unsafe fn steal() -> Self {
2793 Self { _marker: PhantomData }
2794 }
2795}
2796impl Deref for OPAMP {
2797 type Target = opamp::RegisterBlock;
2798 #[inline(always)]
2799 fn deref(&self) -> &Self::Target {
2800 unsafe { &*Self::PTR }
2801 }
2802}
2803impl core::fmt::Debug for OPAMP {
2804 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2805 f.debug_struct("OPAMP").finish()
2806 }
2807}
2808///Operational Amplifier
2809pub mod opamp;
2810///General purpose comparators
2811///
2812///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32F302.html#COMP)
2813pub struct COMP {
2814 _marker: PhantomData<*const ()>,
2815}
2816unsafe impl Send for COMP {}
2817impl COMP {
2818 ///Pointer to the register block
2819 pub const PTR: *const comp::RegisterBlock = 0x4001_0000 as *const _;
2820 ///Return the pointer to the register block
2821 #[inline(always)]
2822 pub const fn ptr() -> *const comp::RegisterBlock {
2823 Self::PTR
2824 }
2825 /// Steal an instance of this peripheral
2826 ///
2827 /// # Safety
2828 ///
2829 /// Ensure that the new instance of the peripheral cannot be used in a way
2830 /// that may race with any existing instances, for example by only
2831 /// accessing read-only or write-only registers, or by consuming the
2832 /// original peripheral and using critical sections to coordinate
2833 /// access between multiple new instances.
2834 ///
2835 /// Additionally, other software such as HALs may rely on only one
2836 /// peripheral instance existing to ensure memory safety; ensure
2837 /// no stolen instances are passed to such software.
2838 pub unsafe fn steal() -> Self {
2839 Self { _marker: PhantomData }
2840 }
2841}
2842impl Deref for COMP {
2843 type Target = comp::RegisterBlock;
2844 #[inline(always)]
2845 fn deref(&self) -> &Self::Target {
2846 unsafe { &*Self::PTR }
2847 }
2848}
2849impl core::fmt::Debug for COMP {
2850 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2851 f.debug_struct("COMP").finish()
2852 }
2853}
2854///General purpose comparators
2855pub mod comp;
2856#[no_mangle]
2857static mut DEVICE_PERIPHERALS: bool = false;
2858/// All the peripherals.
2859#[allow(non_snake_case)]
2860pub struct Peripherals {
2861 ///GPIOA
2862 pub GPIOA: GPIOA,
2863 ///GPIOB
2864 pub GPIOB: GPIOB,
2865 ///GPIOC
2866 pub GPIOC: GPIOC,
2867 ///GPIOD
2868 pub GPIOD: GPIOD,
2869 ///GPIOE
2870 pub GPIOE: GPIOE,
2871 ///GPIOF
2872 pub GPIOF: GPIOF,
2873 ///GPIOG
2874 pub GPIOG: GPIOG,
2875 ///GPIOH
2876 pub GPIOH: GPIOH,
2877 ///TSC
2878 pub TSC: TSC,
2879 ///CRC
2880 pub CRC: CRC,
2881 ///FLASH
2882 pub FLASH: FLASH,
2883 ///RCC
2884 pub RCC: RCC,
2885 ///DMA1
2886 pub DMA1: DMA1,
2887 ///DMA2
2888 pub DMA2: DMA2,
2889 ///TIM2
2890 pub TIM2: TIM2,
2891 ///TIM3
2892 pub TIM3: TIM3,
2893 ///TIM4
2894 pub TIM4: TIM4,
2895 ///TIM15
2896 pub TIM15: TIM15,
2897 ///TIM16
2898 pub TIM16: TIM16,
2899 ///TIM17
2900 pub TIM17: TIM17,
2901 ///USART1
2902 pub USART1: USART1,
2903 ///USART2
2904 pub USART2: USART2,
2905 ///USART3
2906 pub USART3: USART3,
2907 ///UART4
2908 pub UART4: UART4,
2909 ///UART5
2910 pub UART5: UART5,
2911 ///SPI1
2912 pub SPI1: SPI1,
2913 ///SPI2
2914 pub SPI2: SPI2,
2915 ///SPI3
2916 pub SPI3: SPI3,
2917 ///SPI4
2918 pub SPI4: SPI4,
2919 ///I2S2ext
2920 pub I2S2EXT: I2S2EXT,
2921 ///I2S3ext
2922 pub I2S3EXT: I2S3EXT,
2923 ///EXTI
2924 pub EXTI: EXTI,
2925 ///PWR
2926 pub PWR: PWR,
2927 ///CAN
2928 pub CAN: CAN,
2929 ///USB
2930 pub USB: USB,
2931 ///I2C1
2932 pub I2C1: I2C1,
2933 ///I2C2
2934 pub I2C2: I2C2,
2935 ///I2C3
2936 pub I2C3: I2C3,
2937 ///IWDG
2938 pub IWDG: IWDG,
2939 ///WWDG
2940 pub WWDG: WWDG,
2941 ///RTC
2942 pub RTC: RTC,
2943 ///TIM6
2944 pub TIM6: TIM6,
2945 ///TIM7
2946 pub TIM7: TIM7,
2947 ///DAC1
2948 pub DAC1: DAC1,
2949 ///DBGMCU
2950 pub DBGMCU: DBGMCU,
2951 ///TIM1
2952 pub TIM1: TIM1,
2953 ///TIM20
2954 pub TIM20: TIM20,
2955 ///TIM8
2956 pub TIM8: TIM8,
2957 ///ADC1
2958 pub ADC1: ADC1,
2959 ///ADC2
2960 pub ADC2: ADC2,
2961 ///ADC1_2
2962 pub ADC1_2: ADC1_2,
2963 ///FMC
2964 pub FMC: FMC,
2965 ///SYSCFG
2966 pub SYSCFG: SYSCFG,
2967 ///OPAMP
2968 pub OPAMP: OPAMP,
2969 ///COMP
2970 pub COMP: COMP,
2971}
2972impl Peripherals {
2973 /// Returns all the peripherals *once*.
2974 #[cfg(feature = "critical-section")]
2975 #[inline]
2976 pub fn take() -> Option<Self> {
2977 critical_section::with(|_| {
2978 if unsafe { DEVICE_PERIPHERALS } {
2979 return None;
2980 }
2981 Some(unsafe { Peripherals::steal() })
2982 })
2983 }
2984 /// Unchecked version of `Peripherals::take`.
2985 ///
2986 /// # Safety
2987 ///
2988 /// Each of the returned peripherals must be used at most once.
2989 #[inline]
2990 pub unsafe fn steal() -> Self {
2991 DEVICE_PERIPHERALS = true;
2992 Peripherals {
2993 GPIOA: GPIOA::steal(),
2994 GPIOB: GPIOB::steal(),
2995 GPIOC: GPIOC::steal(),
2996 GPIOD: GPIOD::steal(),
2997 GPIOE: GPIOE::steal(),
2998 GPIOF: GPIOF::steal(),
2999 GPIOG: GPIOG::steal(),
3000 GPIOH: GPIOH::steal(),
3001 TSC: TSC::steal(),
3002 CRC: CRC::steal(),
3003 FLASH: FLASH::steal(),
3004 RCC: RCC::steal(),
3005 DMA1: DMA1::steal(),
3006 DMA2: DMA2::steal(),
3007 TIM2: TIM2::steal(),
3008 TIM3: TIM3::steal(),
3009 TIM4: TIM4::steal(),
3010 TIM15: TIM15::steal(),
3011 TIM16: TIM16::steal(),
3012 TIM17: TIM17::steal(),
3013 USART1: USART1::steal(),
3014 USART2: USART2::steal(),
3015 USART3: USART3::steal(),
3016 UART4: UART4::steal(),
3017 UART5: UART5::steal(),
3018 SPI1: SPI1::steal(),
3019 SPI2: SPI2::steal(),
3020 SPI3: SPI3::steal(),
3021 SPI4: SPI4::steal(),
3022 I2S2EXT: I2S2EXT::steal(),
3023 I2S3EXT: I2S3EXT::steal(),
3024 EXTI: EXTI::steal(),
3025 PWR: PWR::steal(),
3026 CAN: CAN::steal(),
3027 USB: USB::steal(),
3028 I2C1: I2C1::steal(),
3029 I2C2: I2C2::steal(),
3030 I2C3: I2C3::steal(),
3031 IWDG: IWDG::steal(),
3032 WWDG: WWDG::steal(),
3033 RTC: RTC::steal(),
3034 TIM6: TIM6::steal(),
3035 TIM7: TIM7::steal(),
3036 DAC1: DAC1::steal(),
3037 DBGMCU: DBGMCU::steal(),
3038 TIM1: TIM1::steal(),
3039 TIM20: TIM20::steal(),
3040 TIM8: TIM8::steal(),
3041 ADC1: ADC1::steal(),
3042 ADC2: ADC2::steal(),
3043 ADC1_2: ADC1_2::steal(),
3044 FMC: FMC::steal(),
3045 SYSCFG: SYSCFG::steal(),
3046 OPAMP: OPAMP::steal(),
3047 COMP: COMP::steal(),
3048 }
3049 }
3050}