avr_device/devices/atmega32u4/
mod.rs1#![doc = "Peripheral access API for ATMEGA32U4 microcontrollers (generated using svd2rust v0.28.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.28.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"]
3use core::marker::PhantomData;
4use core::ops::Deref;
5#[doc = r"Number available in the NVIC for configuring priority"]
6pub const NVIC_PRIO_BITS: u8 = 4;
7#[doc(hidden)]
8pub mod interrupt;
9pub use self::interrupt::Interrupt;
10#[doc = "Analog Comparator"]
11pub struct AC {
12 _marker: PhantomData<*const ()>,
13}
14unsafe impl Send for AC {}
15impl AC {
16 #[doc = r"Pointer to the register block"]
17 pub const PTR: *const ac::RegisterBlock = 0x50 as *const _;
18 #[doc = r"Return the pointer to the register block"]
19 #[inline(always)]
20 pub const fn ptr() -> *const ac::RegisterBlock {
21 Self::PTR
22 }
23}
24impl Deref for AC {
25 type Target = ac::RegisterBlock;
26 #[inline(always)]
27 fn deref(&self) -> &Self::Target {
28 unsafe { &*Self::PTR }
29 }
30}
31impl core::fmt::Debug for AC {
32 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
33 f.debug_struct("AC").finish()
34 }
35}
36#[doc = "Analog Comparator"]
37pub mod ac;
38#[doc = "Analog-to-Digital Converter"]
39pub struct ADC {
40 _marker: PhantomData<*const ()>,
41}
42unsafe impl Send for ADC {}
43impl ADC {
44 #[doc = r"Pointer to the register block"]
45 pub const PTR: *const adc::RegisterBlock = 0x78 as *const _;
46 #[doc = r"Return the pointer to the register block"]
47 #[inline(always)]
48 pub const fn ptr() -> *const adc::RegisterBlock {
49 Self::PTR
50 }
51}
52impl Deref for ADC {
53 type Target = adc::RegisterBlock;
54 #[inline(always)]
55 fn deref(&self) -> &Self::Target {
56 unsafe { &*Self::PTR }
57 }
58}
59impl core::fmt::Debug for ADC {
60 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
61 f.debug_struct("ADC").finish()
62 }
63}
64#[doc = "Analog-to-Digital Converter"]
65pub mod adc;
66#[doc = "Bootloader"]
67pub struct BOOT_LOAD {
68 _marker: PhantomData<*const ()>,
69}
70unsafe impl Send for BOOT_LOAD {}
71impl BOOT_LOAD {
72 #[doc = r"Pointer to the register block"]
73 pub const PTR: *const boot_load::RegisterBlock = 0x57 as *const _;
74 #[doc = r"Return the pointer to the register block"]
75 #[inline(always)]
76 pub const fn ptr() -> *const boot_load::RegisterBlock {
77 Self::PTR
78 }
79}
80impl Deref for BOOT_LOAD {
81 type Target = boot_load::RegisterBlock;
82 #[inline(always)]
83 fn deref(&self) -> &Self::Target {
84 unsafe { &*Self::PTR }
85 }
86}
87impl core::fmt::Debug for BOOT_LOAD {
88 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
89 f.debug_struct("BOOT_LOAD").finish()
90 }
91}
92#[doc = "Bootloader"]
93pub mod boot_load;
94#[doc = "CPU Registers"]
95pub struct CPU {
96 _marker: PhantomData<*const ()>,
97}
98unsafe impl Send for CPU {}
99impl CPU {
100 #[doc = r"Pointer to the register block"]
101 pub const PTR: *const cpu::RegisterBlock = 0x3e as *const _;
102 #[doc = r"Return the pointer to the register block"]
103 #[inline(always)]
104 pub const fn ptr() -> *const cpu::RegisterBlock {
105 Self::PTR
106 }
107}
108impl Deref for CPU {
109 type Target = cpu::RegisterBlock;
110 #[inline(always)]
111 fn deref(&self) -> &Self::Target {
112 unsafe { &*Self::PTR }
113 }
114}
115impl core::fmt::Debug for CPU {
116 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
117 f.debug_struct("CPU").finish()
118 }
119}
120#[doc = "CPU Registers"]
121pub mod cpu;
122#[doc = "EEPROM"]
123pub struct EEPROM {
124 _marker: PhantomData<*const ()>,
125}
126unsafe impl Send for EEPROM {}
127impl EEPROM {
128 #[doc = r"Pointer to the register block"]
129 pub const PTR: *const eeprom::RegisterBlock = 0x3f as *const _;
130 #[doc = r"Return the pointer to the register block"]
131 #[inline(always)]
132 pub const fn ptr() -> *const eeprom::RegisterBlock {
133 Self::PTR
134 }
135}
136impl Deref for EEPROM {
137 type Target = eeprom::RegisterBlock;
138 #[inline(always)]
139 fn deref(&self) -> &Self::Target {
140 unsafe { &*Self::PTR }
141 }
142}
143impl core::fmt::Debug for EEPROM {
144 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
145 f.debug_struct("EEPROM").finish()
146 }
147}
148#[doc = "EEPROM"]
149pub mod eeprom;
150#[doc = "External Interrupts"]
151pub struct EXINT {
152 _marker: PhantomData<*const ()>,
153}
154unsafe impl Send for EXINT {}
155impl EXINT {
156 #[doc = r"Pointer to the register block"]
157 pub const PTR: *const exint::RegisterBlock = 0x3b as *const _;
158 #[doc = r"Return the pointer to the register block"]
159 #[inline(always)]
160 pub const fn ptr() -> *const exint::RegisterBlock {
161 Self::PTR
162 }
163}
164impl Deref for EXINT {
165 type Target = exint::RegisterBlock;
166 #[inline(always)]
167 fn deref(&self) -> &Self::Target {
168 unsafe { &*Self::PTR }
169 }
170}
171impl core::fmt::Debug for EXINT {
172 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
173 f.debug_struct("EXINT").finish()
174 }
175}
176#[doc = "External Interrupts"]
177pub mod exint;
178#[doc = "Fuses"]
179pub struct FUSE {
180 _marker: PhantomData<*const ()>,
181}
182unsafe impl Send for FUSE {}
183impl FUSE {
184 #[doc = r"Pointer to the register block"]
185 pub const PTR: *const fuse::RegisterBlock = 0 as *const _;
186 #[doc = r"Return the pointer to the register block"]
187 #[inline(always)]
188 pub const fn ptr() -> *const fuse::RegisterBlock {
189 Self::PTR
190 }
191}
192impl Deref for FUSE {
193 type Target = fuse::RegisterBlock;
194 #[inline(always)]
195 fn deref(&self) -> &Self::Target {
196 unsafe { &*Self::PTR }
197 }
198}
199impl core::fmt::Debug for FUSE {
200 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
201 f.debug_struct("FUSE").finish()
202 }
203}
204#[doc = "Fuses"]
205pub mod fuse;
206#[doc = "JTAG Interface"]
207pub struct JTAG {
208 _marker: PhantomData<*const ()>,
209}
210unsafe impl Send for JTAG {}
211impl JTAG {
212 #[doc = r"Pointer to the register block"]
213 pub const PTR: *const jtag::RegisterBlock = 0x51 as *const _;
214 #[doc = r"Return the pointer to the register block"]
215 #[inline(always)]
216 pub const fn ptr() -> *const jtag::RegisterBlock {
217 Self::PTR
218 }
219}
220impl Deref for JTAG {
221 type Target = jtag::RegisterBlock;
222 #[inline(always)]
223 fn deref(&self) -> &Self::Target {
224 unsafe { &*Self::PTR }
225 }
226}
227impl core::fmt::Debug for JTAG {
228 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
229 f.debug_struct("JTAG").finish()
230 }
231}
232#[doc = "JTAG Interface"]
233pub mod jtag;
234#[doc = "Lockbits"]
235pub struct LOCKBIT {
236 _marker: PhantomData<*const ()>,
237}
238unsafe impl Send for LOCKBIT {}
239impl LOCKBIT {
240 #[doc = r"Pointer to the register block"]
241 pub const PTR: *const lockbit::RegisterBlock = 0 as *const _;
242 #[doc = r"Return the pointer to the register block"]
243 #[inline(always)]
244 pub const fn ptr() -> *const lockbit::RegisterBlock {
245 Self::PTR
246 }
247}
248impl Deref for LOCKBIT {
249 type Target = lockbit::RegisterBlock;
250 #[inline(always)]
251 fn deref(&self) -> &Self::Target {
252 unsafe { &*Self::PTR }
253 }
254}
255impl core::fmt::Debug for LOCKBIT {
256 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
257 f.debug_struct("LOCKBIT").finish()
258 }
259}
260#[doc = "Lockbits"]
261pub mod lockbit;
262#[doc = "Phase Locked Loop"]
263pub struct PLL {
264 _marker: PhantomData<*const ()>,
265}
266unsafe impl Send for PLL {}
267impl PLL {
268 #[doc = r"Pointer to the register block"]
269 pub const PTR: *const pll::RegisterBlock = 0x49 as *const _;
270 #[doc = r"Return the pointer to the register block"]
271 #[inline(always)]
272 pub const fn ptr() -> *const pll::RegisterBlock {
273 Self::PTR
274 }
275}
276impl Deref for PLL {
277 type Target = pll::RegisterBlock;
278 #[inline(always)]
279 fn deref(&self) -> &Self::Target {
280 unsafe { &*Self::PTR }
281 }
282}
283impl core::fmt::Debug for PLL {
284 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
285 f.debug_struct("PLL").finish()
286 }
287}
288#[doc = "Phase Locked Loop"]
289pub mod pll;
290#[doc = "I/O Port"]
291pub struct PORTB {
292 _marker: PhantomData<*const ()>,
293}
294unsafe impl Send for PORTB {}
295impl PORTB {
296 #[doc = r"Pointer to the register block"]
297 pub const PTR: *const portb::RegisterBlock = 0x23 as *const _;
298 #[doc = r"Return the pointer to the register block"]
299 #[inline(always)]
300 pub const fn ptr() -> *const portb::RegisterBlock {
301 Self::PTR
302 }
303}
304impl Deref for PORTB {
305 type Target = portb::RegisterBlock;
306 #[inline(always)]
307 fn deref(&self) -> &Self::Target {
308 unsafe { &*Self::PTR }
309 }
310}
311impl core::fmt::Debug for PORTB {
312 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
313 f.debug_struct("PORTB").finish()
314 }
315}
316#[doc = "I/O Port"]
317pub mod portb;
318#[doc = "I/O Port"]
319pub struct PORTC {
320 _marker: PhantomData<*const ()>,
321}
322unsafe impl Send for PORTC {}
323impl PORTC {
324 #[doc = r"Pointer to the register block"]
325 pub const PTR: *const portc::RegisterBlock = 0x26 as *const _;
326 #[doc = r"Return the pointer to the register block"]
327 #[inline(always)]
328 pub const fn ptr() -> *const portc::RegisterBlock {
329 Self::PTR
330 }
331}
332impl Deref for PORTC {
333 type Target = portc::RegisterBlock;
334 #[inline(always)]
335 fn deref(&self) -> &Self::Target {
336 unsafe { &*Self::PTR }
337 }
338}
339impl core::fmt::Debug for PORTC {
340 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
341 f.debug_struct("PORTC").finish()
342 }
343}
344#[doc = "I/O Port"]
345pub mod portc;
346#[doc = "I/O Port"]
347pub struct PORTD {
348 _marker: PhantomData<*const ()>,
349}
350unsafe impl Send for PORTD {}
351impl PORTD {
352 #[doc = r"Pointer to the register block"]
353 pub const PTR: *const portd::RegisterBlock = 0x29 as *const _;
354 #[doc = r"Return the pointer to the register block"]
355 #[inline(always)]
356 pub const fn ptr() -> *const portd::RegisterBlock {
357 Self::PTR
358 }
359}
360impl Deref for PORTD {
361 type Target = portd::RegisterBlock;
362 #[inline(always)]
363 fn deref(&self) -> &Self::Target {
364 unsafe { &*Self::PTR }
365 }
366}
367impl core::fmt::Debug for PORTD {
368 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
369 f.debug_struct("PORTD").finish()
370 }
371}
372#[doc = "I/O Port"]
373pub mod portd;
374#[doc = "I/O Port"]
375pub struct PORTE {
376 _marker: PhantomData<*const ()>,
377}
378unsafe impl Send for PORTE {}
379impl PORTE {
380 #[doc = r"Pointer to the register block"]
381 pub const PTR: *const porte::RegisterBlock = 0x2c as *const _;
382 #[doc = r"Return the pointer to the register block"]
383 #[inline(always)]
384 pub const fn ptr() -> *const porte::RegisterBlock {
385 Self::PTR
386 }
387}
388impl Deref for PORTE {
389 type Target = porte::RegisterBlock;
390 #[inline(always)]
391 fn deref(&self) -> &Self::Target {
392 unsafe { &*Self::PTR }
393 }
394}
395impl core::fmt::Debug for PORTE {
396 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
397 f.debug_struct("PORTE").finish()
398 }
399}
400#[doc = "I/O Port"]
401pub mod porte;
402#[doc = "I/O Port"]
403pub struct PORTF {
404 _marker: PhantomData<*const ()>,
405}
406unsafe impl Send for PORTF {}
407impl PORTF {
408 #[doc = r"Pointer to the register block"]
409 pub const PTR: *const portf::RegisterBlock = 0x2f as *const _;
410 #[doc = r"Return the pointer to the register block"]
411 #[inline(always)]
412 pub const fn ptr() -> *const portf::RegisterBlock {
413 Self::PTR
414 }
415}
416impl Deref for PORTF {
417 type Target = portf::RegisterBlock;
418 #[inline(always)]
419 fn deref(&self) -> &Self::Target {
420 unsafe { &*Self::PTR }
421 }
422}
423impl core::fmt::Debug for PORTF {
424 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
425 f.debug_struct("PORTF").finish()
426 }
427}
428#[doc = "I/O Port"]
429pub mod portf;
430#[doc = "Serial Peripheral Interface"]
431pub struct SPI {
432 _marker: PhantomData<*const ()>,
433}
434unsafe impl Send for SPI {}
435impl SPI {
436 #[doc = r"Pointer to the register block"]
437 pub const PTR: *const spi::RegisterBlock = 0x4c as *const _;
438 #[doc = r"Return the pointer to the register block"]
439 #[inline(always)]
440 pub const fn ptr() -> *const spi::RegisterBlock {
441 Self::PTR
442 }
443}
444impl Deref for SPI {
445 type Target = spi::RegisterBlock;
446 #[inline(always)]
447 fn deref(&self) -> &Self::Target {
448 unsafe { &*Self::PTR }
449 }
450}
451impl core::fmt::Debug for SPI {
452 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
453 f.debug_struct("SPI").finish()
454 }
455}
456#[doc = "Serial Peripheral Interface"]
457pub mod spi;
458#[doc = "Timer/Counter, 8-bit"]
459pub struct TC0 {
460 _marker: PhantomData<*const ()>,
461}
462unsafe impl Send for TC0 {}
463impl TC0 {
464 #[doc = r"Pointer to the register block"]
465 pub const PTR: *const tc0::RegisterBlock = 0x35 as *const _;
466 #[doc = r"Return the pointer to the register block"]
467 #[inline(always)]
468 pub const fn ptr() -> *const tc0::RegisterBlock {
469 Self::PTR
470 }
471}
472impl Deref for TC0 {
473 type Target = tc0::RegisterBlock;
474 #[inline(always)]
475 fn deref(&self) -> &Self::Target {
476 unsafe { &*Self::PTR }
477 }
478}
479impl core::fmt::Debug for TC0 {
480 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
481 f.debug_struct("TC0").finish()
482 }
483}
484#[doc = "Timer/Counter, 8-bit"]
485pub mod tc0;
486#[doc = "Timer/Counter, 16-bit"]
487pub struct TC1 {
488 _marker: PhantomData<*const ()>,
489}
490unsafe impl Send for TC1 {}
491impl TC1 {
492 #[doc = r"Pointer to the register block"]
493 pub const PTR: *const tc1::RegisterBlock = 0x36 as *const _;
494 #[doc = r"Return the pointer to the register block"]
495 #[inline(always)]
496 pub const fn ptr() -> *const tc1::RegisterBlock {
497 Self::PTR
498 }
499}
500impl Deref for TC1 {
501 type Target = tc1::RegisterBlock;
502 #[inline(always)]
503 fn deref(&self) -> &Self::Target {
504 unsafe { &*Self::PTR }
505 }
506}
507impl core::fmt::Debug for TC1 {
508 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
509 f.debug_struct("TC1").finish()
510 }
511}
512#[doc = "Timer/Counter, 16-bit"]
513pub mod tc1;
514#[doc = "Timer/Counter, 16-bit"]
515pub struct TC3 {
516 _marker: PhantomData<*const ()>,
517}
518unsafe impl Send for TC3 {}
519impl TC3 {
520 #[doc = r"Pointer to the register block"]
521 pub const PTR: *const tc3::RegisterBlock = 0x38 as *const _;
522 #[doc = r"Return the pointer to the register block"]
523 #[inline(always)]
524 pub const fn ptr() -> *const tc3::RegisterBlock {
525 Self::PTR
526 }
527}
528impl Deref for TC3 {
529 type Target = tc3::RegisterBlock;
530 #[inline(always)]
531 fn deref(&self) -> &Self::Target {
532 unsafe { &*Self::PTR }
533 }
534}
535impl core::fmt::Debug for TC3 {
536 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
537 f.debug_struct("TC3").finish()
538 }
539}
540#[doc = "Timer/Counter, 16-bit"]
541pub mod tc3;
542#[doc = "Timer/Counter, 10-bit"]
543pub struct TC4 {
544 _marker: PhantomData<*const ()>,
545}
546unsafe impl Send for TC4 {}
547impl TC4 {
548 #[doc = r"Pointer to the register block"]
549 pub const PTR: *const tc4::RegisterBlock = 0x39 as *const _;
550 #[doc = r"Return the pointer to the register block"]
551 #[inline(always)]
552 pub const fn ptr() -> *const tc4::RegisterBlock {
553 Self::PTR
554 }
555}
556impl Deref for TC4 {
557 type Target = tc4::RegisterBlock;
558 #[inline(always)]
559 fn deref(&self) -> &Self::Target {
560 unsafe { &*Self::PTR }
561 }
562}
563impl core::fmt::Debug for TC4 {
564 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
565 f.debug_struct("TC4").finish()
566 }
567}
568#[doc = "Timer/Counter, 10-bit"]
569pub mod tc4;
570#[doc = "Two Wire Serial Interface"]
571pub struct TWI {
572 _marker: PhantomData<*const ()>,
573}
574unsafe impl Send for TWI {}
575impl TWI {
576 #[doc = r"Pointer to the register block"]
577 pub const PTR: *const twi::RegisterBlock = 0xb8 as *const _;
578 #[doc = r"Return the pointer to the register block"]
579 #[inline(always)]
580 pub const fn ptr() -> *const twi::RegisterBlock {
581 Self::PTR
582 }
583}
584impl Deref for TWI {
585 type Target = twi::RegisterBlock;
586 #[inline(always)]
587 fn deref(&self) -> &Self::Target {
588 unsafe { &*Self::PTR }
589 }
590}
591impl core::fmt::Debug for TWI {
592 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
593 f.debug_struct("TWI").finish()
594 }
595}
596#[doc = "Two Wire Serial Interface"]
597pub mod twi;
598#[doc = "USART"]
599pub struct USART1 {
600 _marker: PhantomData<*const ()>,
601}
602unsafe impl Send for USART1 {}
603impl USART1 {
604 #[doc = r"Pointer to the register block"]
605 pub const PTR: *const usart1::RegisterBlock = 0xc8 as *const _;
606 #[doc = r"Return the pointer to the register block"]
607 #[inline(always)]
608 pub const fn ptr() -> *const usart1::RegisterBlock {
609 Self::PTR
610 }
611}
612impl Deref for USART1 {
613 type Target = usart1::RegisterBlock;
614 #[inline(always)]
615 fn deref(&self) -> &Self::Target {
616 unsafe { &*Self::PTR }
617 }
618}
619impl core::fmt::Debug for USART1 {
620 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
621 f.debug_struct("USART1").finish()
622 }
623}
624#[doc = "USART"]
625pub mod usart1;
626#[doc = "USB Device Registers"]
627pub struct USB_DEVICE {
628 _marker: PhantomData<*const ()>,
629}
630unsafe impl Send for USB_DEVICE {}
631impl USB_DEVICE {
632 #[doc = r"Pointer to the register block"]
633 pub const PTR: *const usb_device::RegisterBlock = 0xd7 as *const _;
634 #[doc = r"Return the pointer to the register block"]
635 #[inline(always)]
636 pub const fn ptr() -> *const usb_device::RegisterBlock {
637 Self::PTR
638 }
639}
640impl Deref for USB_DEVICE {
641 type Target = usb_device::RegisterBlock;
642 #[inline(always)]
643 fn deref(&self) -> &Self::Target {
644 unsafe { &*Self::PTR }
645 }
646}
647impl core::fmt::Debug for USB_DEVICE {
648 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
649 f.debug_struct("USB_DEVICE").finish()
650 }
651}
652#[doc = "USB Device Registers"]
653pub mod usb_device;
654#[doc = "Watchdog Timer"]
655pub struct WDT {
656 _marker: PhantomData<*const ()>,
657}
658unsafe impl Send for WDT {}
659impl WDT {
660 #[doc = r"Pointer to the register block"]
661 pub const PTR: *const wdt::RegisterBlock = 0x60 as *const _;
662 #[doc = r"Return the pointer to the register block"]
663 #[inline(always)]
664 pub const fn ptr() -> *const wdt::RegisterBlock {
665 Self::PTR
666 }
667}
668impl Deref for WDT {
669 type Target = wdt::RegisterBlock;
670 #[inline(always)]
671 fn deref(&self) -> &Self::Target {
672 unsafe { &*Self::PTR }
673 }
674}
675impl core::fmt::Debug for WDT {
676 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
677 f.debug_struct("WDT").finish()
678 }
679}
680#[doc = "Watchdog Timer"]
681pub mod wdt;
682use crate::devices::DEVICE_PERIPHERALS;
683#[doc = r" All the peripherals."]
684#[allow(non_snake_case)]
685pub struct Peripherals {
686 #[doc = "AC"]
687 pub AC: AC,
688 #[doc = "ADC"]
689 pub ADC: ADC,
690 #[doc = "BOOT_LOAD"]
691 pub BOOT_LOAD: BOOT_LOAD,
692 #[doc = "CPU"]
693 pub CPU: CPU,
694 #[doc = "EEPROM"]
695 pub EEPROM: EEPROM,
696 #[doc = "EXINT"]
697 pub EXINT: EXINT,
698 #[doc = "FUSE"]
699 pub FUSE: FUSE,
700 #[doc = "JTAG"]
701 pub JTAG: JTAG,
702 #[doc = "LOCKBIT"]
703 pub LOCKBIT: LOCKBIT,
704 #[doc = "PLL"]
705 pub PLL: PLL,
706 #[doc = "PORTB"]
707 pub PORTB: PORTB,
708 #[doc = "PORTC"]
709 pub PORTC: PORTC,
710 #[doc = "PORTD"]
711 pub PORTD: PORTD,
712 #[doc = "PORTE"]
713 pub PORTE: PORTE,
714 #[doc = "PORTF"]
715 pub PORTF: PORTF,
716 #[doc = "SPI"]
717 pub SPI: SPI,
718 #[doc = "TC0"]
719 pub TC0: TC0,
720 #[doc = "TC1"]
721 pub TC1: TC1,
722 #[doc = "TC3"]
723 pub TC3: TC3,
724 #[doc = "TC4"]
725 pub TC4: TC4,
726 #[doc = "TWI"]
727 pub TWI: TWI,
728 #[doc = "USART1"]
729 pub USART1: USART1,
730 #[doc = "USB_DEVICE"]
731 pub USB_DEVICE: USB_DEVICE,
732 #[doc = "WDT"]
733 pub WDT: WDT,
734}
735impl Peripherals {
736 #[doc = r" Returns all the peripherals *once*."]
737 #[inline]
738 pub fn take() -> Option<Self> {
739 crate::interrupt::free(|_| {
740 if unsafe { DEVICE_PERIPHERALS } {
741 return None;
742 }
743 Some(unsafe { Peripherals::steal() })
744 })
745 }
746 #[doc = r" Unchecked version of `Peripherals::take`."]
747 #[doc = r""]
748 #[doc = r" # Safety"]
749 #[doc = r""]
750 #[doc = r" Each of the returned peripherals must be used at most once."]
751 #[inline]
752 pub unsafe fn steal() -> Self {
753 DEVICE_PERIPHERALS = true;
754 Peripherals {
755 AC: AC {
756 _marker: PhantomData,
757 },
758 ADC: ADC {
759 _marker: PhantomData,
760 },
761 BOOT_LOAD: BOOT_LOAD {
762 _marker: PhantomData,
763 },
764 CPU: CPU {
765 _marker: PhantomData,
766 },
767 EEPROM: EEPROM {
768 _marker: PhantomData,
769 },
770 EXINT: EXINT {
771 _marker: PhantomData,
772 },
773 FUSE: FUSE {
774 _marker: PhantomData,
775 },
776 JTAG: JTAG {
777 _marker: PhantomData,
778 },
779 LOCKBIT: LOCKBIT {
780 _marker: PhantomData,
781 },
782 PLL: PLL {
783 _marker: PhantomData,
784 },
785 PORTB: PORTB {
786 _marker: PhantomData,
787 },
788 PORTC: PORTC {
789 _marker: PhantomData,
790 },
791 PORTD: PORTD {
792 _marker: PhantomData,
793 },
794 PORTE: PORTE {
795 _marker: PhantomData,
796 },
797 PORTF: PORTF {
798 _marker: PhantomData,
799 },
800 SPI: SPI {
801 _marker: PhantomData,
802 },
803 TC0: TC0 {
804 _marker: PhantomData,
805 },
806 TC1: TC1 {
807 _marker: PhantomData,
808 },
809 TC3: TC3 {
810 _marker: PhantomData,
811 },
812 TC4: TC4 {
813 _marker: PhantomData,
814 },
815 TWI: TWI {
816 _marker: PhantomData,
817 },
818 USART1: USART1 {
819 _marker: PhantomData,
820 },
821 USB_DEVICE: USB_DEVICE {
822 _marker: PhantomData,
823 },
824 WDT: WDT {
825 _marker: PhantomData,
826 },
827 }
828 }
829}