From a4104e21f78c138a7dbdbbf6210d16122f704e92 Mon Sep 17 00:00:00 2001 From: phyto Date: Mon, 29 Apr 2019 17:46:14 +0200 Subject: [PATCH] adding storage manager --- simulator/rdtemp/cli.ino | 4 +++- simulator/rdtemp/rdtemp.ino | 11 +++++++++-- simulator/rdtemp/storage.ino | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 simulator/rdtemp/storage.ino diff --git a/simulator/rdtemp/cli.ino b/simulator/rdtemp/cli.ino index 255b45f..7ee04f0 100644 --- a/simulator/rdtemp/cli.ino +++ b/simulator/rdtemp/cli.ino @@ -69,7 +69,8 @@ prtln(""); /* --------------------------------------------------------------- */ static void clihelp() { - prtln("x\texit cli"); + prtln("x\texit cli"); + prtln("I\tinit storage"); } /* --------------------------------------------------------------- */ void phytocli(void) @@ -94,6 +95,7 @@ do { switch(key) { case 'x': flag_exit=1; break; case '?': clihelp(); break; + case 'I': init_storage(); break; } } while (!flag_exit); diff --git a/simulator/rdtemp/rdtemp.ino b/simulator/rdtemp/rdtemp.ino index c5cb36b..6016949 100644 --- a/simulator/rdtemp/rdtemp.ino +++ b/simulator/rdtemp/rdtemp.ino @@ -14,7 +14,7 @@ void setup() { Serial.print("\n"); - phytocli(); + phytocli(); /* XXX */ /* XXX */ /* changing the voltage reference of the ADC @@ -90,7 +90,14 @@ void loop() { if (foo++ > 5) { readlight(); foo = 0; - } + } + + /* check for CLI request */ + if (Serial.available() && 0x55==Serial.read()) + { + Serial.println("M cli request"); + phytocli(); + } delay(DELAI); } diff --git a/simulator/rdtemp/storage.ino b/simulator/rdtemp/storage.ino new file mode 100644 index 0000000..4a4e604 --- /dev/null +++ b/simulator/rdtemp/storage.ino @@ -0,0 +1,14 @@ +/* --------------------------------------------------------------- */ +#include +/* --------------------------------------------------------------- */ +int init_storage(void) +{ +Serial.println(__func__); + +Serial.print("eeprom length: "); +Serial.println(EEPROM.length()); + + +} +/* --------------------------------------------------------------- */ +/* --------------------------------------------------------------- */