Move EEPROM read/write functions to settings

This commit is contained in:
John Stäck 2019-07-25 11:07:41 +02:00
parent 9fbfde3867
commit c8e96343d0
4 changed files with 25 additions and 27 deletions

View file

@ -1,4 +1,3 @@
#include <EEPROM.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_MPR121.h>
@ -365,29 +364,6 @@ void drawMenuCursor(byte itemNo, byte color){
//***********************************************************
// TODO: Move these to a settings.cpp maybe?
void writeSetting(byte address, unsigned short value){
union {
byte v[2];
unsigned short val;
} data;
data.val = value;
EEPROM.update(address, data.v[0]);
EEPROM.update(address+1, data.v[1]);
}
unsigned short readSetting(byte address){
union {
byte v[2];
unsigned short val;
} data;
data.v[0] = EEPROM.read(address);
data.v[1] = EEPROM.read(address+1);
return data.val;
}
//***********************************************************
static int readTrills() {
readSwitches();
return K5+2*K6+4*K7;