1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
pub use avr_hal_generic::eeprom::{EepromOps, OutOfBoundsError};

pub type Eeprom = avr_hal_generic::eeprom::Eeprom<crate::Attiny, crate::pac::EEPROM>;

#[cfg(feature = "attiny2313")]
avr_hal_generic::impl_eeprom_attiny! {
    hal: crate::Attiny,
    peripheral: crate::pac::EEPROM,
    capacity: 128,
    addr_width: u8,
    set_address: |peripheral, address| {
        peripheral.eear.write(|w| w.bits(address));
    },
}

#[cfg(any(feature = "attiny167", feature = "attiny85"))]
avr_hal_generic::impl_eeprom_attiny! {
    hal: crate::Attiny,
    peripheral: crate::pac::EEPROM,
    capacity: 512,
    addr_width: u16,
    set_address: |peripheral, address| {
        peripheral.eear.write(|w| w.bits(address));
    },
}

#[cfg(feature = "attiny88")]
avr_hal_generic::impl_eeprom_attiny! {
    hal: crate::Attiny,
    peripheral: crate::pac::EEPROM,
    capacity: 64,
    addr_width: u8,
    set_address: |peripheral, address| {
        peripheral.eearl.write(|w| w.bits(address));
    },
}