Module avr_oxide::hal::generic::eeprom

source ·
Expand description

Low-level access to the AVR’s EEPROM module.

This device can be used directly by an application program to access the EEPROM space(s) provided by the microcontroller. It exposes simple byte-copy methods to write to arbitrary locations within the EEPROM space, as well as access to Reader and Writer proxies for use with the Persistent trait.

§Usage

#[derive(Persist)]
struct MyDataStructure {
   number: u8,
   vector: Vec<u16>,
}

pub fn load_save_object() -> ! {
  let eeprom = &mut avr_oxide::hardware::nvm::eeprom::instance();

  let mut thing : MyDataStructure = Persist::load_with(eeprom.reader()).unwrap();
  thing.number += 1u8;
  thing.save_with(eeprom.writer()).unwrap();

}

Modules§

Traits§