FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

rp2: Don't reset RTC over RP2350 reset or deepsleep. · micropython/micropython@eb1611d · GitHub

Commit eb1611d

Browse files
authored andcommitted
rp2: Don't reset RTC over RP2350 reset or deepsleep.
machine.RTC will now keep its value after machine.reset() or machine.deepsleep(). Only changes behaviour on RP2350. On RP2040 the AON timer is never running at this point, but it may be possible to keep it on by changing mp_machine_reset(). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent f217a31 commit eb1611d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎ports/rp2/main.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ int main(int argc, char **argv) {
138138
mp_thread_init();
139139
#endif
140140

141-
// Start and initialise the RTC
142-
struct timespec ts = { 0, 0 };
143-
ts.tv_sec = timeutils_seconds_since_epoch(2021, 1, 1, 0, 0, 0);
144-
aon_timer_start(&ts);
141+
if (!aon_timer_is_running()) {
142+
// Start and initialise the RTC if not already running
143+
struct timespec ts = { 0, 0 };
144+
ts.tv_sec = timeutils_seconds_since_epoch(2021, 1, 1, 0, 0, 0);
145+
aon_timer_start(&ts);
146+
}
145147
mp_hal_time_ns_set_from_rtc();
146148

147149
// Initialise stack extents and GC heap.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL