diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-07-09 09:47:10 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-07-15 09:26:47 -0500 |
| commit | 8c4a9f644407ee6fccf3720fd3b727085a2ff109 (patch) | |
| tree | 1147bdd1dcdfaed53453e9825f95895db097c78a /supervisor | |
| parent | 1474fccd2fb1cf6ccd14979a3b5405d2a355054b (diff) | |
supervisor: tick: only run background tasks once per tick
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/tick.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 7a2f313eb..46172d0f3 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -52,6 +52,14 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks); #define WATCHDOG_EXCEPTION_CHECK() 0 #endif +static background_callback_t callback; + +extern void run_background_tasks(void); + +void background_task_tick(void *unused) { + run_background_tasks(); +} + void supervisor_tick(void) { #if CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS > 0 filesystem_tick(); @@ -69,6 +77,7 @@ void supervisor_tick(void) { #endif } #endif + background_callback_add(&callback, background_task_tick, NULL); } uint64_t supervisor_ticks_ms64() { @@ -84,11 +93,9 @@ uint32_t supervisor_ticks_ms32() { return supervisor_ticks_ms64(); } -extern void run_background_tasks(void); void PLACE_IN_ITCM(supervisor_run_background_tasks_if_tick)() { background_callback_run_all(); - run_background_tasks(); } void mp_hal_delay_ms(mp_uint_t delay) { |
