An attempt to provide a Real Time Clock for the nRF51-DK. This code provides rtc.time and rtc.set_time replacements for the similarly named C standard methods (unimplemented for nRF51-DK last I checked). Not very well tested, but it seems to work for simple applications.
Fork of nrf51_rtc by
Diff: nrf51_rtc.cpp
- Revision:
- 1:5917157d58c6
- Parent:
- 0:3677a016109b
- Child:
- 2:e1479e6ffc37
--- a/nrf51_rtc.cpp Sun Feb 08 01:28:47 2015 +0000 +++ b/nrf51_rtc.cpp Mon Mar 02 08:54:40 2015 +0000 @@ -1,5 +1,9 @@ #include "nrf51_rtc.h" + +nrf51_rtc rtc; + + int nrf51_rtc::set_time(time_t rawtime) { // set the current time from a parameter time_base = rawtime; @@ -24,9 +28,7 @@ void nrf51_rtc::update_rtc() { // for use as interrupt routine, same as "time" but doesn't return a value (as req'd for interrupt) - // ...but this is useless since the compiler seems to be unable to correctly attach a member function to the ticker interrupt - // ...the exact same interrupt routine attached to a ticker works fine when declared outside the method - nrf51_rtc::time(); + rtc.time(); } nrf51_rtc::nrf51_rtc() {