weatherstation/firmware/datastore.ino
2023-01-12 20:21:34 +01:00

20 lines
331 B
C++

#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();
}