1#![doc = "Peripheral access API for ATMEGA2560 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 = "I/O Port"]
263pub struct PORTA {
264 _marker: PhantomData<*const ()>,
265}
266unsafe impl Send for PORTA {}
267impl PORTA {
268 #[doc = r"Pointer to the register block"]
269 pub const PTR: *const porta::RegisterBlock = 0x20 as *const _;
270 #[doc = r"Return the pointer to the register block"]
271 #[inline(always)]
272 pub const fn ptr() -> *const porta::RegisterBlock {
273 Self::PTR
274 }
275}
276impl Deref for PORTA {
277 type Target = porta::RegisterBlock;
278 #[inline(always)]
279 fn deref(&self) -> &Self::Target {
280 unsafe { &*Self::PTR }
281 }
282}
283impl core::fmt::Debug for PORTA {
284 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
285 f.debug_struct("PORTA").finish()
286 }
287}
288#[doc = "I/O Port"]
289pub mod porta;
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 = "I/O Port"]
431pub struct PORTG {
432 _marker: PhantomData<*const ()>,
433}
434unsafe impl Send for PORTG {}
435impl PORTG {
436 #[doc = r"Pointer to the register block"]
437 pub const PTR: *const portg::RegisterBlock = 0x32 as *const _;
438 #[doc = r"Return the pointer to the register block"]
439 #[inline(always)]
440 pub const fn ptr() -> *const portg::RegisterBlock {
441 Self::PTR
442 }
443}
444impl Deref for PORTG {
445 type Target = portg::RegisterBlock;
446 #[inline(always)]
447 fn deref(&self) -> &Self::Target {
448 unsafe { &*Self::PTR }
449 }
450}
451impl core::fmt::Debug for PORTG {
452 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
453 f.debug_struct("PORTG").finish()
454 }
455}
456#[doc = "I/O Port"]
457pub mod portg;
458#[doc = "I/O Port"]
459pub struct PORTH {
460 _marker: PhantomData<*const ()>,
461}
462unsafe impl Send for PORTH {}
463impl PORTH {
464 #[doc = r"Pointer to the register block"]
465 pub const PTR: *const porth::RegisterBlock = 0x0100 as *const _;
466 #[doc = r"Return the pointer to the register block"]
467 #[inline(always)]
468 pub const fn ptr() -> *const porth::RegisterBlock {
469 Self::PTR
470 }
471}
472impl Deref for PORTH {
473 type Target = porth::RegisterBlock;
474 #[inline(always)]
475 fn deref(&self) -> &Self::Target {
476 unsafe { &*Self::PTR }
477 }
478}
479impl core::fmt::Debug for PORTH {
480 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
481 f.debug_struct("PORTH").finish()
482 }
483}
484#[doc = "I/O Port"]
485pub mod porth;
486#[doc = "I/O Port"]
487pub struct PORTJ {
488 _marker: PhantomData<*const ()>,
489}
490unsafe impl Send for PORTJ {}
491impl PORTJ {
492 #[doc = r"Pointer to the register block"]
493 pub const PTR: *const portj::RegisterBlock = 0x0103 as *const _;
494 #[doc = r"Return the pointer to the register block"]
495 #[inline(always)]
496 pub const fn ptr() -> *const portj::RegisterBlock {
497 Self::PTR
498 }
499}
500impl Deref for PORTJ {
501 type Target = portj::RegisterBlock;
502 #[inline(always)]
503 fn deref(&self) -> &Self::Target {
504 unsafe { &*Self::PTR }
505 }
506}
507impl core::fmt::Debug for PORTJ {
508 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
509 f.debug_struct("PORTJ").finish()
510 }
511}
512#[doc = "I/O Port"]
513pub mod portj;
514#[doc = "I/O Port"]
515pub struct PORTK {
516 _marker: PhantomData<*const ()>,
517}
518unsafe impl Send for PORTK {}
519impl PORTK {
520 #[doc = r"Pointer to the register block"]
521 pub const PTR: *const portk::RegisterBlock = 0x0106 as *const _;
522 #[doc = r"Return the pointer to the register block"]
523 #[inline(always)]
524 pub const fn ptr() -> *const portk::RegisterBlock {
525 Self::PTR
526 }
527}
528impl Deref for PORTK {
529 type Target = portk::RegisterBlock;
530 #[inline(always)]
531 fn deref(&self) -> &Self::Target {
532 unsafe { &*Self::PTR }
533 }
534}
535impl core::fmt::Debug for PORTK {
536 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
537 f.debug_struct("PORTK").finish()
538 }
539}
540#[doc = "I/O Port"]
541pub mod portk;
542#[doc = "I/O Port"]
543pub struct PORTL {
544 _marker: PhantomData<*const ()>,
545}
546unsafe impl Send for PORTL {}
547impl PORTL {
548 #[doc = r"Pointer to the register block"]
549 pub const PTR: *const portl::RegisterBlock = 0x0109 as *const _;
550 #[doc = r"Return the pointer to the register block"]
551 #[inline(always)]
552 pub const fn ptr() -> *const portl::RegisterBlock {
553 Self::PTR
554 }
555}
556impl Deref for PORTL {
557 type Target = portl::RegisterBlock;
558 #[inline(always)]
559 fn deref(&self) -> &Self::Target {
560 unsafe { &*Self::PTR }
561 }
562}
563impl core::fmt::Debug for PORTL {
564 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
565 f.debug_struct("PORTL").finish()
566 }
567}
568#[doc = "I/O Port"]
569pub mod portl;
570#[doc = "Serial Peripheral Interface"]
571pub struct SPI {
572 _marker: PhantomData<*const ()>,
573}
574unsafe impl Send for SPI {}
575impl SPI {
576 #[doc = r"Pointer to the register block"]
577 pub const PTR: *const spi::RegisterBlock = 0x4c as *const _;
578 #[doc = r"Return the pointer to the register block"]
579 #[inline(always)]
580 pub const fn ptr() -> *const spi::RegisterBlock {
581 Self::PTR
582 }
583}
584impl Deref for SPI {
585 type Target = spi::RegisterBlock;
586 #[inline(always)]
587 fn deref(&self) -> &Self::Target {
588 unsafe { &*Self::PTR }
589 }
590}
591impl core::fmt::Debug for SPI {
592 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
593 f.debug_struct("SPI").finish()
594 }
595}
596#[doc = "Serial Peripheral Interface"]
597pub mod spi;
598#[doc = "Timer/Counter, 8-bit"]
599pub struct TC0 {
600 _marker: PhantomData<*const ()>,
601}
602unsafe impl Send for TC0 {}
603impl TC0 {
604 #[doc = r"Pointer to the register block"]
605 pub const PTR: *const tc0::RegisterBlock = 0x35 as *const _;
606 #[doc = r"Return the pointer to the register block"]
607 #[inline(always)]
608 pub const fn ptr() -> *const tc0::RegisterBlock {
609 Self::PTR
610 }
611}
612impl Deref for TC0 {
613 type Target = tc0::RegisterBlock;
614 #[inline(always)]
615 fn deref(&self) -> &Self::Target {
616 unsafe { &*Self::PTR }
617 }
618}
619impl core::fmt::Debug for TC0 {
620 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
621 f.debug_struct("TC0").finish()
622 }
623}
624#[doc = "Timer/Counter, 8-bit"]
625pub mod tc0;
626#[doc = "Timer/Counter, 16-bit"]
627pub struct TC1 {
628 _marker: PhantomData<*const ()>,
629}
630unsafe impl Send for TC1 {}
631impl TC1 {
632 #[doc = r"Pointer to the register block"]
633 pub const PTR: *const tc1::RegisterBlock = 0x36 as *const _;
634 #[doc = r"Return the pointer to the register block"]
635 #[inline(always)]
636 pub const fn ptr() -> *const tc1::RegisterBlock {
637 Self::PTR
638 }
639}
640impl Deref for TC1 {
641 type Target = tc1::RegisterBlock;
642 #[inline(always)]
643 fn deref(&self) -> &Self::Target {
644 unsafe { &*Self::PTR }
645 }
646}
647impl core::fmt::Debug for TC1 {
648 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
649 f.debug_struct("TC1").finish()
650 }
651}
652#[doc = "Timer/Counter, 16-bit"]
653pub mod tc1;
654#[doc = "Timer/Counter, 8-bit Async"]
655pub struct TC2 {
656 _marker: PhantomData<*const ()>,
657}
658unsafe impl Send for TC2 {}
659impl TC2 {
660 #[doc = r"Pointer to the register block"]
661 pub const PTR: *const tc2::RegisterBlock = 0x37 as *const _;
662 #[doc = r"Return the pointer to the register block"]
663 #[inline(always)]
664 pub const fn ptr() -> *const tc2::RegisterBlock {
665 Self::PTR
666 }
667}
668impl Deref for TC2 {
669 type Target = tc2::RegisterBlock;
670 #[inline(always)]
671 fn deref(&self) -> &Self::Target {
672 unsafe { &*Self::PTR }
673 }
674}
675impl core::fmt::Debug for TC2 {
676 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
677 f.debug_struct("TC2").finish()
678 }
679}
680#[doc = "Timer/Counter, 8-bit Async"]
681pub mod tc2;
682#[doc = "Timer/Counter, 16-bit"]
683pub struct TC3 {
684 _marker: PhantomData<*const ()>,
685}
686unsafe impl Send for TC3 {}
687impl TC3 {
688 #[doc = r"Pointer to the register block"]
689 pub const PTR: *const tc3::RegisterBlock = 0x38 as *const _;
690 #[doc = r"Return the pointer to the register block"]
691 #[inline(always)]
692 pub const fn ptr() -> *const tc3::RegisterBlock {
693 Self::PTR
694 }
695}
696impl Deref for TC3 {
697 type Target = tc3::RegisterBlock;
698 #[inline(always)]
699 fn deref(&self) -> &Self::Target {
700 unsafe { &*Self::PTR }
701 }
702}
703impl core::fmt::Debug for TC3 {
704 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
705 f.debug_struct("TC3").finish()
706 }
707}
708#[doc = "Timer/Counter, 16-bit"]
709pub mod tc3;
710#[doc = "Timer/Counter, 16-bit"]
711pub struct TC4 {
712 _marker: PhantomData<*const ()>,
713}
714unsafe impl Send for TC4 {}
715impl TC4 {
716 #[doc = r"Pointer to the register block"]
717 pub const PTR: *const tc4::RegisterBlock = 0x39 as *const _;
718 #[doc = r"Return the pointer to the register block"]
719 #[inline(always)]
720 pub const fn ptr() -> *const tc4::RegisterBlock {
721 Self::PTR
722 }
723}
724impl Deref for TC4 {
725 type Target = tc4::RegisterBlock;
726 #[inline(always)]
727 fn deref(&self) -> &Self::Target {
728 unsafe { &*Self::PTR }
729 }
730}
731impl core::fmt::Debug for TC4 {
732 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
733 f.debug_struct("TC4").finish()
734 }
735}
736#[doc = "Timer/Counter, 16-bit"]
737pub mod tc4;
738#[doc = "Timer/Counter, 16-bit"]
739pub struct TC5 {
740 _marker: PhantomData<*const ()>,
741}
742unsafe impl Send for TC5 {}
743impl TC5 {
744 #[doc = r"Pointer to the register block"]
745 pub const PTR: *const tc5::RegisterBlock = 0x3a as *const _;
746 #[doc = r"Return the pointer to the register block"]
747 #[inline(always)]
748 pub const fn ptr() -> *const tc5::RegisterBlock {
749 Self::PTR
750 }
751}
752impl Deref for TC5 {
753 type Target = tc5::RegisterBlock;
754 #[inline(always)]
755 fn deref(&self) -> &Self::Target {
756 unsafe { &*Self::PTR }
757 }
758}
759impl core::fmt::Debug for TC5 {
760 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
761 f.debug_struct("TC5").finish()
762 }
763}
764#[doc = "Timer/Counter, 16-bit"]
765pub mod tc5;
766#[doc = "Two Wire Serial Interface"]
767pub struct TWI {
768 _marker: PhantomData<*const ()>,
769}
770unsafe impl Send for TWI {}
771impl TWI {
772 #[doc = r"Pointer to the register block"]
773 pub const PTR: *const twi::RegisterBlock = 0xb8 as *const _;
774 #[doc = r"Return the pointer to the register block"]
775 #[inline(always)]
776 pub const fn ptr() -> *const twi::RegisterBlock {
777 Self::PTR
778 }
779}
780impl Deref for TWI {
781 type Target = twi::RegisterBlock;
782 #[inline(always)]
783 fn deref(&self) -> &Self::Target {
784 unsafe { &*Self::PTR }
785 }
786}
787impl core::fmt::Debug for TWI {
788 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
789 f.debug_struct("TWI").finish()
790 }
791}
792#[doc = "Two Wire Serial Interface"]
793pub mod twi;
794#[doc = "USART"]
795pub struct USART0 {
796 _marker: PhantomData<*const ()>,
797}
798unsafe impl Send for USART0 {}
799impl USART0 {
800 #[doc = r"Pointer to the register block"]
801 pub const PTR: *const usart0::RegisterBlock = 0xc0 as *const _;
802 #[doc = r"Return the pointer to the register block"]
803 #[inline(always)]
804 pub const fn ptr() -> *const usart0::RegisterBlock {
805 Self::PTR
806 }
807}
808impl Deref for USART0 {
809 type Target = usart0::RegisterBlock;
810 #[inline(always)]
811 fn deref(&self) -> &Self::Target {
812 unsafe { &*Self::PTR }
813 }
814}
815impl core::fmt::Debug for USART0 {
816 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
817 f.debug_struct("USART0").finish()
818 }
819}
820#[doc = "USART"]
821pub mod usart0;
822#[doc = "USART"]
823pub struct USART1 {
824 _marker: PhantomData<*const ()>,
825}
826unsafe impl Send for USART1 {}
827impl USART1 {
828 #[doc = r"Pointer to the register block"]
829 pub const PTR: *const usart1::RegisterBlock = 0xc8 as *const _;
830 #[doc = r"Return the pointer to the register block"]
831 #[inline(always)]
832 pub const fn ptr() -> *const usart1::RegisterBlock {
833 Self::PTR
834 }
835}
836impl Deref for USART1 {
837 type Target = usart1::RegisterBlock;
838 #[inline(always)]
839 fn deref(&self) -> &Self::Target {
840 unsafe { &*Self::PTR }
841 }
842}
843impl core::fmt::Debug for USART1 {
844 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
845 f.debug_struct("USART1").finish()
846 }
847}
848#[doc = "USART"]
849pub mod usart1;
850#[doc = "USART"]
851pub struct USART2 {
852 _marker: PhantomData<*const ()>,
853}
854unsafe impl Send for USART2 {}
855impl USART2 {
856 #[doc = r"Pointer to the register block"]
857 pub const PTR: *const usart2::RegisterBlock = 0xd0 as *const _;
858 #[doc = r"Return the pointer to the register block"]
859 #[inline(always)]
860 pub const fn ptr() -> *const usart2::RegisterBlock {
861 Self::PTR
862 }
863}
864impl Deref for USART2 {
865 type Target = usart2::RegisterBlock;
866 #[inline(always)]
867 fn deref(&self) -> &Self::Target {
868 unsafe { &*Self::PTR }
869 }
870}
871impl core::fmt::Debug for USART2 {
872 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
873 f.debug_struct("USART2").finish()
874 }
875}
876#[doc = "USART"]
877pub mod usart2;
878#[doc = "USART"]
879pub struct USART3 {
880 _marker: PhantomData<*const ()>,
881}
882unsafe impl Send for USART3 {}
883impl USART3 {
884 #[doc = r"Pointer to the register block"]
885 pub const PTR: *const usart3::RegisterBlock = 0x0130 as *const _;
886 #[doc = r"Return the pointer to the register block"]
887 #[inline(always)]
888 pub const fn ptr() -> *const usart3::RegisterBlock {
889 Self::PTR
890 }
891}
892impl Deref for USART3 {
893 type Target = usart3::RegisterBlock;
894 #[inline(always)]
895 fn deref(&self) -> &Self::Target {
896 unsafe { &*Self::PTR }
897 }
898}
899impl core::fmt::Debug for USART3 {
900 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
901 f.debug_struct("USART3").finish()
902 }
903}
904#[doc = "USART"]
905pub mod usart3;
906#[doc = "Watchdog Timer"]
907pub struct WDT {
908 _marker: PhantomData<*const ()>,
909}
910unsafe impl Send for WDT {}
911impl WDT {
912 #[doc = r"Pointer to the register block"]
913 pub const PTR: *const wdt::RegisterBlock = 0x60 as *const _;
914 #[doc = r"Return the pointer to the register block"]
915 #[inline(always)]
916 pub const fn ptr() -> *const wdt::RegisterBlock {
917 Self::PTR
918 }
919}
920impl Deref for WDT {
921 type Target = wdt::RegisterBlock;
922 #[inline(always)]
923 fn deref(&self) -> &Self::Target {
924 unsafe { &*Self::PTR }
925 }
926}
927impl core::fmt::Debug for WDT {
928 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
929 f.debug_struct("WDT").finish()
930 }
931}
932#[doc = "Watchdog Timer"]
933pub mod wdt;
934use crate::devices::DEVICE_PERIPHERALS;
935#[doc = r" All the peripherals."]
936#[allow(non_snake_case)]
937pub struct Peripherals {
938 #[doc = "AC"]
939 pub AC: AC,
940 #[doc = "ADC"]
941 pub ADC: ADC,
942 #[doc = "BOOT_LOAD"]
943 pub BOOT_LOAD: BOOT_LOAD,
944 #[doc = "CPU"]
945 pub CPU: CPU,
946 #[doc = "EEPROM"]
947 pub EEPROM: EEPROM,
948 #[doc = "EXINT"]
949 pub EXINT: EXINT,
950 #[doc = "FUSE"]
951 pub FUSE: FUSE,
952 #[doc = "JTAG"]
953 pub JTAG: JTAG,
954 #[doc = "LOCKBIT"]
955 pub LOCKBIT: LOCKBIT,
956 #[doc = "PORTA"]
957 pub PORTA: PORTA,
958 #[doc = "PORTB"]
959 pub PORTB: PORTB,
960 #[doc = "PORTC"]
961 pub PORTC: PORTC,
962 #[doc = "PORTD"]
963 pub PORTD: PORTD,
964 #[doc = "PORTE"]
965 pub PORTE: PORTE,
966 #[doc = "PORTF"]
967 pub PORTF: PORTF,
968 #[doc = "PORTG"]
969 pub PORTG: PORTG,
970 #[doc = "PORTH"]
971 pub PORTH: PORTH,
972 #[doc = "PORTJ"]
973 pub PORTJ: PORTJ,
974 #[doc = "PORTK"]
975 pub PORTK: PORTK,
976 #[doc = "PORTL"]
977 pub PORTL: PORTL,
978 #[doc = "SPI"]
979 pub SPI: SPI,
980 #[doc = "TC0"]
981 pub TC0: TC0,
982 #[doc = "TC1"]
983 pub TC1: TC1,
984 #[doc = "TC2"]
985 pub TC2: TC2,
986 #[doc = "TC3"]
987 pub TC3: TC3,
988 #[doc = "TC4"]
989 pub TC4: TC4,
990 #[doc = "TC5"]
991 pub TC5: TC5,
992 #[doc = "TWI"]
993 pub TWI: TWI,
994 #[doc = "USART0"]
995 pub USART0: USART0,
996 #[doc = "USART1"]
997 pub USART1: USART1,
998 #[doc = "USART2"]
999 pub USART2: USART2,
1000 #[doc = "USART3"]
1001 pub USART3: USART3,
1002 #[doc = "WDT"]
1003 pub WDT: WDT,
1004}
1005impl Peripherals {
1006 #[doc = r" Returns all the peripherals *once*."]
1007 #[inline]
1008 pub fn take() -> Option<Self> {
1009 crate::interrupt::free(|_| {
1010 if unsafe { DEVICE_PERIPHERALS } {
1011 return None;
1012 }
1013 Some(unsafe { Peripherals::steal() })
1014 })
1015 }
1016 #[doc = r" Unchecked version of `Peripherals::take`."]
1017 #[doc = r""]
1018 #[doc = r" # Safety"]
1019 #[doc = r""]
1020 #[doc = r" Each of the returned peripherals must be used at most once."]
1021 #[inline]
1022 pub unsafe fn steal() -> Self {
1023 DEVICE_PERIPHERALS = true;
1024 Peripherals {
1025 AC: AC {
1026 _marker: PhantomData,
1027 },
1028 ADC: ADC {
1029 _marker: PhantomData,
1030 },
1031 BOOT_LOAD: BOOT_LOAD {
1032 _marker: PhantomData,
1033 },
1034 CPU: CPU {
1035 _marker: PhantomData,
1036 },
1037 EEPROM: EEPROM {
1038 _marker: PhantomData,
1039 },
1040 EXINT: EXINT {
1041 _marker: PhantomData,
1042 },
1043 FUSE: FUSE {
1044 _marker: PhantomData,
1045 },
1046 JTAG: JTAG {
1047 _marker: PhantomData,
1048 },
1049 LOCKBIT: LOCKBIT {
1050 _marker: PhantomData,
1051 },
1052 PORTA: PORTA {
1053 _marker: PhantomData,
1054 },
1055 PORTB: PORTB {
1056 _marker: PhantomData,
1057 },
1058 PORTC: PORTC {
1059 _marker: PhantomData,
1060 },
1061 PORTD: PORTD {
1062 _marker: PhantomData,
1063 },
1064 PORTE: PORTE {
1065 _marker: PhantomData,
1066 },
1067 PORTF: PORTF {
1068 _marker: PhantomData,
1069 },
1070 PORTG: PORTG {
1071 _marker: PhantomData,
1072 },
1073 PORTH: PORTH {
1074 _marker: PhantomData,
1075 },
1076 PORTJ: PORTJ {
1077 _marker: PhantomData,
1078 },
1079 PORTK: PORTK {
1080 _marker: PhantomData,
1081 },
1082 PORTL: PORTL {
1083 _marker: PhantomData,
1084 },
1085 SPI: SPI {
1086 _marker: PhantomData,
1087 },
1088 TC0: TC0 {
1089 _marker: PhantomData,
1090 },
1091 TC1: TC1 {
1092 _marker: PhantomData,
1093 },
1094 TC2: TC2 {
1095 _marker: PhantomData,
1096 },
1097 TC3: TC3 {
1098 _marker: PhantomData,
1099 },
1100 TC4: TC4 {
1101 _marker: PhantomData,
1102 },
1103 TC5: TC5 {
1104 _marker: PhantomData,
1105 },
1106 TWI: TWI {
1107 _marker: PhantomData,
1108 },
1109 USART0: USART0 {
1110 _marker: PhantomData,
1111 },
1112 USART1: USART1 {
1113 _marker: PhantomData,
1114 },
1115 USART2: USART2 {
1116 _marker: PhantomData,
1117 },
1118 USART3: USART3 {
1119 _marker: PhantomData,
1120 },
1121 WDT: WDT {
1122 _marker: PhantomData,
1123 },
1124 }
1125 }
1126}