stm32g0_staging/stm32g0c1/mod.rs
1/*!Peripheral access API for STM32G0C1 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 = 2;
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, 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 RTC_TAMP();
28 fn FLASH();
29 fn RCC_CRS();
30 fn EXTI0_1();
31 fn EXTI2_3();
32 fn EXTI4_15();
33 fn UCPD1_UCPD2_USB();
34 fn DMA1_CHANNEL1();
35 fn DMA1_CHANNEL2_3();
36 fn DMA1_CHANNEL4_5_6_7_DMAMUX_DMA2_CHANNEL1_2_3_4_5();
37 fn ADC_COMP();
38 fn TIM1_BRK_UP_TRG_COM();
39 fn TIM1_CC();
40 fn TIM2();
41 fn TIM3_TIM4();
42 fn TIM6_DAC();
43 fn TIM7();
44 fn TIM14();
45 fn TIM15();
46 fn TIM16();
47 fn TIM17();
48 fn I2C1();
49 fn I2C2_I2C3();
50 fn SPI1();
51 fn SPI2_SPI3();
52 fn USART1();
53 fn USART2_LPUART2();
54 fn USART3_USART4_USART5_USART6_LPUART1();
55 fn CEC();
56 fn AES_RNG();
57}
58#[doc(hidden)]
59#[repr(C)]
60pub union Vector {
61 _handler: unsafe extern "C" fn(),
62 _reserved: u32,
63}
64#[cfg(feature = "rt")]
65#[doc(hidden)]
66#[link_section = ".vector_table.interrupts"]
67#[no_mangle]
68pub static __INTERRUPTS: [Vector; 32] = [
69 Vector { _handler: WWDG },
70 Vector { _handler: PVD },
71 Vector { _handler: RTC_TAMP },
72 Vector { _handler: FLASH },
73 Vector { _handler: RCC_CRS },
74 Vector { _handler: EXTI0_1 },
75 Vector { _handler: EXTI2_3 },
76 Vector { _handler: EXTI4_15 },
77 Vector {
78 _handler: UCPD1_UCPD2_USB,
79 },
80 Vector { _handler: DMA1_CHANNEL1 },
81 Vector {
82 _handler: DMA1_CHANNEL2_3,
83 },
84 Vector {
85 _handler: DMA1_CHANNEL4_5_6_7_DMAMUX_DMA2_CHANNEL1_2_3_4_5,
86 },
87 Vector { _handler: ADC_COMP },
88 Vector {
89 _handler: TIM1_BRK_UP_TRG_COM,
90 },
91 Vector { _handler: TIM1_CC },
92 Vector { _handler: TIM2 },
93 Vector { _handler: TIM3_TIM4 },
94 Vector { _handler: TIM6_DAC },
95 Vector { _handler: TIM7 },
96 Vector { _handler: TIM14 },
97 Vector { _handler: TIM15 },
98 Vector { _handler: TIM16 },
99 Vector { _handler: TIM17 },
100 Vector { _handler: I2C1 },
101 Vector { _handler: I2C2_I2C3 },
102 Vector { _handler: SPI1 },
103 Vector { _handler: SPI2_SPI3 },
104 Vector { _handler: USART1 },
105 Vector { _handler: USART2_LPUART2 },
106 Vector {
107 _handler: USART3_USART4_USART5_USART6_LPUART1,
108 },
109 Vector { _handler: CEC },
110 Vector { _handler: AES_RNG },
111];
112///Enumeration of all the interrupts.
113#[cfg_attr(feature = "defmt", derive(defmt::Format))]
114#[derive(Copy, Clone, Debug, PartialEq, Eq)]
115#[repr(u16)]
116pub enum Interrupt {
117 ///0 - Window watchdog interrupt
118 WWDG = 0,
119 ///1 - Power voltage detector interrupt
120 PVD = 1,
121 ///2 - RTC and TAMP interrupts
122 RTC_TAMP = 2,
123 ///3 - Flash global interrupt
124 FLASH = 3,
125 ///4 - RCC global interrupt
126 RCC_CRS = 4,
127 ///5 - EXTI line 0 and 1 interrupt
128 EXTI0_1 = 5,
129 ///6 - EXTI line 2 and 3 interrupt
130 EXTI2_3 = 6,
131 ///7 - EXTI line 4 to 15 interrupt
132 EXTI4_15 = 7,
133 ///8 - UCPD and USB global interrupt
134 UCPD1_UCPD2_USB = 8,
135 ///9 - DMA1 channel 1 interrupt
136 DMA1_CHANNEL1 = 9,
137 ///10 - DMA1 channel 2 and 3 interrupts
138 DMA1_CHANNEL2_3 = 10,
139 ///11 - DMA1 channel 4, 5, 6, 7, DMAMUX, DMA2 channel 1, 2, 3, 4, 5 interrupts
140 DMA1_CHANNEL4_5_6_7_DMAMUX_DMA2_CHANNEL1_2_3_4_5 = 11,
141 ///12 - ADC and COMP interrupts (ADC combined with EXTI 17 and 18)
142 ADC_COMP = 12,
143 ///13 - TIM1 break, update, trigger and commutation interrupts
144 TIM1_BRK_UP_TRG_COM = 13,
145 ///14 - TIM1 Capture Compare interrupt
146 TIM1_CC = 14,
147 ///15 - TIM2 global interrupt
148 TIM2 = 15,
149 ///16 - TIM3 global interrupt
150 TIM3_TIM4 = 16,
151 ///17 - TIM6 + LPTIM1 and DAC global interrupt
152 TIM6_DAC = 17,
153 ///18 - TIM7 + LPTIM2 global interrupt
154 TIM7 = 18,
155 ///19 - TIM14 global interrupt
156 TIM14 = 19,
157 ///20 - Timer 15 global interrupt
158 TIM15 = 20,
159 ///21 - TIM16 global interrupt
160 TIM16 = 21,
161 ///22 - TIM17 global interrupt
162 TIM17 = 22,
163 ///23 - I2C1 global interrupt
164 I2C1 = 23,
165 ///24 - I2C2 and I2C3 global interrupt
166 I2C2_I2C3 = 24,
167 ///25 - SPI1 gloabl interrupt
168 SPI1 = 25,
169 ///26 - SPI2 gloabl interrupt
170 SPI2_SPI3 = 26,
171 ///27 - USART1 global interrupt
172 USART1 = 27,
173 ///28 - USART2 and LPUART2 global interrupt (combined with EXTI 26)
174 USART2_LPUART2 = 28,
175 ///29 - USART3,4,5,6 and LPUART1 global interrupt (combined with EXTI 28)
176 USART3_USART4_USART5_USART6_LPUART1 = 29,
177 ///30 - CEC global interrupt
178 CEC = 30,
179 ///31 - AES and RNG global interrupts
180 AES_RNG = 31,
181}
182unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
183 #[inline(always)]
184 fn number(self) -> u16 {
185 self as u16
186 }
187}
188///Advanced Encryption Standard
189///
190///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#AES)
191pub struct AES {
192 _marker: PhantomData<*const ()>,
193}
194unsafe impl Send for AES {}
195impl AES {
196 ///Pointer to the register block
197 pub const PTR: *const aes::RegisterBlock = 0x4002_6000 as *const _;
198 ///Return the pointer to the register block
199 #[inline(always)]
200 pub const fn ptr() -> *const aes::RegisterBlock {
201 Self::PTR
202 }
203 /// Steal an instance of this peripheral
204 ///
205 /// # Safety
206 ///
207 /// Ensure that the new instance of the peripheral cannot be used in a way
208 /// that may race with any existing instances, for example by only
209 /// accessing read-only or write-only registers, or by consuming the
210 /// original peripheral and using critical sections to coordinate
211 /// access between multiple new instances.
212 ///
213 /// Additionally, other software such as HALs may rely on only one
214 /// peripheral instance existing to ensure memory safety; ensure
215 /// no stolen instances are passed to such software.
216 pub unsafe fn steal() -> Self {
217 Self { _marker: PhantomData }
218 }
219}
220impl Deref for AES {
221 type Target = aes::RegisterBlock;
222 #[inline(always)]
223 fn deref(&self) -> &Self::Target {
224 unsafe { &*Self::PTR }
225 }
226}
227impl core::fmt::Debug for AES {
228 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
229 f.debug_struct("AES").finish()
230 }
231}
232///Advanced Encryption Standard
233pub mod aes;
234///Analog to Digital Converter
235///
236///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#ADC)
237pub struct ADC {
238 _marker: PhantomData<*const ()>,
239}
240unsafe impl Send for ADC {}
241impl ADC {
242 ///Pointer to the register block
243 pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
244 ///Return the pointer to the register block
245 #[inline(always)]
246 pub const fn ptr() -> *const adc::RegisterBlock {
247 Self::PTR
248 }
249 /// Steal an instance of this peripheral
250 ///
251 /// # Safety
252 ///
253 /// Ensure that the new instance of the peripheral cannot be used in a way
254 /// that may race with any existing instances, for example by only
255 /// accessing read-only or write-only registers, or by consuming the
256 /// original peripheral and using critical sections to coordinate
257 /// access between multiple new instances.
258 ///
259 /// Additionally, other software such as HALs may rely on only one
260 /// peripheral instance existing to ensure memory safety; ensure
261 /// no stolen instances are passed to such software.
262 pub unsafe fn steal() -> Self {
263 Self { _marker: PhantomData }
264 }
265}
266impl Deref for ADC {
267 type Target = adc::RegisterBlock;
268 #[inline(always)]
269 fn deref(&self) -> &Self::Target {
270 unsafe { &*Self::PTR }
271 }
272}
273impl core::fmt::Debug for ADC {
274 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
275 f.debug_struct("ADC").finish()
276 }
277}
278///Analog to Digital Converter
279pub mod adc;
280///Comparator
281///
282///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#COMP)
283pub struct COMP {
284 _marker: PhantomData<*const ()>,
285}
286unsafe impl Send for COMP {}
287impl COMP {
288 ///Pointer to the register block
289 pub const PTR: *const comp::RegisterBlock = 0x4001_0200 as *const _;
290 ///Return the pointer to the register block
291 #[inline(always)]
292 pub const fn ptr() -> *const comp::RegisterBlock {
293 Self::PTR
294 }
295 /// Steal an instance of this peripheral
296 ///
297 /// # Safety
298 ///
299 /// Ensure that the new instance of the peripheral cannot be used in a way
300 /// that may race with any existing instances, for example by only
301 /// accessing read-only or write-only registers, or by consuming the
302 /// original peripheral and using critical sections to coordinate
303 /// access between multiple new instances.
304 ///
305 /// Additionally, other software such as HALs may rely on only one
306 /// peripheral instance existing to ensure memory safety; ensure
307 /// no stolen instances are passed to such software.
308 pub unsafe fn steal() -> Self {
309 Self { _marker: PhantomData }
310 }
311}
312impl Deref for COMP {
313 type Target = comp::RegisterBlock;
314 #[inline(always)]
315 fn deref(&self) -> &Self::Target {
316 unsafe { &*Self::PTR }
317 }
318}
319impl core::fmt::Debug for COMP {
320 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
321 f.debug_struct("COMP").finish()
322 }
323}
324///Comparator
325pub mod comp;
326///Cyclic redundancy check calculation unit
327///
328///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#CRC)
329pub struct CRC {
330 _marker: PhantomData<*const ()>,
331}
332unsafe impl Send for CRC {}
333impl CRC {
334 ///Pointer to the register block
335 pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
336 ///Return the pointer to the register block
337 #[inline(always)]
338 pub const fn ptr() -> *const crc::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 CRC {
359 type Target = crc::RegisterBlock;
360 #[inline(always)]
361 fn deref(&self) -> &Self::Target {
362 unsafe { &*Self::PTR }
363 }
364}
365impl core::fmt::Debug for CRC {
366 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
367 f.debug_struct("CRC").finish()
368 }
369}
370///Cyclic redundancy check calculation unit
371pub mod crc;
372///DAC
373///
374///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#DAC)
375pub struct DAC {
376 _marker: PhantomData<*const ()>,
377}
378unsafe impl Send for DAC {}
379impl DAC {
380 ///Pointer to the register block
381 pub const PTR: *const dac::RegisterBlock = 0x4000_7400 as *const _;
382 ///Return the pointer to the register block
383 #[inline(always)]
384 pub const fn ptr() -> *const dac::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 DAC {
405 type Target = dac::RegisterBlock;
406 #[inline(always)]
407 fn deref(&self) -> &Self::Target {
408 unsafe { &*Self::PTR }
409 }
410}
411impl core::fmt::Debug for DAC {
412 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
413 f.debug_struct("DAC").finish()
414 }
415}
416///DAC
417pub mod dac;
418///Debug support
419///
420///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#DBG)
421pub struct DBG {
422 _marker: PhantomData<*const ()>,
423}
424unsafe impl Send for DBG {}
425impl DBG {
426 ///Pointer to the register block
427 pub const PTR: *const dbg::RegisterBlock = 0x4001_5800 as *const _;
428 ///Return the pointer to the register block
429 #[inline(always)]
430 pub const fn ptr() -> *const dbg::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 DBG {
451 type Target = dbg::RegisterBlock;
452 #[inline(always)]
453 fn deref(&self) -> &Self::Target {
454 unsafe { &*Self::PTR }
455 }
456}
457impl core::fmt::Debug for DBG {
458 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
459 f.debug_struct("DBG").finish()
460 }
461}
462///Debug support
463pub mod dbg;
464///DMAMUX
465///
466///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#DMAMUX)
467pub struct DMAMUX {
468 _marker: PhantomData<*const ()>,
469}
470unsafe impl Send for DMAMUX {}
471impl DMAMUX {
472 ///Pointer to the register block
473 pub const PTR: *const dmamux::RegisterBlock = 0x4002_0800 as *const _;
474 ///Return the pointer to the register block
475 #[inline(always)]
476 pub const fn ptr() -> *const dmamux::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 DMAMUX {
497 type Target = dmamux::RegisterBlock;
498 #[inline(always)]
499 fn deref(&self) -> &Self::Target {
500 unsafe { &*Self::PTR }
501 }
502}
503impl core::fmt::Debug for DMAMUX {
504 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
505 f.debug_struct("DMAMUX").finish()
506 }
507}
508///DMAMUX
509pub mod dmamux;
510///Direct memory access controller
511///
512///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#DMA1)
513pub struct DMA1 {
514 _marker: PhantomData<*const ()>,
515}
516unsafe impl Send for DMA1 {}
517impl DMA1 {
518 ///Pointer to the register block
519 pub const PTR: *const dma1::RegisterBlock = 0x4002_0000 as *const _;
520 ///Return the pointer to the register block
521 #[inline(always)]
522 pub const fn ptr() -> *const dma1::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 DMA1 {
543 type Target = dma1::RegisterBlock;
544 #[inline(always)]
545 fn deref(&self) -> &Self::Target {
546 unsafe { &*Self::PTR }
547 }
548}
549impl core::fmt::Debug for DMA1 {
550 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
551 f.debug_struct("DMA1").finish()
552 }
553}
554///Direct memory access controller
555pub mod dma1;
556///Direct memory access controller
557///
558///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#DMA2)
559pub struct DMA2 {
560 _marker: PhantomData<*const ()>,
561}
562unsafe impl Send for DMA2 {}
563impl DMA2 {
564 ///Pointer to the register block
565 pub const PTR: *const dma2::RegisterBlock = 0x4002_0400 as *const _;
566 ///Return the pointer to the register block
567 #[inline(always)]
568 pub const fn ptr() -> *const dma2::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 DMA2 {
589 type Target = dma2::RegisterBlock;
590 #[inline(always)]
591 fn deref(&self) -> &Self::Target {
592 unsafe { &*Self::PTR }
593 }
594}
595impl core::fmt::Debug for DMA2 {
596 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
597 f.debug_struct("DMA2").finish()
598 }
599}
600///Direct memory access controller
601pub mod dma2;
602///External interrupt/event controller
603///
604///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#EXTI)
605pub struct EXTI {
606 _marker: PhantomData<*const ()>,
607}
608unsafe impl Send for EXTI {}
609impl EXTI {
610 ///Pointer to the register block
611 pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
612 ///Return the pointer to the register block
613 #[inline(always)]
614 pub const fn ptr() -> *const exti::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 EXTI {
635 type Target = exti::RegisterBlock;
636 #[inline(always)]
637 fn deref(&self) -> &Self::Target {
638 unsafe { &*Self::PTR }
639 }
640}
641impl core::fmt::Debug for EXTI {
642 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
643 f.debug_struct("EXTI").finish()
644 }
645}
646///External interrupt/event controller
647pub mod exti;
648///FD controller area network
649///
650///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#FDCAN1)
651pub struct FDCAN1 {
652 _marker: PhantomData<*const ()>,
653}
654unsafe impl Send for FDCAN1 {}
655impl FDCAN1 {
656 ///Pointer to the register block
657 pub const PTR: *const fdcan1::RegisterBlock = 0x4000_6400 as *const _;
658 ///Return the pointer to the register block
659 #[inline(always)]
660 pub const fn ptr() -> *const fdcan1::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 FDCAN1 {
681 type Target = fdcan1::RegisterBlock;
682 #[inline(always)]
683 fn deref(&self) -> &Self::Target {
684 unsafe { &*Self::PTR }
685 }
686}
687impl core::fmt::Debug for FDCAN1 {
688 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
689 f.debug_struct("FDCAN1").finish()
690 }
691}
692///FD controller area network
693pub mod fdcan1;
694///FD controller area network
695///
696///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#FDCAN1)
697pub struct FDCAN2 {
698 _marker: PhantomData<*const ()>,
699}
700unsafe impl Send for FDCAN2 {}
701impl FDCAN2 {
702 ///Pointer to the register block
703 pub const PTR: *const fdcan1::RegisterBlock = 0x4000_6800 as *const _;
704 ///Return the pointer to the register block
705 #[inline(always)]
706 pub const fn ptr() -> *const fdcan1::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 FDCAN2 {
727 type Target = fdcan1::RegisterBlock;
728 #[inline(always)]
729 fn deref(&self) -> &Self::Target {
730 unsafe { &*Self::PTR }
731 }
732}
733impl core::fmt::Debug for FDCAN2 {
734 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
735 f.debug_struct("FDCAN2").finish()
736 }
737}
738///FD controller area network
739pub use self::fdcan1 as fdcan2;
740///Flash
741///
742///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#FLASH)
743pub struct FLASH {
744 _marker: PhantomData<*const ()>,
745}
746unsafe impl Send for FLASH {}
747impl FLASH {
748 ///Pointer to the register block
749 pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
750 ///Return the pointer to the register block
751 #[inline(always)]
752 pub const fn ptr() -> *const flash::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 FLASH {
773 type Target = flash::RegisterBlock;
774 #[inline(always)]
775 fn deref(&self) -> &Self::Target {
776 unsafe { &*Self::PTR }
777 }
778}
779impl core::fmt::Debug for FLASH {
780 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
781 f.debug_struct("FLASH").finish()
782 }
783}
784///Flash
785pub mod flash;
786///General-purpose I/Os
787///
788///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#GPIOA)
789pub struct GPIOA {
790 _marker: PhantomData<*const ()>,
791}
792unsafe impl Send for GPIOA {}
793impl GPIOA {
794 ///Pointer to the register block
795 pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
796 ///Return the pointer to the register block
797 #[inline(always)]
798 pub const fn ptr() -> *const gpioa::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 GPIOA {
819 type Target = gpioa::RegisterBlock;
820 #[inline(always)]
821 fn deref(&self) -> &Self::Target {
822 unsafe { &*Self::PTR }
823 }
824}
825impl core::fmt::Debug for GPIOA {
826 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
827 f.debug_struct("GPIOA").finish()
828 }
829}
830///General-purpose I/Os
831pub mod gpioa;
832///General-purpose I/Os
833///
834///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#GPIOB)
835pub struct GPIOB {
836 _marker: PhantomData<*const ()>,
837}
838unsafe impl Send for GPIOB {}
839impl GPIOB {
840 ///Pointer to the register block
841 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0400 as *const _;
842 ///Return the pointer to the register block
843 #[inline(always)]
844 pub const fn ptr() -> *const gpiob::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 GPIOB {
865 type Target = gpiob::RegisterBlock;
866 #[inline(always)]
867 fn deref(&self) -> &Self::Target {
868 unsafe { &*Self::PTR }
869 }
870}
871impl core::fmt::Debug for GPIOB {
872 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
873 f.debug_struct("GPIOB").finish()
874 }
875}
876///General-purpose I/Os
877pub mod gpiob;
878///General-purpose I/Os
879///
880///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#GPIOB)
881pub struct GPIOC {
882 _marker: PhantomData<*const ()>,
883}
884unsafe impl Send for GPIOC {}
885impl GPIOC {
886 ///Pointer to the register block
887 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0800 as *const _;
888 ///Return the pointer to the register block
889 #[inline(always)]
890 pub const fn ptr() -> *const gpiob::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 GPIOC {
911 type Target = gpiob::RegisterBlock;
912 #[inline(always)]
913 fn deref(&self) -> &Self::Target {
914 unsafe { &*Self::PTR }
915 }
916}
917impl core::fmt::Debug for GPIOC {
918 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
919 f.debug_struct("GPIOC").finish()
920 }
921}
922///General-purpose I/Os
923pub use self::gpiob as gpioc;
924///General-purpose I/Os
925///
926///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#GPIOB)
927pub struct GPIOD {
928 _marker: PhantomData<*const ()>,
929}
930unsafe impl Send for GPIOD {}
931impl GPIOD {
932 ///Pointer to the register block
933 pub const PTR: *const gpiob::RegisterBlock = 0x5000_0c00 as *const _;
934 ///Return the pointer to the register block
935 #[inline(always)]
936 pub const fn ptr() -> *const gpiob::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 GPIOD {
957 type Target = gpiob::RegisterBlock;
958 #[inline(always)]
959 fn deref(&self) -> &Self::Target {
960 unsafe { &*Self::PTR }
961 }
962}
963impl core::fmt::Debug for GPIOD {
964 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
965 f.debug_struct("GPIOD").finish()
966 }
967}
968///General-purpose I/Os
969pub use self::gpiob as gpiod;
970///General-purpose I/Os
971///
972///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#GPIOB)
973pub struct GPIOE {
974 _marker: PhantomData<*const ()>,
975}
976unsafe impl Send for GPIOE {}
977impl GPIOE {
978 ///Pointer to the register block
979 pub const PTR: *const gpiob::RegisterBlock = 0x5000_1000 as *const _;
980 ///Return the pointer to the register block
981 #[inline(always)]
982 pub const fn ptr() -> *const gpiob::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 GPIOE {
1003 type Target = gpiob::RegisterBlock;
1004 #[inline(always)]
1005 fn deref(&self) -> &Self::Target {
1006 unsafe { &*Self::PTR }
1007 }
1008}
1009impl core::fmt::Debug for GPIOE {
1010 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1011 f.debug_struct("GPIOE").finish()
1012 }
1013}
1014///General-purpose I/Os
1015pub use self::gpiob as gpioe;
1016///General-purpose I/Os
1017///
1018///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#GPIOB)
1019pub struct GPIOF {
1020 _marker: PhantomData<*const ()>,
1021}
1022unsafe impl Send for GPIOF {}
1023impl GPIOF {
1024 ///Pointer to the register block
1025 pub const PTR: *const gpiob::RegisterBlock = 0x5000_1400 as *const _;
1026 ///Return the pointer to the register block
1027 #[inline(always)]
1028 pub const fn ptr() -> *const gpiob::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 GPIOF {
1049 type Target = gpiob::RegisterBlock;
1050 #[inline(always)]
1051 fn deref(&self) -> &Self::Target {
1052 unsafe { &*Self::PTR }
1053 }
1054}
1055impl core::fmt::Debug for GPIOF {
1056 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1057 f.debug_struct("GPIOF").finish()
1058 }
1059}
1060///General-purpose I/Os
1061pub use self::gpiob as gpiof;
1062///HDMI-CEC
1063///
1064///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#HDMI_CEC)
1065pub struct HDMI_CEC {
1066 _marker: PhantomData<*const ()>,
1067}
1068unsafe impl Send for HDMI_CEC {}
1069impl HDMI_CEC {
1070 ///Pointer to the register block
1071 pub const PTR: *const hdmi_cec::RegisterBlock = 0x4000_7800 as *const _;
1072 ///Return the pointer to the register block
1073 #[inline(always)]
1074 pub const fn ptr() -> *const hdmi_cec::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 HDMI_CEC {
1095 type Target = hdmi_cec::RegisterBlock;
1096 #[inline(always)]
1097 fn deref(&self) -> &Self::Target {
1098 unsafe { &*Self::PTR }
1099 }
1100}
1101impl core::fmt::Debug for HDMI_CEC {
1102 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1103 f.debug_struct("HDMI_CEC").finish()
1104 }
1105}
1106///HDMI-CEC
1107pub mod hdmi_cec;
1108///Inter-integrated circuit
1109///
1110///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#I2C1)
1111pub struct I2C1 {
1112 _marker: PhantomData<*const ()>,
1113}
1114unsafe impl Send for I2C1 {}
1115impl I2C1 {
1116 ///Pointer to the register block
1117 pub const PTR: *const i2c1::RegisterBlock = 0x4000_5400 as *const _;
1118 ///Return the pointer to the register block
1119 #[inline(always)]
1120 pub const fn ptr() -> *const i2c1::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 I2C1 {
1141 type Target = i2c1::RegisterBlock;
1142 #[inline(always)]
1143 fn deref(&self) -> &Self::Target {
1144 unsafe { &*Self::PTR }
1145 }
1146}
1147impl core::fmt::Debug for I2C1 {
1148 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1149 f.debug_struct("I2C1").finish()
1150 }
1151}
1152///Inter-integrated circuit
1153pub mod i2c1;
1154///Inter-integrated circuit
1155///
1156///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#I2C1)
1157pub struct I2C2 {
1158 _marker: PhantomData<*const ()>,
1159}
1160unsafe impl Send for I2C2 {}
1161impl I2C2 {
1162 ///Pointer to the register block
1163 pub const PTR: *const i2c1::RegisterBlock = 0x4000_5800 as *const _;
1164 ///Return the pointer to the register block
1165 #[inline(always)]
1166 pub const fn ptr() -> *const i2c1::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 I2C2 {
1187 type Target = i2c1::RegisterBlock;
1188 #[inline(always)]
1189 fn deref(&self) -> &Self::Target {
1190 unsafe { &*Self::PTR }
1191 }
1192}
1193impl core::fmt::Debug for I2C2 {
1194 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1195 f.debug_struct("I2C2").finish()
1196 }
1197}
1198///Inter-integrated circuit
1199pub use self::i2c1 as i2c2;
1200///Inter-integrated circuit
1201///
1202///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#I2C1)
1203pub struct I2C3 {
1204 _marker: PhantomData<*const ()>,
1205}
1206unsafe impl Send for I2C3 {}
1207impl I2C3 {
1208 ///Pointer to the register block
1209 pub const PTR: *const i2c1::RegisterBlock = 0x4000_8800 as *const _;
1210 ///Return the pointer to the register block
1211 #[inline(always)]
1212 pub const fn ptr() -> *const i2c1::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 I2C3 {
1233 type Target = i2c1::RegisterBlock;
1234 #[inline(always)]
1235 fn deref(&self) -> &Self::Target {
1236 unsafe { &*Self::PTR }
1237 }
1238}
1239impl core::fmt::Debug for I2C3 {
1240 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1241 f.debug_struct("I2C3").finish()
1242 }
1243}
1244///Inter-integrated circuit
1245pub use self::i2c1 as i2c3;
1246///Independent watchdog
1247///
1248///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#IWDG)
1249pub struct IWDG {
1250 _marker: PhantomData<*const ()>,
1251}
1252unsafe impl Send for IWDG {}
1253impl IWDG {
1254 ///Pointer to the register block
1255 pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
1256 ///Return the pointer to the register block
1257 #[inline(always)]
1258 pub const fn ptr() -> *const iwdg::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 IWDG {
1279 type Target = iwdg::RegisterBlock;
1280 #[inline(always)]
1281 fn deref(&self) -> &Self::Target {
1282 unsafe { &*Self::PTR }
1283 }
1284}
1285impl core::fmt::Debug for IWDG {
1286 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1287 f.debug_struct("IWDG").finish()
1288 }
1289}
1290///Independent watchdog
1291pub mod iwdg;
1292///Low power timer
1293///
1294///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#LPTIM1)
1295pub struct LPTIM1 {
1296 _marker: PhantomData<*const ()>,
1297}
1298unsafe impl Send for LPTIM1 {}
1299impl LPTIM1 {
1300 ///Pointer to the register block
1301 pub const PTR: *const lptim1::RegisterBlock = 0x4000_7c00 as *const _;
1302 ///Return the pointer to the register block
1303 #[inline(always)]
1304 pub const fn ptr() -> *const lptim1::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 LPTIM1 {
1325 type Target = lptim1::RegisterBlock;
1326 #[inline(always)]
1327 fn deref(&self) -> &Self::Target {
1328 unsafe { &*Self::PTR }
1329 }
1330}
1331impl core::fmt::Debug for LPTIM1 {
1332 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1333 f.debug_struct("LPTIM1").finish()
1334 }
1335}
1336///Low power timer
1337pub mod lptim1;
1338///Low power timer
1339///
1340///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#LPTIM1)
1341pub struct LPTIM2 {
1342 _marker: PhantomData<*const ()>,
1343}
1344unsafe impl Send for LPTIM2 {}
1345impl LPTIM2 {
1346 ///Pointer to the register block
1347 pub const PTR: *const lptim1::RegisterBlock = 0x4000_9400 as *const _;
1348 ///Return the pointer to the register block
1349 #[inline(always)]
1350 pub const fn ptr() -> *const lptim1::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 LPTIM2 {
1371 type Target = lptim1::RegisterBlock;
1372 #[inline(always)]
1373 fn deref(&self) -> &Self::Target {
1374 unsafe { &*Self::PTR }
1375 }
1376}
1377impl core::fmt::Debug for LPTIM2 {
1378 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1379 f.debug_struct("LPTIM2").finish()
1380 }
1381}
1382///Low power timer
1383pub use self::lptim1 as lptim2;
1384///Low-power universal asynchronous receiver transmitter
1385///
1386///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#LPUART1)
1387pub struct LPUART1 {
1388 _marker: PhantomData<*const ()>,
1389}
1390unsafe impl Send for LPUART1 {}
1391impl LPUART1 {
1392 ///Pointer to the register block
1393 pub const PTR: *const lpuart1::RegisterBlock = 0x4000_8000 as *const _;
1394 ///Return the pointer to the register block
1395 #[inline(always)]
1396 pub const fn ptr() -> *const lpuart1::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 LPUART1 {
1417 type Target = lpuart1::RegisterBlock;
1418 #[inline(always)]
1419 fn deref(&self) -> &Self::Target {
1420 unsafe { &*Self::PTR }
1421 }
1422}
1423impl core::fmt::Debug for LPUART1 {
1424 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1425 f.debug_struct("LPUART1").finish()
1426 }
1427}
1428///Low-power universal asynchronous receiver transmitter
1429pub mod lpuart1;
1430///Low-power universal asynchronous receiver transmitter
1431///
1432///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#LPUART1)
1433pub struct LPUART2 {
1434 _marker: PhantomData<*const ()>,
1435}
1436unsafe impl Send for LPUART2 {}
1437impl LPUART2 {
1438 ///Pointer to the register block
1439 pub const PTR: *const lpuart1::RegisterBlock = 0x4000_8400 as *const _;
1440 ///Return the pointer to the register block
1441 #[inline(always)]
1442 pub const fn ptr() -> *const lpuart1::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 LPUART2 {
1463 type Target = lpuart1::RegisterBlock;
1464 #[inline(always)]
1465 fn deref(&self) -> &Self::Target {
1466 unsafe { &*Self::PTR }
1467 }
1468}
1469impl core::fmt::Debug for LPUART2 {
1470 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1471 f.debug_struct("LPUART2").finish()
1472 }
1473}
1474///Low-power universal asynchronous receiver transmitter
1475pub use self::lpuart1 as lpuart2;
1476///Power control
1477///
1478///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#PWR)
1479pub struct PWR {
1480 _marker: PhantomData<*const ()>,
1481}
1482unsafe impl Send for PWR {}
1483impl PWR {
1484 ///Pointer to the register block
1485 pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
1486 ///Return the pointer to the register block
1487 #[inline(always)]
1488 pub const fn ptr() -> *const pwr::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 PWR {
1509 type Target = pwr::RegisterBlock;
1510 #[inline(always)]
1511 fn deref(&self) -> &Self::Target {
1512 unsafe { &*Self::PTR }
1513 }
1514}
1515impl core::fmt::Debug for PWR {
1516 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1517 f.debug_struct("PWR").finish()
1518 }
1519}
1520///Power control
1521pub mod pwr;
1522///Reset and clock control
1523///
1524///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#RCC)
1525pub struct RCC {
1526 _marker: PhantomData<*const ()>,
1527}
1528unsafe impl Send for RCC {}
1529impl RCC {
1530 ///Pointer to the register block
1531 pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
1532 ///Return the pointer to the register block
1533 #[inline(always)]
1534 pub const fn ptr() -> *const rcc::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 RCC {
1555 type Target = rcc::RegisterBlock;
1556 #[inline(always)]
1557 fn deref(&self) -> &Self::Target {
1558 unsafe { &*Self::PTR }
1559 }
1560}
1561impl core::fmt::Debug for RCC {
1562 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1563 f.debug_struct("RCC").finish()
1564 }
1565}
1566///Reset and clock control
1567pub mod rcc;
1568///Random number generator
1569///
1570///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#RNG)
1571pub struct RNG {
1572 _marker: PhantomData<*const ()>,
1573}
1574unsafe impl Send for RNG {}
1575impl RNG {
1576 ///Pointer to the register block
1577 pub const PTR: *const rng::RegisterBlock = 0x4002_5000 as *const _;
1578 ///Return the pointer to the register block
1579 #[inline(always)]
1580 pub const fn ptr() -> *const rng::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 RNG {
1601 type Target = rng::RegisterBlock;
1602 #[inline(always)]
1603 fn deref(&self) -> &Self::Target {
1604 unsafe { &*Self::PTR }
1605 }
1606}
1607impl core::fmt::Debug for RNG {
1608 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1609 f.debug_struct("RNG").finish()
1610 }
1611}
1612///Random number generator
1613pub mod rng;
1614///Real-time clock
1615///
1616///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#RTC)
1617pub struct RTC {
1618 _marker: PhantomData<*const ()>,
1619}
1620unsafe impl Send for RTC {}
1621impl RTC {
1622 ///Pointer to the register block
1623 pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
1624 ///Return the pointer to the register block
1625 #[inline(always)]
1626 pub const fn ptr() -> *const rtc::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 RTC {
1647 type Target = rtc::RegisterBlock;
1648 #[inline(always)]
1649 fn deref(&self) -> &Self::Target {
1650 unsafe { &*Self::PTR }
1651 }
1652}
1653impl core::fmt::Debug for RTC {
1654 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1655 f.debug_struct("RTC").finish()
1656 }
1657}
1658///Real-time clock
1659pub mod rtc;
1660///Serial peripheral interface
1661///
1662///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#SPI1)
1663pub struct SPI1 {
1664 _marker: PhantomData<*const ()>,
1665}
1666unsafe impl Send for SPI1 {}
1667impl SPI1 {
1668 ///Pointer to the register block
1669 pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
1670 ///Return the pointer to the register block
1671 #[inline(always)]
1672 pub const fn ptr() -> *const spi1::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 SPI1 {
1693 type Target = spi1::RegisterBlock;
1694 #[inline(always)]
1695 fn deref(&self) -> &Self::Target {
1696 unsafe { &*Self::PTR }
1697 }
1698}
1699impl core::fmt::Debug for SPI1 {
1700 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1701 f.debug_struct("SPI1").finish()
1702 }
1703}
1704///Serial peripheral interface
1705pub mod spi1;
1706///Serial peripheral interface
1707///
1708///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#SPI1)
1709pub struct SPI2 {
1710 _marker: PhantomData<*const ()>,
1711}
1712unsafe impl Send for SPI2 {}
1713impl SPI2 {
1714 ///Pointer to the register block
1715 pub const PTR: *const spi1::RegisterBlock = 0x4000_3800 as *const _;
1716 ///Return the pointer to the register block
1717 #[inline(always)]
1718 pub const fn ptr() -> *const spi1::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 SPI2 {
1739 type Target = spi1::RegisterBlock;
1740 #[inline(always)]
1741 fn deref(&self) -> &Self::Target {
1742 unsafe { &*Self::PTR }
1743 }
1744}
1745impl core::fmt::Debug for SPI2 {
1746 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1747 f.debug_struct("SPI2").finish()
1748 }
1749}
1750///Serial peripheral interface
1751pub use self::spi1 as spi2;
1752///Serial peripheral interface
1753///
1754///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#SPI1)
1755pub struct SPI3 {
1756 _marker: PhantomData<*const ()>,
1757}
1758unsafe impl Send for SPI3 {}
1759impl SPI3 {
1760 ///Pointer to the register block
1761 pub const PTR: *const spi1::RegisterBlock = 0x4000_3c00 as *const _;
1762 ///Return the pointer to the register block
1763 #[inline(always)]
1764 pub const fn ptr() -> *const spi1::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 SPI3 {
1785 type Target = spi1::RegisterBlock;
1786 #[inline(always)]
1787 fn deref(&self) -> &Self::Target {
1788 unsafe { &*Self::PTR }
1789 }
1790}
1791impl core::fmt::Debug for SPI3 {
1792 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1793 f.debug_struct("SPI3").finish()
1794 }
1795}
1796///Serial peripheral interface
1797pub use self::spi1 as spi3;
1798///System configuration controller
1799///
1800///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#SYSCFG)
1801pub struct SYSCFG {
1802 _marker: PhantomData<*const ()>,
1803}
1804unsafe impl Send for SYSCFG {}
1805impl SYSCFG {
1806 ///Pointer to the register block
1807 pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
1808 ///Return the pointer to the register block
1809 #[inline(always)]
1810 pub const fn ptr() -> *const syscfg::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 SYSCFG {
1831 type Target = syscfg::RegisterBlock;
1832 #[inline(always)]
1833 fn deref(&self) -> &Self::Target {
1834 unsafe { &*Self::PTR }
1835 }
1836}
1837impl core::fmt::Debug for SYSCFG {
1838 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1839 f.debug_struct("SYSCFG").finish()
1840 }
1841}
1842///System configuration controller
1843pub mod syscfg;
1844///Tamper and backup registers
1845///
1846///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TAMP)
1847pub struct TAMP {
1848 _marker: PhantomData<*const ()>,
1849}
1850unsafe impl Send for TAMP {}
1851impl TAMP {
1852 ///Pointer to the register block
1853 pub const PTR: *const tamp::RegisterBlock = 0x4000_b000 as *const _;
1854 ///Return the pointer to the register block
1855 #[inline(always)]
1856 pub const fn ptr() -> *const tamp::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 TAMP {
1877 type Target = tamp::RegisterBlock;
1878 #[inline(always)]
1879 fn deref(&self) -> &Self::Target {
1880 unsafe { &*Self::PTR }
1881 }
1882}
1883impl core::fmt::Debug for TAMP {
1884 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1885 f.debug_struct("TAMP").finish()
1886 }
1887}
1888///Tamper and backup registers
1889pub mod tamp;
1890///Advanced-timers
1891///
1892///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM1)
1893pub struct TIM1 {
1894 _marker: PhantomData<*const ()>,
1895}
1896unsafe impl Send for TIM1 {}
1897impl TIM1 {
1898 ///Pointer to the register block
1899 pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
1900 ///Return the pointer to the register block
1901 #[inline(always)]
1902 pub const fn ptr() -> *const tim1::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 TIM1 {
1923 type Target = tim1::RegisterBlock;
1924 #[inline(always)]
1925 fn deref(&self) -> &Self::Target {
1926 unsafe { &*Self::PTR }
1927 }
1928}
1929impl core::fmt::Debug for TIM1 {
1930 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1931 f.debug_struct("TIM1").finish()
1932 }
1933}
1934///Advanced-timers
1935pub mod tim1;
1936///General-purpose-timers
1937///
1938///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM2)
1939pub struct TIM2 {
1940 _marker: PhantomData<*const ()>,
1941}
1942unsafe impl Send for TIM2 {}
1943impl TIM2 {
1944 ///Pointer to the register block
1945 pub const PTR: *const tim2::RegisterBlock = 0x4000_0000 as *const _;
1946 ///Return the pointer to the register block
1947 #[inline(always)]
1948 pub const fn ptr() -> *const tim2::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 TIM2 {
1969 type Target = tim2::RegisterBlock;
1970 #[inline(always)]
1971 fn deref(&self) -> &Self::Target {
1972 unsafe { &*Self::PTR }
1973 }
1974}
1975impl core::fmt::Debug for TIM2 {
1976 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1977 f.debug_struct("TIM2").finish()
1978 }
1979}
1980///General-purpose-timers
1981pub mod tim2;
1982///General-purpose-timers
1983///
1984///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM3)
1985pub struct TIM3 {
1986 _marker: PhantomData<*const ()>,
1987}
1988unsafe impl Send for TIM3 {}
1989impl TIM3 {
1990 ///Pointer to the register block
1991 pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
1992 ///Return the pointer to the register block
1993 #[inline(always)]
1994 pub const fn ptr() -> *const tim3::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 TIM3 {
2015 type Target = tim3::RegisterBlock;
2016 #[inline(always)]
2017 fn deref(&self) -> &Self::Target {
2018 unsafe { &*Self::PTR }
2019 }
2020}
2021impl core::fmt::Debug for TIM3 {
2022 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2023 f.debug_struct("TIM3").finish()
2024 }
2025}
2026///General-purpose-timers
2027pub mod tim3;
2028///General-purpose-timers
2029///
2030///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM2)
2031pub struct TIM4 {
2032 _marker: PhantomData<*const ()>,
2033}
2034unsafe impl Send for TIM4 {}
2035impl TIM4 {
2036 ///Pointer to the register block
2037 pub const PTR: *const tim2::RegisterBlock = 0x4000_0800 as *const _;
2038 ///Return the pointer to the register block
2039 #[inline(always)]
2040 pub const fn ptr() -> *const tim2::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 TIM4 {
2061 type Target = tim2::RegisterBlock;
2062 #[inline(always)]
2063 fn deref(&self) -> &Self::Target {
2064 unsafe { &*Self::PTR }
2065 }
2066}
2067impl core::fmt::Debug for TIM4 {
2068 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2069 f.debug_struct("TIM4").finish()
2070 }
2071}
2072///General-purpose-timers
2073pub use self::tim2 as tim4;
2074///Basic timers
2075///
2076///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM6)
2077pub struct TIM6 {
2078 _marker: PhantomData<*const ()>,
2079}
2080unsafe impl Send for TIM6 {}
2081impl TIM6 {
2082 ///Pointer to the register block
2083 pub const PTR: *const tim6::RegisterBlock = 0x4000_1000 as *const _;
2084 ///Return the pointer to the register block
2085 #[inline(always)]
2086 pub const fn ptr() -> *const tim6::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 TIM6 {
2107 type Target = tim6::RegisterBlock;
2108 #[inline(always)]
2109 fn deref(&self) -> &Self::Target {
2110 unsafe { &*Self::PTR }
2111 }
2112}
2113impl core::fmt::Debug for TIM6 {
2114 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2115 f.debug_struct("TIM6").finish()
2116 }
2117}
2118///Basic timers
2119pub mod tim6;
2120///Basic timers
2121///
2122///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM6)
2123pub struct TIM7 {
2124 _marker: PhantomData<*const ()>,
2125}
2126unsafe impl Send for TIM7 {}
2127impl TIM7 {
2128 ///Pointer to the register block
2129 pub const PTR: *const tim6::RegisterBlock = 0x4000_1400 as *const _;
2130 ///Return the pointer to the register block
2131 #[inline(always)]
2132 pub const fn ptr() -> *const tim6::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 TIM7 {
2153 type Target = tim6::RegisterBlock;
2154 #[inline(always)]
2155 fn deref(&self) -> &Self::Target {
2156 unsafe { &*Self::PTR }
2157 }
2158}
2159impl core::fmt::Debug for TIM7 {
2160 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2161 f.debug_struct("TIM7").finish()
2162 }
2163}
2164///Basic timers
2165pub use self::tim6 as tim7;
2166///General purpose timers
2167///
2168///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM14)
2169pub struct TIM14 {
2170 _marker: PhantomData<*const ()>,
2171}
2172unsafe impl Send for TIM14 {}
2173impl TIM14 {
2174 ///Pointer to the register block
2175 pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
2176 ///Return the pointer to the register block
2177 #[inline(always)]
2178 pub const fn ptr() -> *const tim14::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 TIM14 {
2199 type Target = tim14::RegisterBlock;
2200 #[inline(always)]
2201 fn deref(&self) -> &Self::Target {
2202 unsafe { &*Self::PTR }
2203 }
2204}
2205impl core::fmt::Debug for TIM14 {
2206 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2207 f.debug_struct("TIM14").finish()
2208 }
2209}
2210///General purpose timers
2211pub mod tim14;
2212///General purpose timers
2213///
2214///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM15)
2215pub struct TIM15 {
2216 _marker: PhantomData<*const ()>,
2217}
2218unsafe impl Send for TIM15 {}
2219impl TIM15 {
2220 ///Pointer to the register block
2221 pub const PTR: *const tim15::RegisterBlock = 0x4001_4000 as *const _;
2222 ///Return the pointer to the register block
2223 #[inline(always)]
2224 pub const fn ptr() -> *const tim15::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 TIM15 {
2245 type Target = tim15::RegisterBlock;
2246 #[inline(always)]
2247 fn deref(&self) -> &Self::Target {
2248 unsafe { &*Self::PTR }
2249 }
2250}
2251impl core::fmt::Debug for TIM15 {
2252 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2253 f.debug_struct("TIM15").finish()
2254 }
2255}
2256///General purpose timers
2257pub mod tim15;
2258///General purpose timers
2259///
2260///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM16)
2261pub struct TIM16 {
2262 _marker: PhantomData<*const ()>,
2263}
2264unsafe impl Send for TIM16 {}
2265impl TIM16 {
2266 ///Pointer to the register block
2267 pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
2268 ///Return the pointer to the register block
2269 #[inline(always)]
2270 pub const fn ptr() -> *const tim16::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 TIM16 {
2291 type Target = tim16::RegisterBlock;
2292 #[inline(always)]
2293 fn deref(&self) -> &Self::Target {
2294 unsafe { &*Self::PTR }
2295 }
2296}
2297impl core::fmt::Debug for TIM16 {
2298 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2299 f.debug_struct("TIM16").finish()
2300 }
2301}
2302///General purpose timers
2303pub mod tim16;
2304///General purpose timers
2305///
2306///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#TIM16)
2307pub struct TIM17 {
2308 _marker: PhantomData<*const ()>,
2309}
2310unsafe impl Send for TIM17 {}
2311impl TIM17 {
2312 ///Pointer to the register block
2313 pub const PTR: *const tim16::RegisterBlock = 0x4001_4800 as *const _;
2314 ///Return the pointer to the register block
2315 #[inline(always)]
2316 pub const fn ptr() -> *const tim16::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 TIM17 {
2337 type Target = tim16::RegisterBlock;
2338 #[inline(always)]
2339 fn deref(&self) -> &Self::Target {
2340 unsafe { &*Self::PTR }
2341 }
2342}
2343impl core::fmt::Debug for TIM17 {
2344 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2345 f.debug_struct("TIM17").finish()
2346 }
2347}
2348///General purpose timers
2349pub use self::tim16 as tim17;
2350///USB Power Delivery interface
2351///
2352///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#UCPD1)
2353pub struct UCPD1 {
2354 _marker: PhantomData<*const ()>,
2355}
2356unsafe impl Send for UCPD1 {}
2357impl UCPD1 {
2358 ///Pointer to the register block
2359 pub const PTR: *const ucpd1::RegisterBlock = 0x4000_a000 as *const _;
2360 ///Return the pointer to the register block
2361 #[inline(always)]
2362 pub const fn ptr() -> *const ucpd1::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 UCPD1 {
2383 type Target = ucpd1::RegisterBlock;
2384 #[inline(always)]
2385 fn deref(&self) -> &Self::Target {
2386 unsafe { &*Self::PTR }
2387 }
2388}
2389impl core::fmt::Debug for UCPD1 {
2390 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2391 f.debug_struct("UCPD1").finish()
2392 }
2393}
2394///USB Power Delivery interface
2395pub mod ucpd1;
2396///USB Power Delivery interface
2397///
2398///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#UCPD1)
2399pub struct UCPD2 {
2400 _marker: PhantomData<*const ()>,
2401}
2402unsafe impl Send for UCPD2 {}
2403impl UCPD2 {
2404 ///Pointer to the register block
2405 pub const PTR: *const ucpd1::RegisterBlock = 0x4000_a400 as *const _;
2406 ///Return the pointer to the register block
2407 #[inline(always)]
2408 pub const fn ptr() -> *const ucpd1::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 UCPD2 {
2429 type Target = ucpd1::RegisterBlock;
2430 #[inline(always)]
2431 fn deref(&self) -> &Self::Target {
2432 unsafe { &*Self::PTR }
2433 }
2434}
2435impl core::fmt::Debug for UCPD2 {
2436 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2437 f.debug_struct("UCPD2").finish()
2438 }
2439}
2440///USB Power Delivery interface
2441pub use self::ucpd1 as ucpd2;
2442///Universal synchronous asynchronous receiver transmitter
2443///
2444///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USART1)
2445pub struct USART1 {
2446 _marker: PhantomData<*const ()>,
2447}
2448unsafe impl Send for USART1 {}
2449impl USART1 {
2450 ///Pointer to the register block
2451 pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
2452 ///Return the pointer to the register block
2453 #[inline(always)]
2454 pub const fn ptr() -> *const usart1::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 USART1 {
2475 type Target = usart1::RegisterBlock;
2476 #[inline(always)]
2477 fn deref(&self) -> &Self::Target {
2478 unsafe { &*Self::PTR }
2479 }
2480}
2481impl core::fmt::Debug for USART1 {
2482 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2483 f.debug_struct("USART1").finish()
2484 }
2485}
2486///Universal synchronous asynchronous receiver transmitter
2487pub mod usart1;
2488///Universal synchronous asynchronous receiver transmitter
2489///
2490///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USART1)
2491pub struct USART2 {
2492 _marker: PhantomData<*const ()>,
2493}
2494unsafe impl Send for USART2 {}
2495impl USART2 {
2496 ///Pointer to the register block
2497 pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
2498 ///Return the pointer to the register block
2499 #[inline(always)]
2500 pub const fn ptr() -> *const usart1::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 USART2 {
2521 type Target = usart1::RegisterBlock;
2522 #[inline(always)]
2523 fn deref(&self) -> &Self::Target {
2524 unsafe { &*Self::PTR }
2525 }
2526}
2527impl core::fmt::Debug for USART2 {
2528 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2529 f.debug_struct("USART2").finish()
2530 }
2531}
2532///Universal synchronous asynchronous receiver transmitter
2533pub use self::usart1 as usart2;
2534///Universal synchronous asynchronous receiver transmitter
2535///
2536///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USART1)
2537pub struct USART3 {
2538 _marker: PhantomData<*const ()>,
2539}
2540unsafe impl Send for USART3 {}
2541impl USART3 {
2542 ///Pointer to the register block
2543 pub const PTR: *const usart1::RegisterBlock = 0x4000_4800 as *const _;
2544 ///Return the pointer to the register block
2545 #[inline(always)]
2546 pub const fn ptr() -> *const usart1::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 USART3 {
2567 type Target = usart1::RegisterBlock;
2568 #[inline(always)]
2569 fn deref(&self) -> &Self::Target {
2570 unsafe { &*Self::PTR }
2571 }
2572}
2573impl core::fmt::Debug for USART3 {
2574 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2575 f.debug_struct("USART3").finish()
2576 }
2577}
2578///Universal synchronous asynchronous receiver transmitter
2579pub use self::usart1 as usart3;
2580///Universal synchronous asynchronous receiver transmitter
2581///
2582///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USART1)
2583pub struct USART4 {
2584 _marker: PhantomData<*const ()>,
2585}
2586unsafe impl Send for USART4 {}
2587impl USART4 {
2588 ///Pointer to the register block
2589 pub const PTR: *const usart1::RegisterBlock = 0x4000_4c00 as *const _;
2590 ///Return the pointer to the register block
2591 #[inline(always)]
2592 pub const fn ptr() -> *const usart1::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 USART4 {
2613 type Target = usart1::RegisterBlock;
2614 #[inline(always)]
2615 fn deref(&self) -> &Self::Target {
2616 unsafe { &*Self::PTR }
2617 }
2618}
2619impl core::fmt::Debug for USART4 {
2620 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2621 f.debug_struct("USART4").finish()
2622 }
2623}
2624///Universal synchronous asynchronous receiver transmitter
2625pub use self::usart1 as usart4;
2626///Universal synchronous asynchronous receiver transmitter
2627///
2628///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USART1)
2629pub struct USART5 {
2630 _marker: PhantomData<*const ()>,
2631}
2632unsafe impl Send for USART5 {}
2633impl USART5 {
2634 ///Pointer to the register block
2635 pub const PTR: *const usart1::RegisterBlock = 0x4000_5000 as *const _;
2636 ///Return the pointer to the register block
2637 #[inline(always)]
2638 pub const fn ptr() -> *const usart1::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 USART5 {
2659 type Target = usart1::RegisterBlock;
2660 #[inline(always)]
2661 fn deref(&self) -> &Self::Target {
2662 unsafe { &*Self::PTR }
2663 }
2664}
2665impl core::fmt::Debug for USART5 {
2666 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2667 f.debug_struct("USART5").finish()
2668 }
2669}
2670///Universal synchronous asynchronous receiver transmitter
2671pub use self::usart1 as usart5;
2672///Universal synchronous asynchronous receiver transmitter
2673///
2674///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USART1)
2675pub struct USART6 {
2676 _marker: PhantomData<*const ()>,
2677}
2678unsafe impl Send for USART6 {}
2679impl USART6 {
2680 ///Pointer to the register block
2681 pub const PTR: *const usart1::RegisterBlock = 0x4001_3c00 as *const _;
2682 ///Return the pointer to the register block
2683 #[inline(always)]
2684 pub const fn ptr() -> *const usart1::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 USART6 {
2705 type Target = usart1::RegisterBlock;
2706 #[inline(always)]
2707 fn deref(&self) -> &Self::Target {
2708 unsafe { &*Self::PTR }
2709 }
2710}
2711impl core::fmt::Debug for USART6 {
2712 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2713 f.debug_struct("USART6").finish()
2714 }
2715}
2716///Universal synchronous asynchronous receiver transmitter
2717pub use self::usart1 as usart6;
2718///Universal serial bus full-speed host/device interface
2719///
2720///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USB)
2721pub struct USB {
2722 _marker: PhantomData<*const ()>,
2723}
2724unsafe impl Send for USB {}
2725impl USB {
2726 ///Pointer to the register block
2727 pub const PTR: *const usb::RegisterBlock = 0x4000_5c00 as *const _;
2728 ///Return the pointer to the register block
2729 #[inline(always)]
2730 pub const fn ptr() -> *const usb::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 USB {
2751 type Target = usb::RegisterBlock;
2752 #[inline(always)]
2753 fn deref(&self) -> &Self::Target {
2754 unsafe { &*Self::PTR }
2755 }
2756}
2757impl core::fmt::Debug for USB {
2758 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2759 f.debug_struct("USB").finish()
2760 }
2761}
2762///Universal serial bus full-speed host/device interface
2763pub mod usb;
2764///System configuration controller
2765///
2766///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#VREFBUF)
2767pub struct VREFBUF {
2768 _marker: PhantomData<*const ()>,
2769}
2770unsafe impl Send for VREFBUF {}
2771impl VREFBUF {
2772 ///Pointer to the register block
2773 pub const PTR: *const vrefbuf::RegisterBlock = 0x4001_0030 as *const _;
2774 ///Return the pointer to the register block
2775 #[inline(always)]
2776 pub const fn ptr() -> *const vrefbuf::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 VREFBUF {
2797 type Target = vrefbuf::RegisterBlock;
2798 #[inline(always)]
2799 fn deref(&self) -> &Self::Target {
2800 unsafe { &*Self::PTR }
2801 }
2802}
2803impl core::fmt::Debug for VREFBUF {
2804 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2805 f.debug_struct("VREFBUF").finish()
2806 }
2807}
2808///System configuration controller
2809pub mod vrefbuf;
2810///System window watchdog
2811///
2812///See peripheral [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#WWDG)
2813pub struct WWDG {
2814 _marker: PhantomData<*const ()>,
2815}
2816unsafe impl Send for WWDG {}
2817impl WWDG {
2818 ///Pointer to the register block
2819 pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
2820 ///Return the pointer to the register block
2821 #[inline(always)]
2822 pub const fn ptr() -> *const wwdg::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 WWDG {
2843 type Target = wwdg::RegisterBlock;
2844 #[inline(always)]
2845 fn deref(&self) -> &Self::Target {
2846 unsafe { &*Self::PTR }
2847 }
2848}
2849impl core::fmt::Debug for WWDG {
2850 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2851 f.debug_struct("WWDG").finish()
2852 }
2853}
2854///System window watchdog
2855pub mod wwdg;
2856#[no_mangle]
2857static mut DEVICE_PERIPHERALS: bool = false;
2858/// All the peripherals.
2859#[allow(non_snake_case)]
2860pub struct Peripherals {
2861 ///AES
2862 pub AES: AES,
2863 ///ADC
2864 pub ADC: ADC,
2865 ///COMP
2866 pub COMP: COMP,
2867 ///CRC
2868 pub CRC: CRC,
2869 ///DAC
2870 pub DAC: DAC,
2871 ///DBG
2872 pub DBG: DBG,
2873 ///DMAMUX
2874 pub DMAMUX: DMAMUX,
2875 ///DMA1
2876 pub DMA1: DMA1,
2877 ///DMA2
2878 pub DMA2: DMA2,
2879 ///EXTI
2880 pub EXTI: EXTI,
2881 ///FDCAN1
2882 pub FDCAN1: FDCAN1,
2883 ///FDCAN2
2884 pub FDCAN2: FDCAN2,
2885 ///FLASH
2886 pub FLASH: FLASH,
2887 ///GPIOA
2888 pub GPIOA: GPIOA,
2889 ///GPIOB
2890 pub GPIOB: GPIOB,
2891 ///GPIOC
2892 pub GPIOC: GPIOC,
2893 ///GPIOD
2894 pub GPIOD: GPIOD,
2895 ///GPIOE
2896 pub GPIOE: GPIOE,
2897 ///GPIOF
2898 pub GPIOF: GPIOF,
2899 ///HDMI_CEC
2900 pub HDMI_CEC: HDMI_CEC,
2901 ///I2C1
2902 pub I2C1: I2C1,
2903 ///I2C2
2904 pub I2C2: I2C2,
2905 ///I2C3
2906 pub I2C3: I2C3,
2907 ///IWDG
2908 pub IWDG: IWDG,
2909 ///LPTIM1
2910 pub LPTIM1: LPTIM1,
2911 ///LPTIM2
2912 pub LPTIM2: LPTIM2,
2913 ///LPUART1
2914 pub LPUART1: LPUART1,
2915 ///LPUART2
2916 pub LPUART2: LPUART2,
2917 ///PWR
2918 pub PWR: PWR,
2919 ///RCC
2920 pub RCC: RCC,
2921 ///RNG
2922 pub RNG: RNG,
2923 ///RTC
2924 pub RTC: RTC,
2925 ///SPI1
2926 pub SPI1: SPI1,
2927 ///SPI2
2928 pub SPI2: SPI2,
2929 ///SPI3
2930 pub SPI3: SPI3,
2931 ///SYSCFG
2932 pub SYSCFG: SYSCFG,
2933 ///TAMP
2934 pub TAMP: TAMP,
2935 ///TIM1
2936 pub TIM1: TIM1,
2937 ///TIM2
2938 pub TIM2: TIM2,
2939 ///TIM3
2940 pub TIM3: TIM3,
2941 ///TIM4
2942 pub TIM4: TIM4,
2943 ///TIM6
2944 pub TIM6: TIM6,
2945 ///TIM7
2946 pub TIM7: TIM7,
2947 ///TIM14
2948 pub TIM14: TIM14,
2949 ///TIM15
2950 pub TIM15: TIM15,
2951 ///TIM16
2952 pub TIM16: TIM16,
2953 ///TIM17
2954 pub TIM17: TIM17,
2955 ///UCPD1
2956 pub UCPD1: UCPD1,
2957 ///UCPD2
2958 pub UCPD2: UCPD2,
2959 ///USART1
2960 pub USART1: USART1,
2961 ///USART2
2962 pub USART2: USART2,
2963 ///USART3
2964 pub USART3: USART3,
2965 ///USART4
2966 pub USART4: USART4,
2967 ///USART5
2968 pub USART5: USART5,
2969 ///USART6
2970 pub USART6: USART6,
2971 ///USB
2972 pub USB: USB,
2973 ///VREFBUF
2974 pub VREFBUF: VREFBUF,
2975 ///WWDG
2976 pub WWDG: WWDG,
2977}
2978impl Peripherals {
2979 /// Returns all the peripherals *once*.
2980 #[cfg(feature = "critical-section")]
2981 #[inline]
2982 pub fn take() -> Option<Self> {
2983 critical_section::with(|_| {
2984 if unsafe { DEVICE_PERIPHERALS } {
2985 return None;
2986 }
2987 Some(unsafe { Peripherals::steal() })
2988 })
2989 }
2990 /// Unchecked version of `Peripherals::take`.
2991 ///
2992 /// # Safety
2993 ///
2994 /// Each of the returned peripherals must be used at most once.
2995 #[inline]
2996 pub unsafe fn steal() -> Self {
2997 DEVICE_PERIPHERALS = true;
2998 Peripherals {
2999 AES: AES::steal(),
3000 ADC: ADC::steal(),
3001 COMP: COMP::steal(),
3002 CRC: CRC::steal(),
3003 DAC: DAC::steal(),
3004 DBG: DBG::steal(),
3005 DMAMUX: DMAMUX::steal(),
3006 DMA1: DMA1::steal(),
3007 DMA2: DMA2::steal(),
3008 EXTI: EXTI::steal(),
3009 FDCAN1: FDCAN1::steal(),
3010 FDCAN2: FDCAN2::steal(),
3011 FLASH: FLASH::steal(),
3012 GPIOA: GPIOA::steal(),
3013 GPIOB: GPIOB::steal(),
3014 GPIOC: GPIOC::steal(),
3015 GPIOD: GPIOD::steal(),
3016 GPIOE: GPIOE::steal(),
3017 GPIOF: GPIOF::steal(),
3018 HDMI_CEC: HDMI_CEC::steal(),
3019 I2C1: I2C1::steal(),
3020 I2C2: I2C2::steal(),
3021 I2C3: I2C3::steal(),
3022 IWDG: IWDG::steal(),
3023 LPTIM1: LPTIM1::steal(),
3024 LPTIM2: LPTIM2::steal(),
3025 LPUART1: LPUART1::steal(),
3026 LPUART2: LPUART2::steal(),
3027 PWR: PWR::steal(),
3028 RCC: RCC::steal(),
3029 RNG: RNG::steal(),
3030 RTC: RTC::steal(),
3031 SPI1: SPI1::steal(),
3032 SPI2: SPI2::steal(),
3033 SPI3: SPI3::steal(),
3034 SYSCFG: SYSCFG::steal(),
3035 TAMP: TAMP::steal(),
3036 TIM1: TIM1::steal(),
3037 TIM2: TIM2::steal(),
3038 TIM3: TIM3::steal(),
3039 TIM4: TIM4::steal(),
3040 TIM6: TIM6::steal(),
3041 TIM7: TIM7::steal(),
3042 TIM14: TIM14::steal(),
3043 TIM15: TIM15::steal(),
3044 TIM16: TIM16::steal(),
3045 TIM17: TIM17::steal(),
3046 UCPD1: UCPD1::steal(),
3047 UCPD2: UCPD2::steal(),
3048 USART1: USART1::steal(),
3049 USART2: USART2::steal(),
3050 USART3: USART3::steal(),
3051 USART4: USART4::steal(),
3052 USART5: USART5::steal(),
3053 USART6: USART6::steal(),
3054 USB: USB::steal(),
3055 VREFBUF: VREFBUF::steal(),
3056 WWDG: WWDG::steal(),
3057 }
3058 }
3059}