-
Notifications
You must be signed in to change notification settings - Fork 1
EEPROM
Jaroslav Páral edited this page Jun 22, 2017
·
6 revisions
EEPROM (Electrically Erasable Programmable Read-Only Memory) is memory in which you can save any data (for example program results), and they stay there even after power-off. It is however rather slow when it comes to data write. EEPROM size in 3pi is 1024 bytes.
template <typename T> T load_eeprom(uint16_t address);
Returns data from address. Address must be from 0 to 1023. If you call for example uint16_t load_eeprom(0);
It will load two bytes from eeprom and store them as uint16, if they are saved as big endian.
template <typename T> void store_eeprom(uint16_t address, T value);
Store value to address. Address must be within 0 to 1023 range. If value is more then 1 byte wide, this fuction will save them all as big endian.
Warning: This is a blocking call, EEPROM write of 1 byte takes around 4 ms, so if you write more then one byte at once, have this in mind.