From 92554b7bc3049f5f3571b2b7bd9824a301d70e0e Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 16 Apr 2012 07:55:28 +0200 Subject: arduino sketch: new serial command, D (dumps rtc data) first attempt, the presentation should be improved. --- .../fuzzy_alarm_clock_ds1307.pde | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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"); -- cgit v1.2.3