diff options
| -rw-r--r-- | ports/atmel-samd/background.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c index 3b698768b..ca91a31de 100644 --- a/ports/atmel-samd/background.c +++ b/ports/atmel-samd/background.c @@ -45,6 +45,23 @@ bool stack_ok_so_far = true; static bool running_background_tasks = false; +#ifdef MONITOR_BACKGROUND_TASKS +// PB03 is physical pin "SCL" on the Metro M4 express +// so you can't use this code AND an i2c peripheral +// at the same time unless you change this +STATIC void start_background_task(void) { + REG_PORT_DIRSET1 = (1<<3); + REG_PORT_OUTSET1 = (1<<3); +} + +STATIC void finish_background_task(void) { + REG_PORT_OUTCLR1 = (1<<3); +} +#else +STATIC void start_background_task(void) {} +STATIC void finish_background_task(void) {} +#endif + void background_tasks_reset(void) { running_background_tasks = false; } @@ -54,6 +71,9 @@ void run_background_tasks(void) { if (running_background_tasks) { return; } + + start_background_task(); + assert_heap_ok(); running_background_tasks = true; @@ -73,6 +93,7 @@ void run_background_tasks(void) { assert_heap_ok(); last_finished_tick = supervisor_ticks_ms64(); + finish_background_task(); } bool background_tasks_ok(void) { |
