diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-10-12 18:36:18 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-10-12 18:43:21 -0700 |
| commit | 379e73af2e55b1f0c517883360e29d5dbc27a20b (patch) | |
| tree | 8be3230a70e58163e0c48bf87992251574e5d8ed /ports/nrf/supervisor | |
| parent | 9de96786ad578b4e96e8219e48c778a1a556f0cf (diff) | |
Finer grained, per port tick locking
Fixes #3504 hopefully.
Diffstat (limited to 'ports/nrf/supervisor')
| -rw-r--r-- | ports/nrf/supervisor/port.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index bc8b47be7..493de43e0 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -274,11 +274,15 @@ uint32_t port_get_saved_word(void) { } uint64_t port_get_raw_ticks(uint8_t* subticks) { + common_hal_mcu_disable_interrupts(); uint32_t rtc = nrfx_rtc_counter_get(&rtc_instance); + uint32_t overflow_count = overflow_tracker.overflowed_ticks; + common_hal_mcu_enable_interrupts(); + if (subticks != NULL) { *subticks = (rtc % 32); } - return overflow_tracker.overflowed_ticks + rtc / 32; + return overflow_count + rtc / 32; } // Enable 1/1024 second tick. |
