1#![doc = "Peripheral access API for EFM32TG222F16 microcontrollers (generated using svd2rust v0.24.0 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next]
2svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.24.0/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"]
3#![deny(const_err)]
4#![deny(dead_code)]
5#![deny(improper_ctypes)]
6#![deny(missing_docs)]
7#![deny(no_mangle_generic_items)]
8#![deny(non_shorthand_field_patterns)]
9#![deny(overflowing_literals)]
10#![deny(path_statements)]
11#![deny(patterns_in_fns_without_body)]
12#![deny(private_in_public)]
13#![deny(unconditional_recursion)]
14#![deny(unused_allocation)]
15#![deny(unused_comparisons)]
16#![deny(unused_parens)]
17#![deny(while_true)]
18#![allow(non_camel_case_types)]
19#![allow(non_snake_case)]
20#![no_std]
21use core::marker::PhantomData;
22use core::ops::Deref;
23#[doc = r"Number available in the NVIC for configuring priority"]
24pub const NVIC_PRIO_BITS: u8 = 3;
25#[cfg(feature = "rt")]
26pub use self::Interrupt as interrupt;
27pub use cortex_m::peripheral::Peripherals as CorePeripherals;
28pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
29#[cfg(feature = "rt")]
30pub use cortex_m_rt::interrupt;
31#[allow(unused_imports)]
32use generic::*;
33#[doc = r"Common register and bit access and modify traits"]
34pub mod generic;
35#[cfg(feature = "rt")]
36extern "C" {
37 fn DMA();
38 fn GPIO_EVEN();
39 fn TIMER0();
40 fn USART0_RX();
41 fn USART0_TX();
42 fn ACMP0();
43 fn ADC0();
44 fn DAC0();
45 fn I2C0();
46 fn GPIO_ODD();
47 fn TIMER1();
48 fn USART1_RX();
49 fn USART1_TX();
50 fn LESENSE();
51 fn LEUART0();
52 fn LETIMER0();
53 fn PCNT0();
54 fn RTC();
55 fn CMU();
56 fn VCMP();
57 fn MSC();
58 fn AES();
59}
60#[doc(hidden)]
61pub union Vector {
62 _handler: unsafe extern "C" fn(),
63 _reserved: u32,
64}
65#[cfg(feature = "rt")]
66#[doc(hidden)]
67#[link_section = ".vector_table.interrupts"]
68#[no_mangle]
69pub static __INTERRUPTS: [Vector; 23] = [
70 Vector { _handler: DMA },
71 Vector {
72 _handler: GPIO_EVEN,
73 },
74 Vector { _handler: TIMER0 },
75 Vector {
76 _handler: USART0_RX,
77 },
78 Vector {
79 _handler: USART0_TX,
80 },
81 Vector { _handler: ACMP0 },
82 Vector { _handler: ADC0 },
83 Vector { _handler: DAC0 },
84 Vector { _handler: I2C0 },
85 Vector { _handler: GPIO_ODD },
86 Vector { _handler: TIMER1 },
87 Vector {
88 _handler: USART1_RX,
89 },
90 Vector {
91 _handler: USART1_TX,
92 },
93 Vector { _handler: LESENSE },
94 Vector { _handler: LEUART0 },
95 Vector { _handler: LETIMER0 },
96 Vector { _handler: PCNT0 },
97 Vector { _handler: RTC },
98 Vector { _handler: CMU },
99 Vector { _handler: VCMP },
100 Vector { _reserved: 0 },
101 Vector { _handler: MSC },
102 Vector { _handler: AES },
103];
104#[doc = r"Enumeration of all the interrupts."]
105#[derive(Copy, Clone, Debug, PartialEq, Eq)]
106#[repr(u16)]
107pub enum Interrupt {
108 #[doc = "0 - DMA"]
109 DMA = 0,
110 #[doc = "1 - GPIO_EVEN"]
111 GPIO_EVEN = 1,
112 #[doc = "2 - TIMER0"]
113 TIMER0 = 2,
114 #[doc = "3 - USART0_RX"]
115 USART0_RX = 3,
116 #[doc = "4 - USART0_TX"]
117 USART0_TX = 4,
118 #[doc = "5 - ACMP0"]
119 ACMP0 = 5,
120 #[doc = "6 - ADC0"]
121 ADC0 = 6,
122 #[doc = "7 - DAC0"]
123 DAC0 = 7,
124 #[doc = "8 - I2C0"]
125 I2C0 = 8,
126 #[doc = "9 - GPIO_ODD"]
127 GPIO_ODD = 9,
128 #[doc = "10 - TIMER1"]
129 TIMER1 = 10,
130 #[doc = "11 - USART1_RX"]
131 USART1_RX = 11,
132 #[doc = "12 - USART1_TX"]
133 USART1_TX = 12,
134 #[doc = "13 - LESENSE"]
135 LESENSE = 13,
136 #[doc = "14 - LEUART0"]
137 LEUART0 = 14,
138 #[doc = "15 - LETIMER0"]
139 LETIMER0 = 15,
140 #[doc = "16 - PCNT0"]
141 PCNT0 = 16,
142 #[doc = "17 - RTC"]
143 RTC = 17,
144 #[doc = "18 - CMU"]
145 CMU = 18,
146 #[doc = "19 - VCMP"]
147 VCMP = 19,
148 #[doc = "21 - MSC"]
149 MSC = 21,
150 #[doc = "22 - AES"]
151 AES = 22,
152}
153unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
154 #[inline(always)]
155 fn number(self) -> u16 {
156 self as u16
157 }
158}
159#[doc = "AES"]
160pub struct AES {
161 _marker: PhantomData<*const ()>,
162}
163unsafe impl Send for AES {}
164impl AES {
165 #[doc = r"Pointer to the register block"]
166 pub const PTR: *const aes::RegisterBlock = 0x400e_0000 as *const _;
167 #[doc = r"Return the pointer to the register block"]
168 #[inline(always)]
169 pub const fn ptr() -> *const aes::RegisterBlock {
170 Self::PTR
171 }
172}
173impl Deref for AES {
174 type Target = aes::RegisterBlock;
175 #[inline(always)]
176 fn deref(&self) -> &Self::Target {
177 unsafe { &*Self::PTR }
178 }
179}
180impl core::fmt::Debug for AES {
181 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
182 f.debug_struct("AES").finish()
183 }
184}
185#[doc = "AES"]
186pub mod aes;
187#[doc = "DMA"]
188pub struct DMA {
189 _marker: PhantomData<*const ()>,
190}
191unsafe impl Send for DMA {}
192impl DMA {
193 #[doc = r"Pointer to the register block"]
194 pub const PTR: *const dma::RegisterBlock = 0x400c_2000 as *const _;
195 #[doc = r"Return the pointer to the register block"]
196 #[inline(always)]
197 pub const fn ptr() -> *const dma::RegisterBlock {
198 Self::PTR
199 }
200}
201impl Deref for DMA {
202 type Target = dma::RegisterBlock;
203 #[inline(always)]
204 fn deref(&self) -> &Self::Target {
205 unsafe { &*Self::PTR }
206 }
207}
208impl core::fmt::Debug for DMA {
209 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
210 f.debug_struct("DMA").finish()
211 }
212}
213#[doc = "DMA"]
214pub mod dma;
215#[doc = "MSC"]
216pub struct MSC {
217 _marker: PhantomData<*const ()>,
218}
219unsafe impl Send for MSC {}
220impl MSC {
221 #[doc = r"Pointer to the register block"]
222 pub const PTR: *const msc::RegisterBlock = 0x400c_0000 as *const _;
223 #[doc = r"Return the pointer to the register block"]
224 #[inline(always)]
225 pub const fn ptr() -> *const msc::RegisterBlock {
226 Self::PTR
227 }
228}
229impl Deref for MSC {
230 type Target = msc::RegisterBlock;
231 #[inline(always)]
232 fn deref(&self) -> &Self::Target {
233 unsafe { &*Self::PTR }
234 }
235}
236impl core::fmt::Debug for MSC {
237 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
238 f.debug_struct("MSC").finish()
239 }
240}
241#[doc = "MSC"]
242pub mod msc;
243#[doc = "EMU"]
244pub struct EMU {
245 _marker: PhantomData<*const ()>,
246}
247unsafe impl Send for EMU {}
248impl EMU {
249 #[doc = r"Pointer to the register block"]
250 pub const PTR: *const emu::RegisterBlock = 0x400c_6000 as *const _;
251 #[doc = r"Return the pointer to the register block"]
252 #[inline(always)]
253 pub const fn ptr() -> *const emu::RegisterBlock {
254 Self::PTR
255 }
256}
257impl Deref for EMU {
258 type Target = emu::RegisterBlock;
259 #[inline(always)]
260 fn deref(&self) -> &Self::Target {
261 unsafe { &*Self::PTR }
262 }
263}
264impl core::fmt::Debug for EMU {
265 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
266 f.debug_struct("EMU").finish()
267 }
268}
269#[doc = "EMU"]
270pub mod emu;
271#[doc = "RMU"]
272pub struct RMU {
273 _marker: PhantomData<*const ()>,
274}
275unsafe impl Send for RMU {}
276impl RMU {
277 #[doc = r"Pointer to the register block"]
278 pub const PTR: *const rmu::RegisterBlock = 0x400c_a000 as *const _;
279 #[doc = r"Return the pointer to the register block"]
280 #[inline(always)]
281 pub const fn ptr() -> *const rmu::RegisterBlock {
282 Self::PTR
283 }
284}
285impl Deref for RMU {
286 type Target = rmu::RegisterBlock;
287 #[inline(always)]
288 fn deref(&self) -> &Self::Target {
289 unsafe { &*Self::PTR }
290 }
291}
292impl core::fmt::Debug for RMU {
293 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
294 f.debug_struct("RMU").finish()
295 }
296}
297#[doc = "RMU"]
298pub mod rmu;
299#[doc = "CMU"]
300pub struct CMU {
301 _marker: PhantomData<*const ()>,
302}
303unsafe impl Send for CMU {}
304impl CMU {
305 #[doc = r"Pointer to the register block"]
306 pub const PTR: *const cmu::RegisterBlock = 0x400c_8000 as *const _;
307 #[doc = r"Return the pointer to the register block"]
308 #[inline(always)]
309 pub const fn ptr() -> *const cmu::RegisterBlock {
310 Self::PTR
311 }
312}
313impl Deref for CMU {
314 type Target = cmu::RegisterBlock;
315 #[inline(always)]
316 fn deref(&self) -> &Self::Target {
317 unsafe { &*Self::PTR }
318 }
319}
320impl core::fmt::Debug for CMU {
321 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
322 f.debug_struct("CMU").finish()
323 }
324}
325#[doc = "CMU"]
326pub mod cmu;
327#[doc = "LESENSE"]
328pub struct LESENSE {
329 _marker: PhantomData<*const ()>,
330}
331unsafe impl Send for LESENSE {}
332impl LESENSE {
333 #[doc = r"Pointer to the register block"]
334 pub const PTR: *const lesense::RegisterBlock = 0x4008_c000 as *const _;
335 #[doc = r"Return the pointer to the register block"]
336 #[inline(always)]
337 pub const fn ptr() -> *const lesense::RegisterBlock {
338 Self::PTR
339 }
340}
341impl Deref for LESENSE {
342 type Target = lesense::RegisterBlock;
343 #[inline(always)]
344 fn deref(&self) -> &Self::Target {
345 unsafe { &*Self::PTR }
346 }
347}
348impl core::fmt::Debug for LESENSE {
349 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
350 f.debug_struct("LESENSE").finish()
351 }
352}
353#[doc = "LESENSE"]
354pub mod lesense;
355#[doc = "RTC"]
356pub struct RTC {
357 _marker: PhantomData<*const ()>,
358}
359unsafe impl Send for RTC {}
360impl RTC {
361 #[doc = r"Pointer to the register block"]
362 pub const PTR: *const rtc::RegisterBlock = 0x4008_0000 as *const _;
363 #[doc = r"Return the pointer to the register block"]
364 #[inline(always)]
365 pub const fn ptr() -> *const rtc::RegisterBlock {
366 Self::PTR
367 }
368}
369impl Deref for RTC {
370 type Target = rtc::RegisterBlock;
371 #[inline(always)]
372 fn deref(&self) -> &Self::Target {
373 unsafe { &*Self::PTR }
374 }
375}
376impl core::fmt::Debug for RTC {
377 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
378 f.debug_struct("RTC").finish()
379 }
380}
381#[doc = "RTC"]
382pub mod rtc;
383#[doc = "ACMP0"]
384pub struct ACMP0 {
385 _marker: PhantomData<*const ()>,
386}
387unsafe impl Send for ACMP0 {}
388impl ACMP0 {
389 #[doc = r"Pointer to the register block"]
390 pub const PTR: *const acmp0::RegisterBlock = 0x4000_1000 as *const _;
391 #[doc = r"Return the pointer to the register block"]
392 #[inline(always)]
393 pub const fn ptr() -> *const acmp0::RegisterBlock {
394 Self::PTR
395 }
396}
397impl Deref for ACMP0 {
398 type Target = acmp0::RegisterBlock;
399 #[inline(always)]
400 fn deref(&self) -> &Self::Target {
401 unsafe { &*Self::PTR }
402 }
403}
404impl core::fmt::Debug for ACMP0 {
405 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
406 f.debug_struct("ACMP0").finish()
407 }
408}
409#[doc = "ACMP0"]
410pub mod acmp0;
411#[doc = "ACMP1"]
412pub struct ACMP1 {
413 _marker: PhantomData<*const ()>,
414}
415unsafe impl Send for ACMP1 {}
416impl ACMP1 {
417 #[doc = r"Pointer to the register block"]
418 pub const PTR: *const acmp1::RegisterBlock = 0x4000_1400 as *const _;
419 #[doc = r"Return the pointer to the register block"]
420 #[inline(always)]
421 pub const fn ptr() -> *const acmp1::RegisterBlock {
422 Self::PTR
423 }
424}
425impl Deref for ACMP1 {
426 type Target = acmp1::RegisterBlock;
427 #[inline(always)]
428 fn deref(&self) -> &Self::Target {
429 unsafe { &*Self::PTR }
430 }
431}
432impl core::fmt::Debug for ACMP1 {
433 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
434 f.debug_struct("ACMP1").finish()
435 }
436}
437#[doc = "ACMP1"]
438pub mod acmp1;
439#[doc = "USART0"]
440pub struct USART0 {
441 _marker: PhantomData<*const ()>,
442}
443unsafe impl Send for USART0 {}
444impl USART0 {
445 #[doc = r"Pointer to the register block"]
446 pub const PTR: *const usart0::RegisterBlock = 0x4000_c000 as *const _;
447 #[doc = r"Return the pointer to the register block"]
448 #[inline(always)]
449 pub const fn ptr() -> *const usart0::RegisterBlock {
450 Self::PTR
451 }
452}
453impl Deref for USART0 {
454 type Target = usart0::RegisterBlock;
455 #[inline(always)]
456 fn deref(&self) -> &Self::Target {
457 unsafe { &*Self::PTR }
458 }
459}
460impl core::fmt::Debug for USART0 {
461 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
462 f.debug_struct("USART0").finish()
463 }
464}
465#[doc = "USART0"]
466pub mod usart0;
467#[doc = "USART1"]
468pub struct USART1 {
469 _marker: PhantomData<*const ()>,
470}
471unsafe impl Send for USART1 {}
472impl USART1 {
473 #[doc = r"Pointer to the register block"]
474 pub const PTR: *const usart1::RegisterBlock = 0x4000_c400 as *const _;
475 #[doc = r"Return the pointer to the register block"]
476 #[inline(always)]
477 pub const fn ptr() -> *const usart1::RegisterBlock {
478 Self::PTR
479 }
480}
481impl Deref for USART1 {
482 type Target = usart1::RegisterBlock;
483 #[inline(always)]
484 fn deref(&self) -> &Self::Target {
485 unsafe { &*Self::PTR }
486 }
487}
488impl core::fmt::Debug for USART1 {
489 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
490 f.debug_struct("USART1").finish()
491 }
492}
493#[doc = "USART1"]
494pub mod usart1;
495#[doc = "TIMER0"]
496pub struct TIMER0 {
497 _marker: PhantomData<*const ()>,
498}
499unsafe impl Send for TIMER0 {}
500impl TIMER0 {
501 #[doc = r"Pointer to the register block"]
502 pub const PTR: *const timer0::RegisterBlock = 0x4001_0000 as *const _;
503 #[doc = r"Return the pointer to the register block"]
504 #[inline(always)]
505 pub const fn ptr() -> *const timer0::RegisterBlock {
506 Self::PTR
507 }
508}
509impl Deref for TIMER0 {
510 type Target = timer0::RegisterBlock;
511 #[inline(always)]
512 fn deref(&self) -> &Self::Target {
513 unsafe { &*Self::PTR }
514 }
515}
516impl core::fmt::Debug for TIMER0 {
517 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
518 f.debug_struct("TIMER0").finish()
519 }
520}
521#[doc = "TIMER0"]
522pub mod timer0;
523#[doc = "TIMER1"]
524pub struct TIMER1 {
525 _marker: PhantomData<*const ()>,
526}
527unsafe impl Send for TIMER1 {}
528impl TIMER1 {
529 #[doc = r"Pointer to the register block"]
530 pub const PTR: *const timer1::RegisterBlock = 0x4001_0400 as *const _;
531 #[doc = r"Return the pointer to the register block"]
532 #[inline(always)]
533 pub const fn ptr() -> *const timer1::RegisterBlock {
534 Self::PTR
535 }
536}
537impl Deref for TIMER1 {
538 type Target = timer1::RegisterBlock;
539 #[inline(always)]
540 fn deref(&self) -> &Self::Target {
541 unsafe { &*Self::PTR }
542 }
543}
544impl core::fmt::Debug for TIMER1 {
545 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
546 f.debug_struct("TIMER1").finish()
547 }
548}
549#[doc = "TIMER1"]
550pub mod timer1;
551#[doc = "GPIO"]
552pub struct GPIO {
553 _marker: PhantomData<*const ()>,
554}
555unsafe impl Send for GPIO {}
556impl GPIO {
557 #[doc = r"Pointer to the register block"]
558 pub const PTR: *const gpio::RegisterBlock = 0x4000_6000 as *const _;
559 #[doc = r"Return the pointer to the register block"]
560 #[inline(always)]
561 pub const fn ptr() -> *const gpio::RegisterBlock {
562 Self::PTR
563 }
564}
565impl Deref for GPIO {
566 type Target = gpio::RegisterBlock;
567 #[inline(always)]
568 fn deref(&self) -> &Self::Target {
569 unsafe { &*Self::PTR }
570 }
571}
572impl core::fmt::Debug for GPIO {
573 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
574 f.debug_struct("GPIO").finish()
575 }
576}
577#[doc = "GPIO"]
578pub mod gpio;
579#[doc = "VCMP"]
580pub struct VCMP {
581 _marker: PhantomData<*const ()>,
582}
583unsafe impl Send for VCMP {}
584impl VCMP {
585 #[doc = r"Pointer to the register block"]
586 pub const PTR: *const vcmp::RegisterBlock = 0x4000_0000 as *const _;
587 #[doc = r"Return the pointer to the register block"]
588 #[inline(always)]
589 pub const fn ptr() -> *const vcmp::RegisterBlock {
590 Self::PTR
591 }
592}
593impl Deref for VCMP {
594 type Target = vcmp::RegisterBlock;
595 #[inline(always)]
596 fn deref(&self) -> &Self::Target {
597 unsafe { &*Self::PTR }
598 }
599}
600impl core::fmt::Debug for VCMP {
601 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
602 f.debug_struct("VCMP").finish()
603 }
604}
605#[doc = "VCMP"]
606pub mod vcmp;
607#[doc = "PRS"]
608pub struct PRS {
609 _marker: PhantomData<*const ()>,
610}
611unsafe impl Send for PRS {}
612impl PRS {
613 #[doc = r"Pointer to the register block"]
614 pub const PTR: *const prs::RegisterBlock = 0x400c_c000 as *const _;
615 #[doc = r"Return the pointer to the register block"]
616 #[inline(always)]
617 pub const fn ptr() -> *const prs::RegisterBlock {
618 Self::PTR
619 }
620}
621impl Deref for PRS {
622 type Target = prs::RegisterBlock;
623 #[inline(always)]
624 fn deref(&self) -> &Self::Target {
625 unsafe { &*Self::PTR }
626 }
627}
628impl core::fmt::Debug for PRS {
629 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
630 f.debug_struct("PRS").finish()
631 }
632}
633#[doc = "PRS"]
634pub mod prs;
635#[doc = "LEUART0"]
636pub struct LEUART0 {
637 _marker: PhantomData<*const ()>,
638}
639unsafe impl Send for LEUART0 {}
640impl LEUART0 {
641 #[doc = r"Pointer to the register block"]
642 pub const PTR: *const leuart0::RegisterBlock = 0x4008_4000 as *const _;
643 #[doc = r"Return the pointer to the register block"]
644 #[inline(always)]
645 pub const fn ptr() -> *const leuart0::RegisterBlock {
646 Self::PTR
647 }
648}
649impl Deref for LEUART0 {
650 type Target = leuart0::RegisterBlock;
651 #[inline(always)]
652 fn deref(&self) -> &Self::Target {
653 unsafe { &*Self::PTR }
654 }
655}
656impl core::fmt::Debug for LEUART0 {
657 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
658 f.debug_struct("LEUART0").finish()
659 }
660}
661#[doc = "LEUART0"]
662pub mod leuart0;
663#[doc = "LETIMER0"]
664pub struct LETIMER0 {
665 _marker: PhantomData<*const ()>,
666}
667unsafe impl Send for LETIMER0 {}
668impl LETIMER0 {
669 #[doc = r"Pointer to the register block"]
670 pub const PTR: *const letimer0::RegisterBlock = 0x4008_2000 as *const _;
671 #[doc = r"Return the pointer to the register block"]
672 #[inline(always)]
673 pub const fn ptr() -> *const letimer0::RegisterBlock {
674 Self::PTR
675 }
676}
677impl Deref for LETIMER0 {
678 type Target = letimer0::RegisterBlock;
679 #[inline(always)]
680 fn deref(&self) -> &Self::Target {
681 unsafe { &*Self::PTR }
682 }
683}
684impl core::fmt::Debug for LETIMER0 {
685 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
686 f.debug_struct("LETIMER0").finish()
687 }
688}
689#[doc = "LETIMER0"]
690pub mod letimer0;
691#[doc = "PCNT0"]
692pub struct PCNT0 {
693 _marker: PhantomData<*const ()>,
694}
695unsafe impl Send for PCNT0 {}
696impl PCNT0 {
697 #[doc = r"Pointer to the register block"]
698 pub const PTR: *const pcnt0::RegisterBlock = 0x4008_6000 as *const _;
699 #[doc = r"Return the pointer to the register block"]
700 #[inline(always)]
701 pub const fn ptr() -> *const pcnt0::RegisterBlock {
702 Self::PTR
703 }
704}
705impl Deref for PCNT0 {
706 type Target = pcnt0::RegisterBlock;
707 #[inline(always)]
708 fn deref(&self) -> &Self::Target {
709 unsafe { &*Self::PTR }
710 }
711}
712impl core::fmt::Debug for PCNT0 {
713 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
714 f.debug_struct("PCNT0").finish()
715 }
716}
717#[doc = "PCNT0"]
718pub mod pcnt0;
719#[doc = "ADC0"]
720pub struct ADC0 {
721 _marker: PhantomData<*const ()>,
722}
723unsafe impl Send for ADC0 {}
724impl ADC0 {
725 #[doc = r"Pointer to the register block"]
726 pub const PTR: *const adc0::RegisterBlock = 0x4000_2000 as *const _;
727 #[doc = r"Return the pointer to the register block"]
728 #[inline(always)]
729 pub const fn ptr() -> *const adc0::RegisterBlock {
730 Self::PTR
731 }
732}
733impl Deref for ADC0 {
734 type Target = adc0::RegisterBlock;
735 #[inline(always)]
736 fn deref(&self) -> &Self::Target {
737 unsafe { &*Self::PTR }
738 }
739}
740impl core::fmt::Debug for ADC0 {
741 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
742 f.debug_struct("ADC0").finish()
743 }
744}
745#[doc = "ADC0"]
746pub mod adc0;
747#[doc = "DAC0"]
748pub struct DAC0 {
749 _marker: PhantomData<*const ()>,
750}
751unsafe impl Send for DAC0 {}
752impl DAC0 {
753 #[doc = r"Pointer to the register block"]
754 pub const PTR: *const dac0::RegisterBlock = 0x4000_4000 as *const _;
755 #[doc = r"Return the pointer to the register block"]
756 #[inline(always)]
757 pub const fn ptr() -> *const dac0::RegisterBlock {
758 Self::PTR
759 }
760}
761impl Deref for DAC0 {
762 type Target = dac0::RegisterBlock;
763 #[inline(always)]
764 fn deref(&self) -> &Self::Target {
765 unsafe { &*Self::PTR }
766 }
767}
768impl core::fmt::Debug for DAC0 {
769 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
770 f.debug_struct("DAC0").finish()
771 }
772}
773#[doc = "DAC0"]
774pub mod dac0;
775#[doc = "I2C0"]
776pub struct I2C0 {
777 _marker: PhantomData<*const ()>,
778}
779unsafe impl Send for I2C0 {}
780impl I2C0 {
781 #[doc = r"Pointer to the register block"]
782 pub const PTR: *const i2c0::RegisterBlock = 0x4000_a000 as *const _;
783 #[doc = r"Return the pointer to the register block"]
784 #[inline(always)]
785 pub const fn ptr() -> *const i2c0::RegisterBlock {
786 Self::PTR
787 }
788}
789impl Deref for I2C0 {
790 type Target = i2c0::RegisterBlock;
791 #[inline(always)]
792 fn deref(&self) -> &Self::Target {
793 unsafe { &*Self::PTR }
794 }
795}
796impl core::fmt::Debug for I2C0 {
797 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
798 f.debug_struct("I2C0").finish()
799 }
800}
801#[doc = "I2C0"]
802pub mod i2c0;
803#[doc = "WDOG"]
804pub struct WDOG {
805 _marker: PhantomData<*const ()>,
806}
807unsafe impl Send for WDOG {}
808impl WDOG {
809 #[doc = r"Pointer to the register block"]
810 pub const PTR: *const wdog::RegisterBlock = 0x4008_8000 as *const _;
811 #[doc = r"Return the pointer to the register block"]
812 #[inline(always)]
813 pub const fn ptr() -> *const wdog::RegisterBlock {
814 Self::PTR
815 }
816}
817impl Deref for WDOG {
818 type Target = wdog::RegisterBlock;
819 #[inline(always)]
820 fn deref(&self) -> &Self::Target {
821 unsafe { &*Self::PTR }
822 }
823}
824impl core::fmt::Debug for WDOG {
825 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
826 f.debug_struct("WDOG").finish()
827 }
828}
829#[doc = "WDOG"]
830pub mod wdog;
831#[no_mangle]
832static mut DEVICE_PERIPHERALS: bool = false;
833#[doc = r"All the peripherals"]
834#[allow(non_snake_case)]
835pub struct Peripherals {
836 #[doc = "AES"]
837 pub AES: AES,
838 #[doc = "DMA"]
839 pub DMA: DMA,
840 #[doc = "MSC"]
841 pub MSC: MSC,
842 #[doc = "EMU"]
843 pub EMU: EMU,
844 #[doc = "RMU"]
845 pub RMU: RMU,
846 #[doc = "CMU"]
847 pub CMU: CMU,
848 #[doc = "LESENSE"]
849 pub LESENSE: LESENSE,
850 #[doc = "RTC"]
851 pub RTC: RTC,
852 #[doc = "ACMP0"]
853 pub ACMP0: ACMP0,
854 #[doc = "ACMP1"]
855 pub ACMP1: ACMP1,
856 #[doc = "USART0"]
857 pub USART0: USART0,
858 #[doc = "USART1"]
859 pub USART1: USART1,
860 #[doc = "TIMER0"]
861 pub TIMER0: TIMER0,
862 #[doc = "TIMER1"]
863 pub TIMER1: TIMER1,
864 #[doc = "GPIO"]
865 pub GPIO: GPIO,
866 #[doc = "VCMP"]
867 pub VCMP: VCMP,
868 #[doc = "PRS"]
869 pub PRS: PRS,
870 #[doc = "LEUART0"]
871 pub LEUART0: LEUART0,
872 #[doc = "LETIMER0"]
873 pub LETIMER0: LETIMER0,
874 #[doc = "PCNT0"]
875 pub PCNT0: PCNT0,
876 #[doc = "ADC0"]
877 pub ADC0: ADC0,
878 #[doc = "DAC0"]
879 pub DAC0: DAC0,
880 #[doc = "I2C0"]
881 pub I2C0: I2C0,
882 #[doc = "WDOG"]
883 pub WDOG: WDOG,
884}
885impl Peripherals {
886 #[doc = r"Returns all the peripherals *once*"]
887 #[inline]
888 pub fn take() -> Option<Self> {
889 cortex_m::interrupt::free(|_| {
890 if unsafe { DEVICE_PERIPHERALS } {
891 None
892 } else {
893 Some(unsafe { Peripherals::steal() })
894 }
895 })
896 }
897 #[doc = r"Unchecked version of `Peripherals::take`"]
898 #[inline]
899 pub unsafe fn steal() -> Self {
900 DEVICE_PERIPHERALS = true;
901 Peripherals {
902 AES: AES {
903 _marker: PhantomData,
904 },
905 DMA: DMA {
906 _marker: PhantomData,
907 },
908 MSC: MSC {
909 _marker: PhantomData,
910 },
911 EMU: EMU {
912 _marker: PhantomData,
913 },
914 RMU: RMU {
915 _marker: PhantomData,
916 },
917 CMU: CMU {
918 _marker: PhantomData,
919 },
920 LESENSE: LESENSE {
921 _marker: PhantomData,
922 },
923 RTC: RTC {
924 _marker: PhantomData,
925 },
926 ACMP0: ACMP0 {
927 _marker: PhantomData,
928 },
929 ACMP1: ACMP1 {
930 _marker: PhantomData,
931 },
932 USART0: USART0 {
933 _marker: PhantomData,
934 },
935 USART1: USART1 {
936 _marker: PhantomData,
937 },
938 TIMER0: TIMER0 {
939 _marker: PhantomData,
940 },
941 TIMER1: TIMER1 {
942 _marker: PhantomData,
943 },
944 GPIO: GPIO {
945 _marker: PhantomData,
946 },
947 VCMP: VCMP {
948 _marker: PhantomData,
949 },
950 PRS: PRS {
951 _marker: PhantomData,
952 },
953 LEUART0: LEUART0 {
954 _marker: PhantomData,
955 },
956 LETIMER0: LETIMER0 {
957 _marker: PhantomData,
958 },
959 PCNT0: PCNT0 {
960 _marker: PhantomData,
961 },
962 ADC0: ADC0 {
963 _marker: PhantomData,
964 },
965 DAC0: DAC0 {
966 _marker: PhantomData,
967 },
968 I2C0: I2C0 {
969 _marker: PhantomData,
970 },
971 WDOG: WDOG {
972 _marker: PhantomData,
973 },
974 }
975 }
976}