diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-03-20 12:58:34 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-03-20 12:58:34 -0700 |
| commit | 2623022c846698d8a6b9cfab8617aa569c5aef2f (patch) | |
| tree | 1caf31eda829fb1c8c22b91650642919598ff9bf /supervisor | |
| parent | 6db11cf68ba2d5e17c6267f36f516bc0abce4643 (diff) | |
Initial work for STM32. Need to fix us delay and PulseIn still.
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/flash.c | 6 | ||||
| -rw-r--r-- | supervisor/shared/tick.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/supervisor/shared/flash.c b/supervisor/shared/flash.c index e0bf83490..298e7d83e 100644 --- a/supervisor/shared/flash.c +++ b/supervisor/shared/flash.c @@ -111,7 +111,7 @@ mp_uint_t flash_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_bloc return supervisor_flash_read_blocks(dest, block_num - PART1_START_BLOCK, num_blocks); } -volatile bool filesystem_dirty; +volatile bool filesystem_dirty = false; mp_uint_t flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) { if (block_num == 0) { @@ -137,7 +137,9 @@ void supervisor_flash_flush(void) { supervisor_external_flash_flush(); #endif // Turn off ticks now that our filesystem has been flushed. - supervisor_disable_tick(); + if (filesystem_dirty) { + supervisor_disable_tick(); + } filesystem_dirty = false; } diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 80bd6f204..de56b64f5 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -118,18 +118,22 @@ void mp_hal_delay_ms(mp_uint_t delay) { volatile size_t tick_enable_count = 0; extern void supervisor_enable_tick(void) { + common_hal_mcu_disable_interrupts(); if (tick_enable_count == 0) { port_enable_tick(); } tick_enable_count++; + common_hal_mcu_enable_interrupts(); } extern void supervisor_disable_tick(void) { + common_hal_mcu_disable_interrupts(); if (tick_enable_count > 0) { tick_enable_count--; } if (tick_enable_count == 0) { port_disable_tick(); } + common_hal_mcu_enable_interrupts(); } |
