diff options
| author | Jeff Epler <jeff@adafruit.com> | 2021-03-11 09:00:31 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-11 09:00:31 -0600 |
| commit | 15e97f12a1be8b2aa625b59d127b6d1db530a18b (patch) | |
| tree | 67d180b279affdd4002338aa60668ba4ce500f51 | |
| parent | f0965b1ef7f980fbbeba43a58094b46e7816698a (diff) | |
| parent | 16bfe3b41c46b1c8070f025bdbc932e21acf1753 (diff) | |
Merge pull request #4379 from jepler/rp2040-rtc
raspberrypi: RTC: Ensure a time is set
| -rw-r--r-- | ports/raspberrypi/common-hal/rtc/RTC.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ports/raspberrypi/common-hal/rtc/RTC.c b/ports/raspberrypi/common-hal/rtc/RTC.c index 89c23fc19..e6c5d8871 100644 --- a/ports/raspberrypi/common-hal/rtc/RTC.c +++ b/ports/raspberrypi/common-hal/rtc/RTC.c @@ -29,9 +29,23 @@ #include "py/runtime.h" #include "src/rp2_common/hardware_rtc/include/hardware/rtc.h" +#include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" void common_hal_rtc_init(void) { + datetime_t t = { + .year = 2020, + .month = 1, + .day = 1, + .dotw = 3, // 0 is Sunday, so 3 is Wednesday + .hour = 0, + .min = 0, + .sec = 0 + }; + + // Start the RTC rtc_init(); + rtc_set_datetime(&t); + } void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { |
