diff options
| author | Nick Moore <nick@zoic.org> | 2019-02-07 22:51:23 +1100 |
|---|---|---|
| committer | Nick Moore <nick@zoic.org> | 2019-04-02 13:27:13 +1100 |
| commit | f88f9fd7482092a33d0fdf8f666b6019b484561a (patch) | |
| tree | 32e85c8ef1a03ecf9d16830072a048fb17f94114 | |
| parent | 4a5c52fbd6e919603249e688dfde7d917751cc60 (diff) | |
more fake RTC code ... adafruit/circuitpython#1046
(works if MP_WEAK common_hal_rtc_get_time is removed)
| -rw-r--r-- | ports/nrf/common-hal/rtc/RTC.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ports/nrf/common-hal/rtc/RTC.c b/ports/nrf/common-hal/rtc/RTC.c index 871fddc9d..7690b3bd3 100644 --- a/ports/nrf/common-hal/rtc/RTC.c +++ b/ports/nrf/common-hal/rtc/RTC.c @@ -32,21 +32,25 @@ #include "shared-bindings/rtc/__init__.h" #include "supervisor/shared/translate.h" +#include "nrfx_rtc.h" + +static uint32_t _rtc_seconds = 0; + +void rtc_handler(nrfx_rtc_int_type_t int_type) { + +} + void rtc_init(void) { } void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { - tm->tm_year = 2000; - tm->tm_mon = 1; - tm->tm_mday = 2; - tm->tm_hour = 3; - tm->tm_min = 4; - tm->tm_sec = 5; - tm->tm_wday = 6; - tm->tm_yday = 2; + timeutils_seconds_since_2000_to_struct_time(_rtc_seconds, tm); } void common_hal_rtc_set_time(timeutils_struct_time_t *tm) { + _rtc_seconds = timeutils_seconds_since_2000( + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec + ); } // A positive value speeds up the clock by removing clock cycles. |
