|
39 | 39 | #include "shared-module/displayio/__init__.h" |
40 | 40 | #endif |
41 | 41 |
|
42 | | -volatile uint64_t last_finished_tick = 0; |
43 | | - |
44 | | -bool stack_ok_so_far = true; |
45 | | - |
46 | | -static bool running_background_tasks = false; |
47 | | - |
48 | 42 | #ifdef MONITOR_BACKGROUND_TASKS |
49 | 43 | // PB03 is physical pin "SCL" on the Metro M4 express |
50 | 44 | // so you can't use this code AND an i2c peripheral |
51 | 45 | // at the same time unless you change this |
52 | | -STATIC void start_background_task(void) { |
| 46 | +void port_start_background_task(void) { |
53 | 47 | REG_PORT_DIRSET1 = (1<<3); |
54 | 48 | REG_PORT_OUTSET1 = (1<<3); |
55 | 49 | } |
56 | 50 |
|
57 | | -STATIC void finish_background_task(void) { |
| 51 | +void port_finish_background_task(void) { |
58 | 52 | REG_PORT_OUTCLR1 = (1<<3); |
59 | 53 | } |
60 | 54 | #else |
61 | | -STATIC void start_background_task(void) {} |
62 | | -STATIC void finish_background_task(void) {} |
| 55 | +void port_start_background_task(void) {} |
| 56 | +void port_finish_background_task(void) {} |
63 | 57 | #endif |
64 | 58 |
|
65 | | -void background_tasks_reset(void) { |
66 | | - running_background_tasks = false; |
67 | | -} |
68 | | - |
69 | | -void run_background_tasks(void) { |
70 | | - // Don't call ourselves recursively. |
71 | | - if (running_background_tasks) { |
72 | | - return; |
73 | | - } |
74 | | - |
75 | | - start_background_task(); |
76 | | - |
77 | | - assert_heap_ok(); |
78 | | - running_background_tasks = true; |
79 | | - |
80 | | - #if CIRCUITPY_DISPLAYIO |
81 | | - displayio_background(); |
82 | | - #endif |
83 | | - |
84 | | - #if CIRCUITPY_NETWORK |
85 | | - network_module_background(); |
86 | | - #endif |
87 | | - filesystem_background(); |
88 | | - running_background_tasks = false; |
89 | | - assert_heap_ok(); |
90 | | - |
91 | | - last_finished_tick = port_get_raw_ticks(NULL); |
92 | | - finish_background_task(); |
93 | | -} |
94 | | - |
95 | | -bool background_tasks_ok(void) { |
96 | | - return port_get_raw_ticks(NULL) - last_finished_tick < 1024; |
97 | | -} |
| 59 | +void port_background_task(void) {} |
0 commit comments