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