diff options
author | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2012-04-16 07:55:28 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <elena.valhalla@gmail.com> | 2012-04-16 07:55:28 +0200 |
commit | 92554b7bc3049f5f3571b2b7bd9824a301d70e0e (patch) | |
tree | e1cdd3ab786985abbad45aac0ce0693d00a10204 | |
parent | 3f80f3c1e5d72a9f0e4efca0bf2391ae97af2a7b (diff) |
arduino sketch: new serial command, D (dumps rtc data)
first attempt, the presentation should be improved.
-rw-r--r-- | arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde b/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde index b9b9c1f..2f979e4 100644 --- a/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde +++ b/arduino_sketch/fuzzy_alarm_clock_ds1307/fuzzy_alarm_clock_ds1307.pde @@ -190,6 +190,9 @@ void check_serial() { case 'd': s_toggle_debug(); break; + case 'D': + s_dump_rtc(); + break; case 'l': s_led_test(); break; @@ -308,6 +311,32 @@ void s_toggle_debug() { } } +void s_dump_rtc() { + Serial.print("| 0x00 | "); + Serial.print(RTC.readData(0x00),BIN); + Serial.println(" | |"); + Serial.print("| 0x08 | "); + Serial.print(RTC.readData(0x08),BIN); + Serial.println(" | st |"); + Serial.print("| 0x09 | "); + Serial.print(RTC.readData(0x09),BIN); + Serial.println(" | a |"); + Serial.print("| 0x0a | "); + Serial.print(RTC.readData(0x0a),BIN); + Serial.println(" | cmin |"); + for (int i = 0; i < NALARMS + 3 ; i ++ ) { + for ( int j=0; j < 5 ; j ++ ) { + Serial.print("| 0x"); + Serial.print(i,HEX); + Serial.print(" | "); + Serial.print(RTC.readData(0x0b + i*5 + j),BIN); + Serial.print(" | Alarm "); + Serial.print(i,DEC); + Serial.println(" |"); + } + } +} + void s_led_test() { if ( a < 0 ) { Serial.println("Testing LEDs"); @@ -345,6 +374,7 @@ void s_print_help() { Serial.println(" p - print the alarms"); Serial.println(" t - print the clock"); Serial.println(" d - toggle printing of debug informations"); + Serial.println(" D - dump RTC registers (interesting) data"); Serial.println(" r - reset status and alarms"); Serial.println(" l - test LEDs"); Serial.println(" h - print this help"); |