2019-04-29 17:46:14 +02:00
|
|
|
/* --------------------------------------------------------------- */
|
|
|
|
#include <EEPROM.h>
|
|
|
|
/* --------------------------------------------------------------- */
|
2019-04-30 16:49:21 +02:00
|
|
|
short init_storage(void)
|
2019-04-29 17:46:14 +02:00
|
|
|
{
|
2019-04-30 16:49:21 +02:00
|
|
|
short foo;
|
|
|
|
|
2019-04-29 17:46:14 +02:00
|
|
|
Serial.println(__func__);
|
|
|
|
|
|
|
|
Serial.print("eeprom length: ");
|
|
|
|
Serial.println(EEPROM.length());
|
2019-04-30 16:49:21 +02:00
|
|
|
Serial.print("global length: ");
|
|
|
|
Serial.println(sizeof(Global));
|
|
|
|
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------- */
|
|
|
|
short read_config(short num, Global *where)
|
|
|
|
{
|
|
|
|
#if DEBUG
|
|
|
|
prtln(">>> read config");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-29 17:46:14 +02:00
|
|
|
|
2019-04-30 16:49:21 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------- */
|
|
|
|
short write_config(short num, Global *from)
|
|
|
|
{
|
|
|
|
#if DEBUG
|
|
|
|
prtln(">>> write config");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
from->magic = 0xfde9;
|
|
|
|
memcpy(from->tag, "aaaa", 4);
|
2019-04-29 17:46:14 +02:00
|
|
|
|
2019-04-30 16:49:21 +02:00
|
|
|
return -1;
|
2019-04-29 17:46:14 +02:00
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------- */
|
2019-04-30 16:49:21 +02:00
|
|
|
short display_config(Global *what)
|
|
|
|
{
|
|
|
|
char foo, c;
|
|
|
|
#if DEBUG
|
|
|
|
prtln(">>> display config");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
prt("Magic : "); prtln(what->magic);
|
|
|
|
prt("Id : ");
|
|
|
|
for (foo=0; foo<4; foo++) {
|
|
|
|
if (isprint(c=what->tag[foo])) prt(c);
|
|
|
|
else prt('?');
|
|
|
|
}
|
|
|
|
prtln("");
|
|
|
|
prt("Delay : "); prtln(what->delai);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2019-04-29 17:46:14 +02:00
|
|
|
/* --------------------------------------------------------------- */
|