1#![doc = "Peripheral access API for EFM32ZG210F16 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 ACMP0();
41 fn ADC0();
42 fn I2C0();
43 fn GPIO_ODD();
44 fn TIMER1();
45 fn USART1_RX();
46 fn USART1_TX();
47 fn LEUART0();
48 fn PCNT0();
49 fn RTC();
50 fn CMU();
51 fn VCMP();
52 fn MSC();
53 fn AES();
54}
55#[doc(hidden)]
56pub union Vector {
57 _handler: unsafe extern "C" fn(),
58 _reserved: u32,
59}
60#[cfg(feature = "rt")]
61#[doc(hidden)]
62#[link_section = ".vector_table.interrupts"]
63#[no_mangle]
64pub static __INTERRUPTS: [Vector; 17] = [
65 Vector { _handler: DMA },
66 Vector {
67 _handler: GPIO_EVEN,
68 },
69 Vector { _handler: TIMER0 },
70 Vector { _handler: ACMP0 },
71 Vector { _handler: ADC0 },
72 Vector { _handler: I2C0 },
73 Vector { _handler: GPIO_ODD },
74 Vector { _handler: TIMER1 },
75 Vector {
76 _handler: USART1_RX,
77 },
78 Vector {
79 _handler: USART1_TX,
80 },
81 Vector { _handler: LEUART0 },
82 Vector { _handler: PCNT0 },
83 Vector { _handler: RTC },
84 Vector { _handler: CMU },
85 Vector { _handler: VCMP },
86 Vector { _handler: MSC },
87 Vector { _handler: AES },
88];
89#[doc = r"Enumeration of all the interrupts."]
90#[derive(Copy, Clone, Debug, PartialEq, Eq)]
91#[repr(u16)]
92pub enum Interrupt {
93 #[doc = "0 - DMA"]
94 DMA = 0,
95 #[doc = "1 - GPIO_EVEN"]
96 GPIO_EVEN = 1,
97 #[doc = "2 - TIMER0"]
98 TIMER0 = 2,
99 #[doc = "3 - ACMP0"]
100 ACMP0 = 3,
101 #[doc = "4 - ADC0"]
102 ADC0 = 4,
103 #[doc = "5 - I2C0"]
104 I2C0 = 5,
105 #[doc = "6 - GPIO_ODD"]
106 GPIO_ODD = 6,
107 #[doc = "7 - TIMER1"]
108 TIMER1 = 7,
109 #[doc = "8 - USART1_RX"]
110 USART1_RX = 8,
111 #[doc = "9 - USART1_TX"]
112 USART1_TX = 9,
113 #[doc = "10 - LEUART0"]
114 LEUART0 = 10,
115 #[doc = "11 - PCNT0"]
116 PCNT0 = 11,
117 #[doc = "12 - RTC"]
118 RTC = 12,
119 #[doc = "13 - CMU"]
120 CMU = 13,
121 #[doc = "14 - VCMP"]
122 VCMP = 14,
123 #[doc = "15 - MSC"]
124 MSC = 15,
125 #[doc = "16 - AES"]
126 AES = 16,
127}
128unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
129 #[inline(always)]
130 fn number(self) -> u16 {
131 self as u16
132 }
133}
134#[doc = "AES"]
135pub struct AES {
136 _marker: PhantomData<*const ()>,
137}
138unsafe impl Send for AES {}
139impl AES {
140 #[doc = r"Pointer to the register block"]
141 pub const PTR: *const aes::RegisterBlock = 0x400e_0000 as *const _;
142 #[doc = r"Return the pointer to the register block"]
143 #[inline(always)]
144 pub const fn ptr() -> *const aes::RegisterBlock {
145 Self::PTR
146 }
147}
148impl Deref for AES {
149 type Target = aes::RegisterBlock;
150 #[inline(always)]
151 fn deref(&self) -> &Self::Target {
152 unsafe { &*Self::PTR }
153 }
154}
155impl core::fmt::Debug for AES {
156 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
157 f.debug_struct("AES").finish()
158 }
159}
160#[doc = "AES"]
161pub mod aes;
162#[doc = "DMA"]
163pub struct DMA {
164 _marker: PhantomData<*const ()>,
165}
166unsafe impl Send for DMA {}
167impl DMA {
168 #[doc = r"Pointer to the register block"]
169 pub const PTR: *const dma::RegisterBlock = 0x400c_2000 as *const _;
170 #[doc = r"Return the pointer to the register block"]
171 #[inline(always)]
172 pub const fn ptr() -> *const dma::RegisterBlock {
173 Self::PTR
174 }
175}
176impl Deref for DMA {
177 type Target = dma::RegisterBlock;
178 #[inline(always)]
179 fn deref(&self) -> &Self::Target {
180 unsafe { &*Self::PTR }
181 }
182}
183impl core::fmt::Debug for DMA {
184 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
185 f.debug_struct("DMA").finish()
186 }
187}
188#[doc = "DMA"]
189pub mod dma;
190#[doc = "MSC"]
191pub struct MSC {
192 _marker: PhantomData<*const ()>,
193}
194unsafe impl Send for MSC {}
195impl MSC {
196 #[doc = r"Pointer to the register block"]
197 pub const PTR: *const msc::RegisterBlock = 0x400c_0000 as *const _;
198 #[doc = r"Return the pointer to the register block"]
199 #[inline(always)]
200 pub const fn ptr() -> *const msc::RegisterBlock {
201 Self::PTR
202 }
203}
204impl Deref for MSC {
205 type Target = msc::RegisterBlock;
206 #[inline(always)]
207 fn deref(&self) -> &Self::Target {
208 unsafe { &*Self::PTR }
209 }
210}
211impl core::fmt::Debug for MSC {
212 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
213 f.debug_struct("MSC").finish()
214 }
215}
216#[doc = "MSC"]
217pub mod msc;
218#[doc = "EMU"]
219pub struct EMU {
220 _marker: PhantomData<*const ()>,
221}
222unsafe impl Send for EMU {}
223impl EMU {
224 #[doc = r"Pointer to the register block"]
225 pub const PTR: *const emu::RegisterBlock = 0x400c_6000 as *const _;
226 #[doc = r"Return the pointer to the register block"]
227 #[inline(always)]
228 pub const fn ptr() -> *const emu::RegisterBlock {
229 Self::PTR
230 }
231}
232impl Deref for EMU {
233 type Target = emu::RegisterBlock;
234 #[inline(always)]
235 fn deref(&self) -> &Self::Target {
236 unsafe { &*Self::PTR }
237 }
238}
239impl core::fmt::Debug for EMU {
240 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
241 f.debug_struct("EMU").finish()
242 }
243}
244#[doc = "EMU"]
245pub mod emu;
246#[doc = "RMU"]
247pub struct RMU {
248 _marker: PhantomData<*const ()>,
249}
250unsafe impl Send for RMU {}
251impl RMU {
252 #[doc = r"Pointer to the register block"]
253 pub const PTR: *const rmu::RegisterBlock = 0x400c_a000 as *const _;
254 #[doc = r"Return the pointer to the register block"]
255 #[inline(always)]
256 pub const fn ptr() -> *const rmu::RegisterBlock {
257 Self::PTR
258 }
259}
260impl Deref for RMU {
261 type Target = rmu::RegisterBlock;
262 #[inline(always)]
263 fn deref(&self) -> &Self::Target {
264 unsafe { &*Self::PTR }
265 }
266}
267impl core::fmt::Debug for RMU {
268 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
269 f.debug_struct("RMU").finish()
270 }
271}
272#[doc = "RMU"]
273pub mod rmu;
274#[doc = "CMU"]
275pub struct CMU {
276 _marker: PhantomData<*const ()>,
277}
278unsafe impl Send for CMU {}
279impl CMU {
280 #[doc = r"Pointer to the register block"]
281 pub const PTR: *const cmu::RegisterBlock = 0x400c_8000 as *const _;
282 #[doc = r"Return the pointer to the register block"]
283 #[inline(always)]
284 pub const fn ptr() -> *const cmu::RegisterBlock {
285 Self::PTR
286 }
287}
288impl Deref for CMU {
289 type Target = cmu::RegisterBlock;
290 #[inline(always)]
291 fn deref(&self) -> &Self::Target {
292 unsafe { &*Self::PTR }
293 }
294}
295impl core::fmt::Debug for CMU {
296 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
297 f.debug_struct("CMU").finish()
298 }
299}
300#[doc = "CMU"]
301pub mod cmu;
302#[doc = "TIMER0"]
303pub struct TIMER0 {
304 _marker: PhantomData<*const ()>,
305}
306unsafe impl Send for TIMER0 {}
307impl TIMER0 {
308 #[doc = r"Pointer to the register block"]
309 pub const PTR: *const timer0::RegisterBlock = 0x4001_0000 as *const _;
310 #[doc = r"Return the pointer to the register block"]
311 #[inline(always)]
312 pub const fn ptr() -> *const timer0::RegisterBlock {
313 Self::PTR
314 }
315}
316impl Deref for TIMER0 {
317 type Target = timer0::RegisterBlock;
318 #[inline(always)]
319 fn deref(&self) -> &Self::Target {
320 unsafe { &*Self::PTR }
321 }
322}
323impl core::fmt::Debug for TIMER0 {
324 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
325 f.debug_struct("TIMER0").finish()
326 }
327}
328#[doc = "TIMER0"]
329pub mod timer0;
330#[doc = "TIMER1"]
331pub struct TIMER1 {
332 _marker: PhantomData<*const ()>,
333}
334unsafe impl Send for TIMER1 {}
335impl TIMER1 {
336 #[doc = r"Pointer to the register block"]
337 pub const PTR: *const timer1::RegisterBlock = 0x4001_0400 as *const _;
338 #[doc = r"Return the pointer to the register block"]
339 #[inline(always)]
340 pub const fn ptr() -> *const timer1::RegisterBlock {
341 Self::PTR
342 }
343}
344impl Deref for TIMER1 {
345 type Target = timer1::RegisterBlock;
346 #[inline(always)]
347 fn deref(&self) -> &Self::Target {
348 unsafe { &*Self::PTR }
349 }
350}
351impl core::fmt::Debug for TIMER1 {
352 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
353 f.debug_struct("TIMER1").finish()
354 }
355}
356#[doc = "TIMER1"]
357pub mod timer1;
358#[doc = "ACMP0"]
359pub struct ACMP0 {
360 _marker: PhantomData<*const ()>,
361}
362unsafe impl Send for ACMP0 {}
363impl ACMP0 {
364 #[doc = r"Pointer to the register block"]
365 pub const PTR: *const acmp0::RegisterBlock = 0x4000_1000 as *const _;
366 #[doc = r"Return the pointer to the register block"]
367 #[inline(always)]
368 pub const fn ptr() -> *const acmp0::RegisterBlock {
369 Self::PTR
370 }
371}
372impl Deref for ACMP0 {
373 type Target = acmp0::RegisterBlock;
374 #[inline(always)]
375 fn deref(&self) -> &Self::Target {
376 unsafe { &*Self::PTR }
377 }
378}
379impl core::fmt::Debug for ACMP0 {
380 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
381 f.debug_struct("ACMP0").finish()
382 }
383}
384#[doc = "ACMP0"]
385pub mod acmp0;
386#[doc = "USART1"]
387pub struct USART1 {
388 _marker: PhantomData<*const ()>,
389}
390unsafe impl Send for USART1 {}
391impl USART1 {
392 #[doc = r"Pointer to the register block"]
393 pub const PTR: *const usart1::RegisterBlock = 0x4000_c400 as *const _;
394 #[doc = r"Return the pointer to the register block"]
395 #[inline(always)]
396 pub const fn ptr() -> *const usart1::RegisterBlock {
397 Self::PTR
398 }
399}
400impl Deref for USART1 {
401 type Target = usart1::RegisterBlock;
402 #[inline(always)]
403 fn deref(&self) -> &Self::Target {
404 unsafe { &*Self::PTR }
405 }
406}
407impl core::fmt::Debug for USART1 {
408 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
409 f.debug_struct("USART1").finish()
410 }
411}
412#[doc = "USART1"]
413pub mod usart1;
414#[doc = "PRS"]
415pub struct PRS {
416 _marker: PhantomData<*const ()>,
417}
418unsafe impl Send for PRS {}
419impl PRS {
420 #[doc = r"Pointer to the register block"]
421 pub const PTR: *const prs::RegisterBlock = 0x400c_c000 as *const _;
422 #[doc = r"Return the pointer to the register block"]
423 #[inline(always)]
424 pub const fn ptr() -> *const prs::RegisterBlock {
425 Self::PTR
426 }
427}
428impl Deref for PRS {
429 type Target = prs::RegisterBlock;
430 #[inline(always)]
431 fn deref(&self) -> &Self::Target {
432 unsafe { &*Self::PTR }
433 }
434}
435impl core::fmt::Debug for PRS {
436 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
437 f.debug_struct("PRS").finish()
438 }
439}
440#[doc = "PRS"]
441pub mod prs;
442#[doc = "IDAC0"]
443pub struct IDAC0 {
444 _marker: PhantomData<*const ()>,
445}
446unsafe impl Send for IDAC0 {}
447impl IDAC0 {
448 #[doc = r"Pointer to the register block"]
449 pub const PTR: *const idac0::RegisterBlock = 0x4000_4000 as *const _;
450 #[doc = r"Return the pointer to the register block"]
451 #[inline(always)]
452 pub const fn ptr() -> *const idac0::RegisterBlock {
453 Self::PTR
454 }
455}
456impl Deref for IDAC0 {
457 type Target = idac0::RegisterBlock;
458 #[inline(always)]
459 fn deref(&self) -> &Self::Target {
460 unsafe { &*Self::PTR }
461 }
462}
463impl core::fmt::Debug for IDAC0 {
464 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
465 f.debug_struct("IDAC0").finish()
466 }
467}
468#[doc = "IDAC0"]
469pub mod idac0;
470#[doc = "GPIO"]
471pub struct GPIO {
472 _marker: PhantomData<*const ()>,
473}
474unsafe impl Send for GPIO {}
475impl GPIO {
476 #[doc = r"Pointer to the register block"]
477 pub const PTR: *const gpio::RegisterBlock = 0x4000_6000 as *const _;
478 #[doc = r"Return the pointer to the register block"]
479 #[inline(always)]
480 pub const fn ptr() -> *const gpio::RegisterBlock {
481 Self::PTR
482 }
483}
484impl Deref for GPIO {
485 type Target = gpio::RegisterBlock;
486 #[inline(always)]
487 fn deref(&self) -> &Self::Target {
488 unsafe { &*Self::PTR }
489 }
490}
491impl core::fmt::Debug for GPIO {
492 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
493 f.debug_struct("GPIO").finish()
494 }
495}
496#[doc = "GPIO"]
497pub mod gpio;
498#[doc = "VCMP"]
499pub struct VCMP {
500 _marker: PhantomData<*const ()>,
501}
502unsafe impl Send for VCMP {}
503impl VCMP {
504 #[doc = r"Pointer to the register block"]
505 pub const PTR: *const vcmp::RegisterBlock = 0x4000_0000 as *const _;
506 #[doc = r"Return the pointer to the register block"]
507 #[inline(always)]
508 pub const fn ptr() -> *const vcmp::RegisterBlock {
509 Self::PTR
510 }
511}
512impl Deref for VCMP {
513 type Target = vcmp::RegisterBlock;
514 #[inline(always)]
515 fn deref(&self) -> &Self::Target {
516 unsafe { &*Self::PTR }
517 }
518}
519impl core::fmt::Debug for VCMP {
520 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
521 f.debug_struct("VCMP").finish()
522 }
523}
524#[doc = "VCMP"]
525pub mod vcmp;
526#[doc = "ADC0"]
527pub struct ADC0 {
528 _marker: PhantomData<*const ()>,
529}
530unsafe impl Send for ADC0 {}
531impl ADC0 {
532 #[doc = r"Pointer to the register block"]
533 pub const PTR: *const adc0::RegisterBlock = 0x4000_2000 as *const _;
534 #[doc = r"Return the pointer to the register block"]
535 #[inline(always)]
536 pub const fn ptr() -> *const adc0::RegisterBlock {
537 Self::PTR
538 }
539}
540impl Deref for ADC0 {
541 type Target = adc0::RegisterBlock;
542 #[inline(always)]
543 fn deref(&self) -> &Self::Target {
544 unsafe { &*Self::PTR }
545 }
546}
547impl core::fmt::Debug for ADC0 {
548 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
549 f.debug_struct("ADC0").finish()
550 }
551}
552#[doc = "ADC0"]
553pub mod adc0;
554#[doc = "LEUART0"]
555pub struct LEUART0 {
556 _marker: PhantomData<*const ()>,
557}
558unsafe impl Send for LEUART0 {}
559impl LEUART0 {
560 #[doc = r"Pointer to the register block"]
561 pub const PTR: *const leuart0::RegisterBlock = 0x4008_4000 as *const _;
562 #[doc = r"Return the pointer to the register block"]
563 #[inline(always)]
564 pub const fn ptr() -> *const leuart0::RegisterBlock {
565 Self::PTR
566 }
567}
568impl Deref for LEUART0 {
569 type Target = leuart0::RegisterBlock;
570 #[inline(always)]
571 fn deref(&self) -> &Self::Target {
572 unsafe { &*Self::PTR }
573 }
574}
575impl core::fmt::Debug for LEUART0 {
576 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
577 f.debug_struct("LEUART0").finish()
578 }
579}
580#[doc = "LEUART0"]
581pub mod leuart0;
582#[doc = "PCNT0"]
583pub struct PCNT0 {
584 _marker: PhantomData<*const ()>,
585}
586unsafe impl Send for PCNT0 {}
587impl PCNT0 {
588 #[doc = r"Pointer to the register block"]
589 pub const PTR: *const pcnt0::RegisterBlock = 0x4008_6000 as *const _;
590 #[doc = r"Return the pointer to the register block"]
591 #[inline(always)]
592 pub const fn ptr() -> *const pcnt0::RegisterBlock {
593 Self::PTR
594 }
595}
596impl Deref for PCNT0 {
597 type Target = pcnt0::RegisterBlock;
598 #[inline(always)]
599 fn deref(&self) -> &Self::Target {
600 unsafe { &*Self::PTR }
601 }
602}
603impl core::fmt::Debug for PCNT0 {
604 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
605 f.debug_struct("PCNT0").finish()
606 }
607}
608#[doc = "PCNT0"]
609pub mod pcnt0;
610#[doc = "I2C0"]
611pub struct I2C0 {
612 _marker: PhantomData<*const ()>,
613}
614unsafe impl Send for I2C0 {}
615impl I2C0 {
616 #[doc = r"Pointer to the register block"]
617 pub const PTR: *const i2c0::RegisterBlock = 0x4000_a000 as *const _;
618 #[doc = r"Return the pointer to the register block"]
619 #[inline(always)]
620 pub const fn ptr() -> *const i2c0::RegisterBlock {
621 Self::PTR
622 }
623}
624impl Deref for I2C0 {
625 type Target = i2c0::RegisterBlock;
626 #[inline(always)]
627 fn deref(&self) -> &Self::Target {
628 unsafe { &*Self::PTR }
629 }
630}
631impl core::fmt::Debug for I2C0 {
632 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
633 f.debug_struct("I2C0").finish()
634 }
635}
636#[doc = "I2C0"]
637pub mod i2c0;
638#[doc = "RTC"]
639pub struct RTC {
640 _marker: PhantomData<*const ()>,
641}
642unsafe impl Send for RTC {}
643impl RTC {
644 #[doc = r"Pointer to the register block"]
645 pub const PTR: *const rtc::RegisterBlock = 0x4008_0000 as *const _;
646 #[doc = r"Return the pointer to the register block"]
647 #[inline(always)]
648 pub const fn ptr() -> *const rtc::RegisterBlock {
649 Self::PTR
650 }
651}
652impl Deref for RTC {
653 type Target = rtc::RegisterBlock;
654 #[inline(always)]
655 fn deref(&self) -> &Self::Target {
656 unsafe { &*Self::PTR }
657 }
658}
659impl core::fmt::Debug for RTC {
660 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
661 f.debug_struct("RTC").finish()
662 }
663}
664#[doc = "RTC"]
665pub mod rtc;
666#[doc = "WDOG"]
667pub struct WDOG {
668 _marker: PhantomData<*const ()>,
669}
670unsafe impl Send for WDOG {}
671impl WDOG {
672 #[doc = r"Pointer to the register block"]
673 pub const PTR: *const wdog::RegisterBlock = 0x4008_8000 as *const _;
674 #[doc = r"Return the pointer to the register block"]
675 #[inline(always)]
676 pub const fn ptr() -> *const wdog::RegisterBlock {
677 Self::PTR
678 }
679}
680impl Deref for WDOG {
681 type Target = wdog::RegisterBlock;
682 #[inline(always)]
683 fn deref(&self) -> &Self::Target {
684 unsafe { &*Self::PTR }
685 }
686}
687impl core::fmt::Debug for WDOG {
688 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
689 f.debug_struct("WDOG").finish()
690 }
691}
692#[doc = "WDOG"]
693pub mod wdog;
694#[no_mangle]
695static mut DEVICE_PERIPHERALS: bool = false;
696#[doc = r"All the peripherals"]
697#[allow(non_snake_case)]
698pub struct Peripherals {
699 #[doc = "AES"]
700 pub AES: AES,
701 #[doc = "DMA"]
702 pub DMA: DMA,
703 #[doc = "MSC"]
704 pub MSC: MSC,
705 #[doc = "EMU"]
706 pub EMU: EMU,
707 #[doc = "RMU"]
708 pub RMU: RMU,
709 #[doc = "CMU"]
710 pub CMU: CMU,
711 #[doc = "TIMER0"]
712 pub TIMER0: TIMER0,
713 #[doc = "TIMER1"]
714 pub TIMER1: TIMER1,
715 #[doc = "ACMP0"]
716 pub ACMP0: ACMP0,
717 #[doc = "USART1"]
718 pub USART1: USART1,
719 #[doc = "PRS"]
720 pub PRS: PRS,
721 #[doc = "IDAC0"]
722 pub IDAC0: IDAC0,
723 #[doc = "GPIO"]
724 pub GPIO: GPIO,
725 #[doc = "VCMP"]
726 pub VCMP: VCMP,
727 #[doc = "ADC0"]
728 pub ADC0: ADC0,
729 #[doc = "LEUART0"]
730 pub LEUART0: LEUART0,
731 #[doc = "PCNT0"]
732 pub PCNT0: PCNT0,
733 #[doc = "I2C0"]
734 pub I2C0: I2C0,
735 #[doc = "RTC"]
736 pub RTC: RTC,
737 #[doc = "WDOG"]
738 pub WDOG: WDOG,
739}
740impl Peripherals {
741 #[doc = r"Returns all the peripherals *once*"]
742 #[inline]
743 pub fn take() -> Option<Self> {
744 cortex_m::interrupt::free(|_| {
745 if unsafe { DEVICE_PERIPHERALS } {
746 None
747 } else {
748 Some(unsafe { Peripherals::steal() })
749 }
750 })
751 }
752 #[doc = r"Unchecked version of `Peripherals::take`"]
753 #[inline]
754 pub unsafe fn steal() -> Self {
755 DEVICE_PERIPHERALS = true;
756 Peripherals {
757 AES: AES {
758 _marker: PhantomData,
759 },
760 DMA: DMA {
761 _marker: PhantomData,
762 },
763 MSC: MSC {
764 _marker: PhantomData,
765 },
766 EMU: EMU {
767 _marker: PhantomData,
768 },
769 RMU: RMU {
770 _marker: PhantomData,
771 },
772 CMU: CMU {
773 _marker: PhantomData,
774 },
775 TIMER0: TIMER0 {
776 _marker: PhantomData,
777 },
778 TIMER1: TIMER1 {
779 _marker: PhantomData,
780 },
781 ACMP0: ACMP0 {
782 _marker: PhantomData,
783 },
784 USART1: USART1 {
785 _marker: PhantomData,
786 },
787 PRS: PRS {
788 _marker: PhantomData,
789 },
790 IDAC0: IDAC0 {
791 _marker: PhantomData,
792 },
793 GPIO: GPIO {
794 _marker: PhantomData,
795 },
796 VCMP: VCMP {
797 _marker: PhantomData,
798 },
799 ADC0: ADC0 {
800 _marker: PhantomData,
801 },
802 LEUART0: LEUART0 {
803 _marker: PhantomData,
804 },
805 PCNT0: PCNT0 {
806 _marker: PhantomData,
807 },
808 I2C0: I2C0 {
809 _marker: PhantomData,
810 },
811 RTC: RTC {
812 _marker: PhantomData,
813 },
814 WDOG: WDOG {
815 _marker: PhantomData,
816 },
817 }
818 }
819}