atsam3n1b/
lib.rs

1#![doc = "Peripheral access API for ATSAM3N1B microcontrollers (generated using svd2rust v0.33.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.33.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#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5#![no_std]
6use core::marker::PhantomData;
7use core::ops::Deref;
8#[doc = r"Number available in the NVIC for configuring priority"]
9pub const NVIC_PRIO_BITS: u8 = 4;
10#[allow(unused_imports)]
11use generic::*;
12#[doc = "Common register and bit access and modify traits"]
13pub mod generic;
14#[cfg(feature = "rt")]
15extern "C" {
16    fn PMC();
17    fn EFC();
18    fn UART0();
19    fn UART1();
20    fn PIOA();
21    fn PIOB();
22    fn USART0();
23    fn USART1();
24    fn TWI0();
25    fn TWI1();
26    fn SPI();
27    fn TC0();
28    fn TC1();
29    fn TC2();
30    fn ADC();
31    fn DACC();
32    fn PWM();
33}
34#[doc(hidden)]
35#[repr(C)]
36pub union Vector {
37    _handler: unsafe extern "C" fn(),
38    _reserved: u32,
39}
40#[cfg(feature = "rt")]
41#[doc(hidden)]
42#[link_section = ".vector_table.interrupts"]
43#[no_mangle]
44pub static __INTERRUPTS: [Vector; 32] = [
45    Vector { _reserved: 0 },
46    Vector { _reserved: 0 },
47    Vector { _reserved: 0 },
48    Vector { _reserved: 0 },
49    Vector { _reserved: 0 },
50    Vector { _handler: PMC },
51    Vector { _handler: EFC },
52    Vector { _reserved: 0 },
53    Vector { _handler: UART0 },
54    Vector { _handler: UART1 },
55    Vector { _reserved: 0 },
56    Vector { _handler: PIOA },
57    Vector { _handler: PIOB },
58    Vector { _reserved: 0 },
59    Vector { _handler: USART0 },
60    Vector { _handler: USART1 },
61    Vector { _reserved: 0 },
62    Vector { _reserved: 0 },
63    Vector { _reserved: 0 },
64    Vector { _handler: TWI0 },
65    Vector { _handler: TWI1 },
66    Vector { _handler: SPI },
67    Vector { _reserved: 0 },
68    Vector { _handler: TC0 },
69    Vector { _handler: TC1 },
70    Vector { _handler: TC2 },
71    Vector { _reserved: 0 },
72    Vector { _reserved: 0 },
73    Vector { _reserved: 0 },
74    Vector { _handler: ADC },
75    Vector { _handler: DACC },
76    Vector { _handler: PWM },
77];
78#[doc = r"Enumeration of all the interrupts."]
79#[derive(Copy, Clone, Debug, PartialEq, Eq)]
80#[repr(u16)]
81pub enum Interrupt {
82    #[doc = "5 - PMC"]
83    PMC = 5,
84    #[doc = "6 - EFC"]
85    EFC = 6,
86    #[doc = "8 - UART0"]
87    UART0 = 8,
88    #[doc = "9 - UART1"]
89    UART1 = 9,
90    #[doc = "11 - PIOA"]
91    PIOA = 11,
92    #[doc = "12 - PIOB"]
93    PIOB = 12,
94    #[doc = "14 - USART0"]
95    USART0 = 14,
96    #[doc = "15 - USART1"]
97    USART1 = 15,
98    #[doc = "19 - TWI0"]
99    TWI0 = 19,
100    #[doc = "20 - TWI1"]
101    TWI1 = 20,
102    #[doc = "21 - SPI"]
103    SPI = 21,
104    #[doc = "23 - TC0"]
105    TC0 = 23,
106    #[doc = "24 - TC1"]
107    TC1 = 24,
108    #[doc = "25 - TC2"]
109    TC2 = 25,
110    #[doc = "29 - ADC"]
111    ADC = 29,
112    #[doc = "30 - DACC"]
113    DACC = 30,
114    #[doc = "31 - PWM"]
115    PWM = 31,
116}
117unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
118    #[inline(always)]
119    fn number(self) -> u16 {
120        self as u16
121    }
122}
123#[doc = "Serial Peripheral Interface"]
124pub struct SPI {
125    _marker: PhantomData<*const ()>,
126}
127unsafe impl Send for SPI {}
128impl SPI {
129    #[doc = r"Pointer to the register block"]
130    pub const PTR: *const spi::RegisterBlock = 0x4000_8000 as *const _;
131    #[doc = r"Return the pointer to the register block"]
132    #[inline(always)]
133    pub const fn ptr() -> *const spi::RegisterBlock {
134        Self::PTR
135    }
136    #[doc = r" Steal an instance of this peripheral"]
137    #[doc = r""]
138    #[doc = r" # Safety"]
139    #[doc = r""]
140    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
141    #[doc = r" that may race with any existing instances, for example by only"]
142    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
143    #[doc = r" original peripheral and using critical sections to coordinate"]
144    #[doc = r" access between multiple new instances."]
145    #[doc = r""]
146    #[doc = r" Additionally, other software such as HALs may rely on only one"]
147    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
148    #[doc = r" no stolen instances are passed to such software."]
149    pub unsafe fn steal() -> Self {
150        Self {
151            _marker: PhantomData,
152        }
153    }
154}
155impl Deref for SPI {
156    type Target = spi::RegisterBlock;
157    #[inline(always)]
158    fn deref(&self) -> &Self::Target {
159        unsafe { &*Self::PTR }
160    }
161}
162impl core::fmt::Debug for SPI {
163    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
164        f.debug_struct("SPI").finish()
165    }
166}
167#[doc = "Serial Peripheral Interface"]
168pub mod spi;
169#[doc = "Timer Counter 0"]
170pub struct TC0 {
171    _marker: PhantomData<*const ()>,
172}
173unsafe impl Send for TC0 {}
174impl TC0 {
175    #[doc = r"Pointer to the register block"]
176    pub const PTR: *const tc0::RegisterBlock = 0x4001_0000 as *const _;
177    #[doc = r"Return the pointer to the register block"]
178    #[inline(always)]
179    pub const fn ptr() -> *const tc0::RegisterBlock {
180        Self::PTR
181    }
182    #[doc = r" Steal an instance of this peripheral"]
183    #[doc = r""]
184    #[doc = r" # Safety"]
185    #[doc = r""]
186    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
187    #[doc = r" that may race with any existing instances, for example by only"]
188    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
189    #[doc = r" original peripheral and using critical sections to coordinate"]
190    #[doc = r" access between multiple new instances."]
191    #[doc = r""]
192    #[doc = r" Additionally, other software such as HALs may rely on only one"]
193    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
194    #[doc = r" no stolen instances are passed to such software."]
195    pub unsafe fn steal() -> Self {
196        Self {
197            _marker: PhantomData,
198        }
199    }
200}
201impl Deref for TC0 {
202    type Target = tc0::RegisterBlock;
203    #[inline(always)]
204    fn deref(&self) -> &Self::Target {
205        unsafe { &*Self::PTR }
206    }
207}
208impl core::fmt::Debug for TC0 {
209    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
210        f.debug_struct("TC0").finish()
211    }
212}
213#[doc = "Timer Counter 0"]
214pub mod tc0;
215#[doc = "Two-wire Interface 0"]
216pub struct TWI0 {
217    _marker: PhantomData<*const ()>,
218}
219unsafe impl Send for TWI0 {}
220impl TWI0 {
221    #[doc = r"Pointer to the register block"]
222    pub const PTR: *const twi0::RegisterBlock = 0x4001_8000 as *const _;
223    #[doc = r"Return the pointer to the register block"]
224    #[inline(always)]
225    pub const fn ptr() -> *const twi0::RegisterBlock {
226        Self::PTR
227    }
228    #[doc = r" Steal an instance of this peripheral"]
229    #[doc = r""]
230    #[doc = r" # Safety"]
231    #[doc = r""]
232    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
233    #[doc = r" that may race with any existing instances, for example by only"]
234    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
235    #[doc = r" original peripheral and using critical sections to coordinate"]
236    #[doc = r" access between multiple new instances."]
237    #[doc = r""]
238    #[doc = r" Additionally, other software such as HALs may rely on only one"]
239    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
240    #[doc = r" no stolen instances are passed to such software."]
241    pub unsafe fn steal() -> Self {
242        Self {
243            _marker: PhantomData,
244        }
245    }
246}
247impl Deref for TWI0 {
248    type Target = twi0::RegisterBlock;
249    #[inline(always)]
250    fn deref(&self) -> &Self::Target {
251        unsafe { &*Self::PTR }
252    }
253}
254impl core::fmt::Debug for TWI0 {
255    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
256        f.debug_struct("TWI0").finish()
257    }
258}
259#[doc = "Two-wire Interface 0"]
260pub mod twi0;
261#[doc = "Two-wire Interface 1"]
262pub struct TWI1 {
263    _marker: PhantomData<*const ()>,
264}
265unsafe impl Send for TWI1 {}
266impl TWI1 {
267    #[doc = r"Pointer to the register block"]
268    pub const PTR: *const twi1::RegisterBlock = 0x4001_c000 as *const _;
269    #[doc = r"Return the pointer to the register block"]
270    #[inline(always)]
271    pub const fn ptr() -> *const twi1::RegisterBlock {
272        Self::PTR
273    }
274    #[doc = r" Steal an instance of this peripheral"]
275    #[doc = r""]
276    #[doc = r" # Safety"]
277    #[doc = r""]
278    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
279    #[doc = r" that may race with any existing instances, for example by only"]
280    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
281    #[doc = r" original peripheral and using critical sections to coordinate"]
282    #[doc = r" access between multiple new instances."]
283    #[doc = r""]
284    #[doc = r" Additionally, other software such as HALs may rely on only one"]
285    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
286    #[doc = r" no stolen instances are passed to such software."]
287    pub unsafe fn steal() -> Self {
288        Self {
289            _marker: PhantomData,
290        }
291    }
292}
293impl Deref for TWI1 {
294    type Target = twi1::RegisterBlock;
295    #[inline(always)]
296    fn deref(&self) -> &Self::Target {
297        unsafe { &*Self::PTR }
298    }
299}
300impl core::fmt::Debug for TWI1 {
301    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
302        f.debug_struct("TWI1").finish()
303    }
304}
305#[doc = "Two-wire Interface 1"]
306pub mod twi1;
307#[doc = "Pulse Width Modulation Controller"]
308pub struct PWM {
309    _marker: PhantomData<*const ()>,
310}
311unsafe impl Send for PWM {}
312impl PWM {
313    #[doc = r"Pointer to the register block"]
314    pub const PTR: *const pwm::RegisterBlock = 0x4002_0000 as *const _;
315    #[doc = r"Return the pointer to the register block"]
316    #[inline(always)]
317    pub const fn ptr() -> *const pwm::RegisterBlock {
318        Self::PTR
319    }
320    #[doc = r" Steal an instance of this peripheral"]
321    #[doc = r""]
322    #[doc = r" # Safety"]
323    #[doc = r""]
324    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
325    #[doc = r" that may race with any existing instances, for example by only"]
326    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
327    #[doc = r" original peripheral and using critical sections to coordinate"]
328    #[doc = r" access between multiple new instances."]
329    #[doc = r""]
330    #[doc = r" Additionally, other software such as HALs may rely on only one"]
331    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
332    #[doc = r" no stolen instances are passed to such software."]
333    pub unsafe fn steal() -> Self {
334        Self {
335            _marker: PhantomData,
336        }
337    }
338}
339impl Deref for PWM {
340    type Target = pwm::RegisterBlock;
341    #[inline(always)]
342    fn deref(&self) -> &Self::Target {
343        unsafe { &*Self::PTR }
344    }
345}
346impl core::fmt::Debug for PWM {
347    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
348        f.debug_struct("PWM").finish()
349    }
350}
351#[doc = "Pulse Width Modulation Controller"]
352pub mod pwm;
353#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 0"]
354pub struct USART0 {
355    _marker: PhantomData<*const ()>,
356}
357unsafe impl Send for USART0 {}
358impl USART0 {
359    #[doc = r"Pointer to the register block"]
360    pub const PTR: *const usart0::RegisterBlock = 0x4002_4000 as *const _;
361    #[doc = r"Return the pointer to the register block"]
362    #[inline(always)]
363    pub const fn ptr() -> *const usart0::RegisterBlock {
364        Self::PTR
365    }
366    #[doc = r" Steal an instance of this peripheral"]
367    #[doc = r""]
368    #[doc = r" # Safety"]
369    #[doc = r""]
370    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
371    #[doc = r" that may race with any existing instances, for example by only"]
372    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
373    #[doc = r" original peripheral and using critical sections to coordinate"]
374    #[doc = r" access between multiple new instances."]
375    #[doc = r""]
376    #[doc = r" Additionally, other software such as HALs may rely on only one"]
377    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
378    #[doc = r" no stolen instances are passed to such software."]
379    pub unsafe fn steal() -> Self {
380        Self {
381            _marker: PhantomData,
382        }
383    }
384}
385impl Deref for USART0 {
386    type Target = usart0::RegisterBlock;
387    #[inline(always)]
388    fn deref(&self) -> &Self::Target {
389        unsafe { &*Self::PTR }
390    }
391}
392impl core::fmt::Debug for USART0 {
393    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
394        f.debug_struct("USART0").finish()
395    }
396}
397#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 0"]
398pub mod usart0;
399#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 1"]
400pub struct USART1 {
401    _marker: PhantomData<*const ()>,
402}
403unsafe impl Send for USART1 {}
404impl USART1 {
405    #[doc = r"Pointer to the register block"]
406    pub const PTR: *const usart1::RegisterBlock = 0x4002_8000 as *const _;
407    #[doc = r"Return the pointer to the register block"]
408    #[inline(always)]
409    pub const fn ptr() -> *const usart1::RegisterBlock {
410        Self::PTR
411    }
412    #[doc = r" Steal an instance of this peripheral"]
413    #[doc = r""]
414    #[doc = r" # Safety"]
415    #[doc = r""]
416    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
417    #[doc = r" that may race with any existing instances, for example by only"]
418    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
419    #[doc = r" original peripheral and using critical sections to coordinate"]
420    #[doc = r" access between multiple new instances."]
421    #[doc = r""]
422    #[doc = r" Additionally, other software such as HALs may rely on only one"]
423    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
424    #[doc = r" no stolen instances are passed to such software."]
425    pub unsafe fn steal() -> Self {
426        Self {
427            _marker: PhantomData,
428        }
429    }
430}
431impl Deref for USART1 {
432    type Target = usart1::RegisterBlock;
433    #[inline(always)]
434    fn deref(&self) -> &Self::Target {
435        unsafe { &*Self::PTR }
436    }
437}
438impl core::fmt::Debug for USART1 {
439    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
440        f.debug_struct("USART1").finish()
441    }
442}
443#[doc = "Universal Synchronous Asynchronous Receiver Transmitter 1"]
444pub mod usart1;
445#[doc = "Analog-to-Digital Converter"]
446pub struct ADC {
447    _marker: PhantomData<*const ()>,
448}
449unsafe impl Send for ADC {}
450impl ADC {
451    #[doc = r"Pointer to the register block"]
452    pub const PTR: *const adc::RegisterBlock = 0x4003_8000 as *const _;
453    #[doc = r"Return the pointer to the register block"]
454    #[inline(always)]
455    pub const fn ptr() -> *const adc::RegisterBlock {
456        Self::PTR
457    }
458    #[doc = r" Steal an instance of this peripheral"]
459    #[doc = r""]
460    #[doc = r" # Safety"]
461    #[doc = r""]
462    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
463    #[doc = r" that may race with any existing instances, for example by only"]
464    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
465    #[doc = r" original peripheral and using critical sections to coordinate"]
466    #[doc = r" access between multiple new instances."]
467    #[doc = r""]
468    #[doc = r" Additionally, other software such as HALs may rely on only one"]
469    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
470    #[doc = r" no stolen instances are passed to such software."]
471    pub unsafe fn steal() -> Self {
472        Self {
473            _marker: PhantomData,
474        }
475    }
476}
477impl Deref for ADC {
478    type Target = adc::RegisterBlock;
479    #[inline(always)]
480    fn deref(&self) -> &Self::Target {
481        unsafe { &*Self::PTR }
482    }
483}
484impl core::fmt::Debug for ADC {
485    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
486        f.debug_struct("ADC").finish()
487    }
488}
489#[doc = "Analog-to-Digital Converter"]
490pub mod adc;
491#[doc = "Digital-to-Analog Converter Controller"]
492pub struct DACC {
493    _marker: PhantomData<*const ()>,
494}
495unsafe impl Send for DACC {}
496impl DACC {
497    #[doc = r"Pointer to the register block"]
498    pub const PTR: *const dacc::RegisterBlock = 0x4003_c000 as *const _;
499    #[doc = r"Return the pointer to the register block"]
500    #[inline(always)]
501    pub const fn ptr() -> *const dacc::RegisterBlock {
502        Self::PTR
503    }
504    #[doc = r" Steal an instance of this peripheral"]
505    #[doc = r""]
506    #[doc = r" # Safety"]
507    #[doc = r""]
508    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
509    #[doc = r" that may race with any existing instances, for example by only"]
510    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
511    #[doc = r" original peripheral and using critical sections to coordinate"]
512    #[doc = r" access between multiple new instances."]
513    #[doc = r""]
514    #[doc = r" Additionally, other software such as HALs may rely on only one"]
515    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
516    #[doc = r" no stolen instances are passed to such software."]
517    pub unsafe fn steal() -> Self {
518        Self {
519            _marker: PhantomData,
520        }
521    }
522}
523impl Deref for DACC {
524    type Target = dacc::RegisterBlock;
525    #[inline(always)]
526    fn deref(&self) -> &Self::Target {
527        unsafe { &*Self::PTR }
528    }
529}
530impl core::fmt::Debug for DACC {
531    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
532        f.debug_struct("DACC").finish()
533    }
534}
535#[doc = "Digital-to-Analog Converter Controller"]
536pub mod dacc;
537#[doc = "AHB Bus Matrix"]
538pub struct MATRIX {
539    _marker: PhantomData<*const ()>,
540}
541unsafe impl Send for MATRIX {}
542impl MATRIX {
543    #[doc = r"Pointer to the register block"]
544    pub const PTR: *const matrix::RegisterBlock = 0x400e_0200 as *const _;
545    #[doc = r"Return the pointer to the register block"]
546    #[inline(always)]
547    pub const fn ptr() -> *const matrix::RegisterBlock {
548        Self::PTR
549    }
550    #[doc = r" Steal an instance of this peripheral"]
551    #[doc = r""]
552    #[doc = r" # Safety"]
553    #[doc = r""]
554    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
555    #[doc = r" that may race with any existing instances, for example by only"]
556    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
557    #[doc = r" original peripheral and using critical sections to coordinate"]
558    #[doc = r" access between multiple new instances."]
559    #[doc = r""]
560    #[doc = r" Additionally, other software such as HALs may rely on only one"]
561    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
562    #[doc = r" no stolen instances are passed to such software."]
563    pub unsafe fn steal() -> Self {
564        Self {
565            _marker: PhantomData,
566        }
567    }
568}
569impl Deref for MATRIX {
570    type Target = matrix::RegisterBlock;
571    #[inline(always)]
572    fn deref(&self) -> &Self::Target {
573        unsafe { &*Self::PTR }
574    }
575}
576impl core::fmt::Debug for MATRIX {
577    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
578        f.debug_struct("MATRIX").finish()
579    }
580}
581#[doc = "AHB Bus Matrix"]
582pub mod matrix;
583#[doc = "Power Management Controller"]
584pub struct PMC {
585    _marker: PhantomData<*const ()>,
586}
587unsafe impl Send for PMC {}
588impl PMC {
589    #[doc = r"Pointer to the register block"]
590    pub const PTR: *const pmc::RegisterBlock = 0x400e_0400 as *const _;
591    #[doc = r"Return the pointer to the register block"]
592    #[inline(always)]
593    pub const fn ptr() -> *const pmc::RegisterBlock {
594        Self::PTR
595    }
596    #[doc = r" Steal an instance of this peripheral"]
597    #[doc = r""]
598    #[doc = r" # Safety"]
599    #[doc = r""]
600    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
601    #[doc = r" that may race with any existing instances, for example by only"]
602    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
603    #[doc = r" original peripheral and using critical sections to coordinate"]
604    #[doc = r" access between multiple new instances."]
605    #[doc = r""]
606    #[doc = r" Additionally, other software such as HALs may rely on only one"]
607    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
608    #[doc = r" no stolen instances are passed to such software."]
609    pub unsafe fn steal() -> Self {
610        Self {
611            _marker: PhantomData,
612        }
613    }
614}
615impl Deref for PMC {
616    type Target = pmc::RegisterBlock;
617    #[inline(always)]
618    fn deref(&self) -> &Self::Target {
619        unsafe { &*Self::PTR }
620    }
621}
622impl core::fmt::Debug for PMC {
623    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
624        f.debug_struct("PMC").finish()
625    }
626}
627#[doc = "Power Management Controller"]
628pub mod pmc;
629#[doc = "Universal Asynchronous Receiver Transmitter 0"]
630pub struct UART0 {
631    _marker: PhantomData<*const ()>,
632}
633unsafe impl Send for UART0 {}
634impl UART0 {
635    #[doc = r"Pointer to the register block"]
636    pub const PTR: *const uart0::RegisterBlock = 0x400e_0600 as *const _;
637    #[doc = r"Return the pointer to the register block"]
638    #[inline(always)]
639    pub const fn ptr() -> *const uart0::RegisterBlock {
640        Self::PTR
641    }
642    #[doc = r" Steal an instance of this peripheral"]
643    #[doc = r""]
644    #[doc = r" # Safety"]
645    #[doc = r""]
646    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
647    #[doc = r" that may race with any existing instances, for example by only"]
648    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
649    #[doc = r" original peripheral and using critical sections to coordinate"]
650    #[doc = r" access between multiple new instances."]
651    #[doc = r""]
652    #[doc = r" Additionally, other software such as HALs may rely on only one"]
653    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
654    #[doc = r" no stolen instances are passed to such software."]
655    pub unsafe fn steal() -> Self {
656        Self {
657            _marker: PhantomData,
658        }
659    }
660}
661impl Deref for UART0 {
662    type Target = uart0::RegisterBlock;
663    #[inline(always)]
664    fn deref(&self) -> &Self::Target {
665        unsafe { &*Self::PTR }
666    }
667}
668impl core::fmt::Debug for UART0 {
669    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
670        f.debug_struct("UART0").finish()
671    }
672}
673#[doc = "Universal Asynchronous Receiver Transmitter 0"]
674pub mod uart0;
675#[doc = "Chip Identifier"]
676pub struct CHIPID {
677    _marker: PhantomData<*const ()>,
678}
679unsafe impl Send for CHIPID {}
680impl CHIPID {
681    #[doc = r"Pointer to the register block"]
682    pub const PTR: *const chipid::RegisterBlock = 0x400e_0740 as *const _;
683    #[doc = r"Return the pointer to the register block"]
684    #[inline(always)]
685    pub const fn ptr() -> *const chipid::RegisterBlock {
686        Self::PTR
687    }
688    #[doc = r" Steal an instance of this peripheral"]
689    #[doc = r""]
690    #[doc = r" # Safety"]
691    #[doc = r""]
692    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
693    #[doc = r" that may race with any existing instances, for example by only"]
694    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
695    #[doc = r" original peripheral and using critical sections to coordinate"]
696    #[doc = r" access between multiple new instances."]
697    #[doc = r""]
698    #[doc = r" Additionally, other software such as HALs may rely on only one"]
699    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
700    #[doc = r" no stolen instances are passed to such software."]
701    pub unsafe fn steal() -> Self {
702        Self {
703            _marker: PhantomData,
704        }
705    }
706}
707impl Deref for CHIPID {
708    type Target = chipid::RegisterBlock;
709    #[inline(always)]
710    fn deref(&self) -> &Self::Target {
711        unsafe { &*Self::PTR }
712    }
713}
714impl core::fmt::Debug for CHIPID {
715    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
716        f.debug_struct("CHIPID").finish()
717    }
718}
719#[doc = "Chip Identifier"]
720pub mod chipid;
721#[doc = "Universal Asynchronous Receiver Transmitter 1"]
722pub struct UART1 {
723    _marker: PhantomData<*const ()>,
724}
725unsafe impl Send for UART1 {}
726impl UART1 {
727    #[doc = r"Pointer to the register block"]
728    pub const PTR: *const uart1::RegisterBlock = 0x400e_0800 as *const _;
729    #[doc = r"Return the pointer to the register block"]
730    #[inline(always)]
731    pub const fn ptr() -> *const uart1::RegisterBlock {
732        Self::PTR
733    }
734    #[doc = r" Steal an instance of this peripheral"]
735    #[doc = r""]
736    #[doc = r" # Safety"]
737    #[doc = r""]
738    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
739    #[doc = r" that may race with any existing instances, for example by only"]
740    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
741    #[doc = r" original peripheral and using critical sections to coordinate"]
742    #[doc = r" access between multiple new instances."]
743    #[doc = r""]
744    #[doc = r" Additionally, other software such as HALs may rely on only one"]
745    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
746    #[doc = r" no stolen instances are passed to such software."]
747    pub unsafe fn steal() -> Self {
748        Self {
749            _marker: PhantomData,
750        }
751    }
752}
753impl Deref for UART1 {
754    type Target = uart1::RegisterBlock;
755    #[inline(always)]
756    fn deref(&self) -> &Self::Target {
757        unsafe { &*Self::PTR }
758    }
759}
760impl core::fmt::Debug for UART1 {
761    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
762        f.debug_struct("UART1").finish()
763    }
764}
765#[doc = "Universal Asynchronous Receiver Transmitter 1"]
766pub mod uart1;
767#[doc = "Embedded Flash Controller"]
768pub struct EFC {
769    _marker: PhantomData<*const ()>,
770}
771unsafe impl Send for EFC {}
772impl EFC {
773    #[doc = r"Pointer to the register block"]
774    pub const PTR: *const efc::RegisterBlock = 0x400e_0a00 as *const _;
775    #[doc = r"Return the pointer to the register block"]
776    #[inline(always)]
777    pub const fn ptr() -> *const efc::RegisterBlock {
778        Self::PTR
779    }
780    #[doc = r" Steal an instance of this peripheral"]
781    #[doc = r""]
782    #[doc = r" # Safety"]
783    #[doc = r""]
784    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
785    #[doc = r" that may race with any existing instances, for example by only"]
786    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
787    #[doc = r" original peripheral and using critical sections to coordinate"]
788    #[doc = r" access between multiple new instances."]
789    #[doc = r""]
790    #[doc = r" Additionally, other software such as HALs may rely on only one"]
791    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
792    #[doc = r" no stolen instances are passed to such software."]
793    pub unsafe fn steal() -> Self {
794        Self {
795            _marker: PhantomData,
796        }
797    }
798}
799impl Deref for EFC {
800    type Target = efc::RegisterBlock;
801    #[inline(always)]
802    fn deref(&self) -> &Self::Target {
803        unsafe { &*Self::PTR }
804    }
805}
806impl core::fmt::Debug for EFC {
807    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
808        f.debug_struct("EFC").finish()
809    }
810}
811#[doc = "Embedded Flash Controller"]
812pub mod efc;
813#[doc = "Parallel Input/Output Controller A"]
814pub struct PIOA {
815    _marker: PhantomData<*const ()>,
816}
817unsafe impl Send for PIOA {}
818impl PIOA {
819    #[doc = r"Pointer to the register block"]
820    pub const PTR: *const pioa::RegisterBlock = 0x400e_0e00 as *const _;
821    #[doc = r"Return the pointer to the register block"]
822    #[inline(always)]
823    pub const fn ptr() -> *const pioa::RegisterBlock {
824        Self::PTR
825    }
826    #[doc = r" Steal an instance of this peripheral"]
827    #[doc = r""]
828    #[doc = r" # Safety"]
829    #[doc = r""]
830    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
831    #[doc = r" that may race with any existing instances, for example by only"]
832    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
833    #[doc = r" original peripheral and using critical sections to coordinate"]
834    #[doc = r" access between multiple new instances."]
835    #[doc = r""]
836    #[doc = r" Additionally, other software such as HALs may rely on only one"]
837    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
838    #[doc = r" no stolen instances are passed to such software."]
839    pub unsafe fn steal() -> Self {
840        Self {
841            _marker: PhantomData,
842        }
843    }
844}
845impl Deref for PIOA {
846    type Target = pioa::RegisterBlock;
847    #[inline(always)]
848    fn deref(&self) -> &Self::Target {
849        unsafe { &*Self::PTR }
850    }
851}
852impl core::fmt::Debug for PIOA {
853    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
854        f.debug_struct("PIOA").finish()
855    }
856}
857#[doc = "Parallel Input/Output Controller A"]
858pub mod pioa;
859#[doc = "Parallel Input/Output Controller B"]
860pub struct PIOB {
861    _marker: PhantomData<*const ()>,
862}
863unsafe impl Send for PIOB {}
864impl PIOB {
865    #[doc = r"Pointer to the register block"]
866    pub const PTR: *const piob::RegisterBlock = 0x400e_1000 as *const _;
867    #[doc = r"Return the pointer to the register block"]
868    #[inline(always)]
869    pub const fn ptr() -> *const piob::RegisterBlock {
870        Self::PTR
871    }
872    #[doc = r" Steal an instance of this peripheral"]
873    #[doc = r""]
874    #[doc = r" # Safety"]
875    #[doc = r""]
876    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
877    #[doc = r" that may race with any existing instances, for example by only"]
878    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
879    #[doc = r" original peripheral and using critical sections to coordinate"]
880    #[doc = r" access between multiple new instances."]
881    #[doc = r""]
882    #[doc = r" Additionally, other software such as HALs may rely on only one"]
883    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
884    #[doc = r" no stolen instances are passed to such software."]
885    pub unsafe fn steal() -> Self {
886        Self {
887            _marker: PhantomData,
888        }
889    }
890}
891impl Deref for PIOB {
892    type Target = piob::RegisterBlock;
893    #[inline(always)]
894    fn deref(&self) -> &Self::Target {
895        unsafe { &*Self::PTR }
896    }
897}
898impl core::fmt::Debug for PIOB {
899    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
900        f.debug_struct("PIOB").finish()
901    }
902}
903#[doc = "Parallel Input/Output Controller B"]
904pub mod piob;
905#[doc = "Reset Controller"]
906pub struct RSTC {
907    _marker: PhantomData<*const ()>,
908}
909unsafe impl Send for RSTC {}
910impl RSTC {
911    #[doc = r"Pointer to the register block"]
912    pub const PTR: *const rstc::RegisterBlock = 0x400e_1400 as *const _;
913    #[doc = r"Return the pointer to the register block"]
914    #[inline(always)]
915    pub const fn ptr() -> *const rstc::RegisterBlock {
916        Self::PTR
917    }
918    #[doc = r" Steal an instance of this peripheral"]
919    #[doc = r""]
920    #[doc = r" # Safety"]
921    #[doc = r""]
922    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
923    #[doc = r" that may race with any existing instances, for example by only"]
924    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
925    #[doc = r" original peripheral and using critical sections to coordinate"]
926    #[doc = r" access between multiple new instances."]
927    #[doc = r""]
928    #[doc = r" Additionally, other software such as HALs may rely on only one"]
929    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
930    #[doc = r" no stolen instances are passed to such software."]
931    pub unsafe fn steal() -> Self {
932        Self {
933            _marker: PhantomData,
934        }
935    }
936}
937impl Deref for RSTC {
938    type Target = rstc::RegisterBlock;
939    #[inline(always)]
940    fn deref(&self) -> &Self::Target {
941        unsafe { &*Self::PTR }
942    }
943}
944impl core::fmt::Debug for RSTC {
945    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
946        f.debug_struct("RSTC").finish()
947    }
948}
949#[doc = "Reset Controller"]
950pub mod rstc;
951#[doc = "Supply Controller"]
952pub struct SUPC {
953    _marker: PhantomData<*const ()>,
954}
955unsafe impl Send for SUPC {}
956impl SUPC {
957    #[doc = r"Pointer to the register block"]
958    pub const PTR: *const supc::RegisterBlock = 0x400e_1410 as *const _;
959    #[doc = r"Return the pointer to the register block"]
960    #[inline(always)]
961    pub const fn ptr() -> *const supc::RegisterBlock {
962        Self::PTR
963    }
964    #[doc = r" Steal an instance of this peripheral"]
965    #[doc = r""]
966    #[doc = r" # Safety"]
967    #[doc = r""]
968    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
969    #[doc = r" that may race with any existing instances, for example by only"]
970    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
971    #[doc = r" original peripheral and using critical sections to coordinate"]
972    #[doc = r" access between multiple new instances."]
973    #[doc = r""]
974    #[doc = r" Additionally, other software such as HALs may rely on only one"]
975    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
976    #[doc = r" no stolen instances are passed to such software."]
977    pub unsafe fn steal() -> Self {
978        Self {
979            _marker: PhantomData,
980        }
981    }
982}
983impl Deref for SUPC {
984    type Target = supc::RegisterBlock;
985    #[inline(always)]
986    fn deref(&self) -> &Self::Target {
987        unsafe { &*Self::PTR }
988    }
989}
990impl core::fmt::Debug for SUPC {
991    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
992        f.debug_struct("SUPC").finish()
993    }
994}
995#[doc = "Supply Controller"]
996pub mod supc;
997#[doc = "Real-time Timer"]
998pub struct RTT {
999    _marker: PhantomData<*const ()>,
1000}
1001unsafe impl Send for RTT {}
1002impl RTT {
1003    #[doc = r"Pointer to the register block"]
1004    pub const PTR: *const rtt::RegisterBlock = 0x400e_1430 as *const _;
1005    #[doc = r"Return the pointer to the register block"]
1006    #[inline(always)]
1007    pub const fn ptr() -> *const rtt::RegisterBlock {
1008        Self::PTR
1009    }
1010    #[doc = r" Steal an instance of this peripheral"]
1011    #[doc = r""]
1012    #[doc = r" # Safety"]
1013    #[doc = r""]
1014    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1015    #[doc = r" that may race with any existing instances, for example by only"]
1016    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1017    #[doc = r" original peripheral and using critical sections to coordinate"]
1018    #[doc = r" access between multiple new instances."]
1019    #[doc = r""]
1020    #[doc = r" Additionally, other software such as HALs may rely on only one"]
1021    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1022    #[doc = r" no stolen instances are passed to such software."]
1023    pub unsafe fn steal() -> Self {
1024        Self {
1025            _marker: PhantomData,
1026        }
1027    }
1028}
1029impl Deref for RTT {
1030    type Target = rtt::RegisterBlock;
1031    #[inline(always)]
1032    fn deref(&self) -> &Self::Target {
1033        unsafe { &*Self::PTR }
1034    }
1035}
1036impl core::fmt::Debug for RTT {
1037    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1038        f.debug_struct("RTT").finish()
1039    }
1040}
1041#[doc = "Real-time Timer"]
1042pub mod rtt;
1043#[doc = "Watchdog Timer"]
1044pub struct WDT {
1045    _marker: PhantomData<*const ()>,
1046}
1047unsafe impl Send for WDT {}
1048impl WDT {
1049    #[doc = r"Pointer to the register block"]
1050    pub const PTR: *const wdt::RegisterBlock = 0x400e_1450 as *const _;
1051    #[doc = r"Return the pointer to the register block"]
1052    #[inline(always)]
1053    pub const fn ptr() -> *const wdt::RegisterBlock {
1054        Self::PTR
1055    }
1056    #[doc = r" Steal an instance of this peripheral"]
1057    #[doc = r""]
1058    #[doc = r" # Safety"]
1059    #[doc = r""]
1060    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1061    #[doc = r" that may race with any existing instances, for example by only"]
1062    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1063    #[doc = r" original peripheral and using critical sections to coordinate"]
1064    #[doc = r" access between multiple new instances."]
1065    #[doc = r""]
1066    #[doc = r" Additionally, other software such as HALs may rely on only one"]
1067    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1068    #[doc = r" no stolen instances are passed to such software."]
1069    pub unsafe fn steal() -> Self {
1070        Self {
1071            _marker: PhantomData,
1072        }
1073    }
1074}
1075impl Deref for WDT {
1076    type Target = wdt::RegisterBlock;
1077    #[inline(always)]
1078    fn deref(&self) -> &Self::Target {
1079        unsafe { &*Self::PTR }
1080    }
1081}
1082impl core::fmt::Debug for WDT {
1083    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1084        f.debug_struct("WDT").finish()
1085    }
1086}
1087#[doc = "Watchdog Timer"]
1088pub mod wdt;
1089#[doc = "Real-time Clock"]
1090pub struct RTC {
1091    _marker: PhantomData<*const ()>,
1092}
1093unsafe impl Send for RTC {}
1094impl RTC {
1095    #[doc = r"Pointer to the register block"]
1096    pub const PTR: *const rtc::RegisterBlock = 0x400e_1460 as *const _;
1097    #[doc = r"Return the pointer to the register block"]
1098    #[inline(always)]
1099    pub const fn ptr() -> *const rtc::RegisterBlock {
1100        Self::PTR
1101    }
1102    #[doc = r" Steal an instance of this peripheral"]
1103    #[doc = r""]
1104    #[doc = r" # Safety"]
1105    #[doc = r""]
1106    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1107    #[doc = r" that may race with any existing instances, for example by only"]
1108    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1109    #[doc = r" original peripheral and using critical sections to coordinate"]
1110    #[doc = r" access between multiple new instances."]
1111    #[doc = r""]
1112    #[doc = r" Additionally, other software such as HALs may rely on only one"]
1113    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1114    #[doc = r" no stolen instances are passed to such software."]
1115    pub unsafe fn steal() -> Self {
1116        Self {
1117            _marker: PhantomData,
1118        }
1119    }
1120}
1121impl Deref for RTC {
1122    type Target = rtc::RegisterBlock;
1123    #[inline(always)]
1124    fn deref(&self) -> &Self::Target {
1125        unsafe { &*Self::PTR }
1126    }
1127}
1128impl core::fmt::Debug for RTC {
1129    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1130        f.debug_struct("RTC").finish()
1131    }
1132}
1133#[doc = "Real-time Clock"]
1134pub mod rtc;
1135#[doc = "General Purpose Backup Registers"]
1136pub struct GPBR {
1137    _marker: PhantomData<*const ()>,
1138}
1139unsafe impl Send for GPBR {}
1140impl GPBR {
1141    #[doc = r"Pointer to the register block"]
1142    pub const PTR: *const gpbr::RegisterBlock = 0x400e_1490 as *const _;
1143    #[doc = r"Return the pointer to the register block"]
1144    #[inline(always)]
1145    pub const fn ptr() -> *const gpbr::RegisterBlock {
1146        Self::PTR
1147    }
1148    #[doc = r" Steal an instance of this peripheral"]
1149    #[doc = r""]
1150    #[doc = r" # Safety"]
1151    #[doc = r""]
1152    #[doc = r" Ensure that the new instance of the peripheral cannot be used in a way"]
1153    #[doc = r" that may race with any existing instances, for example by only"]
1154    #[doc = r" accessing read-only or write-only registers, or by consuming the"]
1155    #[doc = r" original peripheral and using critical sections to coordinate"]
1156    #[doc = r" access between multiple new instances."]
1157    #[doc = r""]
1158    #[doc = r" Additionally, other software such as HALs may rely on only one"]
1159    #[doc = r" peripheral instance existing to ensure memory safety; ensure"]
1160    #[doc = r" no stolen instances are passed to such software."]
1161    pub unsafe fn steal() -> Self {
1162        Self {
1163            _marker: PhantomData,
1164        }
1165    }
1166}
1167impl Deref for GPBR {
1168    type Target = gpbr::RegisterBlock;
1169    #[inline(always)]
1170    fn deref(&self) -> &Self::Target {
1171        unsafe { &*Self::PTR }
1172    }
1173}
1174impl core::fmt::Debug for GPBR {
1175    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1176        f.debug_struct("GPBR").finish()
1177    }
1178}
1179#[doc = "General Purpose Backup Registers"]
1180pub mod gpbr;
1181#[no_mangle]
1182static mut DEVICE_PERIPHERALS: bool = false;
1183#[doc = r" All the peripherals."]
1184#[allow(non_snake_case)]
1185pub struct Peripherals {
1186    #[doc = "SPI"]
1187    pub SPI: SPI,
1188    #[doc = "TC0"]
1189    pub TC0: TC0,
1190    #[doc = "TWI0"]
1191    pub TWI0: TWI0,
1192    #[doc = "TWI1"]
1193    pub TWI1: TWI1,
1194    #[doc = "PWM"]
1195    pub PWM: PWM,
1196    #[doc = "USART0"]
1197    pub USART0: USART0,
1198    #[doc = "USART1"]
1199    pub USART1: USART1,
1200    #[doc = "ADC"]
1201    pub ADC: ADC,
1202    #[doc = "DACC"]
1203    pub DACC: DACC,
1204    #[doc = "MATRIX"]
1205    pub MATRIX: MATRIX,
1206    #[doc = "PMC"]
1207    pub PMC: PMC,
1208    #[doc = "UART0"]
1209    pub UART0: UART0,
1210    #[doc = "CHIPID"]
1211    pub CHIPID: CHIPID,
1212    #[doc = "UART1"]
1213    pub UART1: UART1,
1214    #[doc = "EFC"]
1215    pub EFC: EFC,
1216    #[doc = "PIOA"]
1217    pub PIOA: PIOA,
1218    #[doc = "PIOB"]
1219    pub PIOB: PIOB,
1220    #[doc = "RSTC"]
1221    pub RSTC: RSTC,
1222    #[doc = "SUPC"]
1223    pub SUPC: SUPC,
1224    #[doc = "RTT"]
1225    pub RTT: RTT,
1226    #[doc = "WDT"]
1227    pub WDT: WDT,
1228    #[doc = "RTC"]
1229    pub RTC: RTC,
1230    #[doc = "GPBR"]
1231    pub GPBR: GPBR,
1232}
1233impl Peripherals {
1234    #[doc = r" Returns all the peripherals *once*."]
1235    #[cfg(feature = "critical-section")]
1236    #[inline]
1237    pub fn take() -> Option<Self> {
1238        critical_section::with(|_| {
1239            if unsafe { DEVICE_PERIPHERALS } {
1240                return None;
1241            }
1242            Some(unsafe { Peripherals::steal() })
1243        })
1244    }
1245    #[doc = r" Unchecked version of `Peripherals::take`."]
1246    #[doc = r""]
1247    #[doc = r" # Safety"]
1248    #[doc = r""]
1249    #[doc = r" Each of the returned peripherals must be used at most once."]
1250    #[inline]
1251    pub unsafe fn steal() -> Self {
1252        DEVICE_PERIPHERALS = true;
1253        Peripherals {
1254            SPI: SPI {
1255                _marker: PhantomData,
1256            },
1257            TC0: TC0 {
1258                _marker: PhantomData,
1259            },
1260            TWI0: TWI0 {
1261                _marker: PhantomData,
1262            },
1263            TWI1: TWI1 {
1264                _marker: PhantomData,
1265            },
1266            PWM: PWM {
1267                _marker: PhantomData,
1268            },
1269            USART0: USART0 {
1270                _marker: PhantomData,
1271            },
1272            USART1: USART1 {
1273                _marker: PhantomData,
1274            },
1275            ADC: ADC {
1276                _marker: PhantomData,
1277            },
1278            DACC: DACC {
1279                _marker: PhantomData,
1280            },
1281            MATRIX: MATRIX {
1282                _marker: PhantomData,
1283            },
1284            PMC: PMC {
1285                _marker: PhantomData,
1286            },
1287            UART0: UART0 {
1288                _marker: PhantomData,
1289            },
1290            CHIPID: CHIPID {
1291                _marker: PhantomData,
1292            },
1293            UART1: UART1 {
1294                _marker: PhantomData,
1295            },
1296            EFC: EFC {
1297                _marker: PhantomData,
1298            },
1299            PIOA: PIOA {
1300                _marker: PhantomData,
1301            },
1302            PIOB: PIOB {
1303                _marker: PhantomData,
1304            },
1305            RSTC: RSTC {
1306                _marker: PhantomData,
1307            },
1308            SUPC: SUPC {
1309                _marker: PhantomData,
1310            },
1311            RTT: RTT {
1312                _marker: PhantomData,
1313            },
1314            WDT: WDT {
1315                _marker: PhantomData,
1316            },
1317            RTC: RTC {
1318                _marker: PhantomData,
1319            },
1320            GPBR: GPBR {
1321                _marker: PhantomData,
1322            },
1323        }
1324    }
1325}