diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-12-08 17:13:00 -0800 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-12-15 18:12:59 -0800 |
| commit | 1ad49d9a18224ecc53d8f49d0675a369274556ce (patch) | |
| tree | 20cc3ac4f882e18d27ce32a65ba6eb908dd4fab3 /supervisor | |
| parent | f2204d7d88b505155cd25b38b71ae3c35b86d438 (diff) | |
Add alarm.pin that wakes on pin level
Fixes #3787
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/tick.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index d37a585eb..5d75a5395 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -145,10 +145,11 @@ void mp_hal_delay_ms(mp_uint_t delay) { delay = delay * 1024 / 1000; uint64_t end_tick = start_tick + delay; int64_t remaining = delay; - while (remaining > 0) { + + // Loop until we've waited long enough or we've been CTRL-Ced by autoreload + // or the user. + while (remaining > 0 && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; - // Check to see if we've been CTRL-Ced by autoreload or the user. - mp_handle_pending(); remaining = end_tick - port_get_raw_ticks(NULL); // We break a bit early so we don't risk setting the alarm before the time when we call // sleep. |
