diff options
| author | Donald Davis <don@haifisch.local> | 2019-01-23 09:49:48 -0800 |
|---|---|---|
| committer | Donald Davis <don@haifisch.local> | 2019-01-23 09:49:48 -0800 |
| commit | c7e3784dbf23828928b52752b89f6b7c4e96a396 (patch) | |
| tree | caafc9cbcbc5190497d7c9d97a093f385bbc7e45 /src | |
| parent | fc62e8d29f215b0e85cb62b1273636bc2f2686ba (diff) | |
new wxpython syntax
Diffstat (limited to 'src')
| -rwxr-xr-x | src/Clock.cpp | 10 | ||||
| -rwxr-xr-x | src/Clock.h | 20 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/Clock.cpp b/src/Clock.cpp index c2618cb..fff797f 100755 --- a/src/Clock.cpp +++ b/src/Clock.cpp @@ -59,9 +59,9 @@ /* Create an rtc object mebby should be private to the class JOE?? */ // add preprocessor code here for non M0 systems. -#ifdef ARDUINO_SAMD_ZERO -RTCZero rtc; -#endif +//#ifdef ARDUINO_SAMD_ZERO +//RTCZero rtc; +//#endif /* calculate build date and time (this should be referenceable from monitor for SWV ... */ const byte build_seconds = ((__TIME__[6] - '0') * 10 + __TIME__[7] - '0'); const byte build_minutes = ((__TIME__[3] - '0') * 10 + __TIME__[4] - '0'); @@ -114,7 +114,11 @@ void Clock::init() // bracket with pre-processor defs .... bool Clock::RTCIsRunning(void) { + #if defined(RTC_MODE2_CTRL_ENABLE) return (RTC->MODE2.CTRL.reg & RTC_MODE2_CTRL_ENABLE); + #else + return true; + #endif } const uint8_t daysInMonth [] { 31,28,31,30,31,30,31,31,30,31,30,31 }; diff --git a/src/Clock.h b/src/Clock.h index 690d72a..6812923 100755 --- a/src/Clock.h +++ b/src/Clock.h @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. *----------------------------------------------------------------------------- * - * + * * */ @@ -46,7 +46,7 @@ #define CHARS_IN_TIMESTAMP 20 // add preprocessor code here for non M0 systems. -#ifdef ARDUINO_SAMD_ZERO +#if defined(ARDUINO_ARCH_SAMD) #include <RTCZero.h> extern RTCZero rtc; #endif @@ -61,14 +61,14 @@ class Clock { private: - + public: - - + + /*---------------------------------------------------------------------- * Monitor Callbacks *--------------------------------------------------------------------*/ - + static void TIM (uint8_t kwIndex, uint8_t verb,char *args) { static char thetimestamp[CHARS_IN_TIMESTAMP]; if (verb == '!') { @@ -77,7 +77,7 @@ public: timeStamp(thetimestamp); monitor.update("TIM","%s",thetimestamp); } - + static void NOW (uint8_t kwIndex, uint8_t verb,char *args) { static char intbuff[25]; if (verb == '!') { @@ -85,9 +85,9 @@ public: } ultoa(clock.time(),intbuff,10); monitor.update("NOW","%s",intbuff); - + } - + Clock() {} ; void init(); @@ -95,7 +95,7 @@ public: void set(time_t); time_t get(); void set(const char *); - + // need to generalize this at some point. #if 0 uint16_t year() const { return 2000 + yOff; } |
