-
Notifications
You must be signed in to change notification settings - Fork 11
/
EEPROM.h
43 lines (35 loc) · 855 Bytes
/
EEPROM.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// EEPROM
class eeprom {
public:
int read(int address);
void write(int address, int value);
// Wrappers for debug functionality
int readX(int z,int address);
void writeX(int z,int address, int value);
};
eeprom EEPROM;
int eepromStorage[1000]; // 0 - 511 allowed
int value = 998;
int eeprom::read(int address)
{
if(address > 0 && address < 512)value = eepromStorage[address];
servuinoFunc(S_EEPROM_READ,address,value,NULL,0);
return(value);
}
void eeprom::write(int address, int value)
{
if(address > 0 && address < 512 && value >= 0 && value < 256)eepromStorage[address] = value;
servuinoFunc(S_EEPROM_WRITE,address,value,NULL,0);
return;
}
int eeprom::readX(int z,int address)
{
ino(z);
return(read(address));
}
void eeprom::writeX(int z,int address, int value)
{
ino(z);
write(address,value);
return;
}