21 lines
331 B
Arduino
21 lines
331 B
Arduino
|
|
||
|
#include <EEPROM.h>
|
||
|
|
||
|
#define EEPROM_SIZE 512
|
||
|
|
||
|
int eeprom_read(int addr) {
|
||
|
int ret = -255;
|
||
|
EEPROM.begin(EEPROM_SIZE);
|
||
|
EEPROM.get(addr, ret);
|
||
|
EEPROM.commit();
|
||
|
EEPROM.end();
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
void eeprom_write(int addr, int data) {
|
||
|
EEPROM.begin(EEPROM_SIZE);
|
||
|
EEPROM.put(addr, data);
|
||
|
EEPROM.commit();
|
||
|
EEPROM.end();
|
||
|
}
|