atmega_hal/
eeprom.rs
1pub use avr_hal_generic::eeprom::{EepromOps, OutOfBoundsError};
22
23pub type Eeprom = avr_hal_generic::eeprom::Eeprom<crate::Atmega, crate::pac::EEPROM>;
24
25#[cfg(feature = "atmega48p")]
27avr_hal_generic::impl_eeprom_atmega! {
28 hal: crate::Atmega,
29 peripheral: crate::pac::EEPROM,
30 capacity: 256,
31 addr_width: u8,
32 set_address: |peripheral, address| {
33 peripheral.eearl.write(|w| w.bits(address));
34 },
35}
36
37#[cfg(feature = "atmega88p")]
38avr_hal_generic::impl_eeprom_atmega! {
39 hal: crate::Atmega,
40 peripheral: crate::pac::EEPROM,
41 capacity: 512,
42 addr_width: u16,
43 set_address: |peripheral, address| {
44 peripheral.eear.write(|w| w.bits(address));
45 },
46}
47
48#[cfg(any(feature = "atmega168", feature = "atmega164pa"))]
49avr_hal_generic::impl_eeprom_atmega! {
50 hal: crate::Atmega,
51 peripheral: crate::pac::EEPROM,
52 capacity: 512,
53 addr_width: u16,
54 set_address: |peripheral, address| {
55 peripheral.eear.write(|w| w.bits(address));
56 },
57}
58
59#[cfg(any(
60 feature = "atmega328pb",
61 feature = "atmega328p",
62 feature = "atmega32u4"
63))]
64avr_hal_generic::impl_eeprom_atmega! {
65 hal: crate::Atmega,
66 peripheral: crate::pac::EEPROM,
67 capacity: 1024,
68 addr_width: u16,
69 set_address: |peripheral, address| {
70 peripheral.eear.write(|w| w.bits(address));
71 },
72}
73
74#[cfg(any(
75 feature = "atmega2560",
76 feature = "atmega1280",
77 feature = "atmega1284p"
78))]
79avr_hal_generic::impl_eeprom_atmega! {
80 hal: crate::Atmega,
81 peripheral: crate::pac::EEPROM,
82 capacity: 4096,
83 addr_width: u16,
84 set_address: |peripheral, address| {
85 peripheral.eear.write(|w| w.bits(address));
86 },
87}
88
89#[cfg(any(feature = "atmega8", feature = "atmega16"))]
90avr_hal_generic::impl_eeprom_atmega_old! {
91 hal: crate::Atmega,
92 peripheral: crate::pac::EEPROM,
93 capacity: 512,
94 addr_width: u16,
95 set_address: |peripheral, address| {
96 peripheral.eear.write(|w| w.bits(address));
97 },
98}
99
100#[cfg(any(feature = "atmega32a"))]
101avr_hal_generic::impl_eeprom_atmega_old! {
102 hal: crate::Atmega,
103 peripheral: crate::pac::EEPROM,
104 capacity: 1024,
105 addr_width: u16,
106 set_address: |peripheral, address| {
107 peripheral.eear.write(|w| w.bits(address));
108 },
109}
110
111#[cfg(any(feature = "atmega128a",))]
112avr_hal_generic::impl_eeprom_atmega_old! {
113 hal: crate::Atmega,
114 peripheral: crate::pac::EEPROM,
115 capacity: 4096,
116 addr_width: u16,
117 set_address: |peripheral, address| {
118 peripheral.eear.write(|w| w.bits(address));
119 },
120}