diff --git a/ports/stm32/flashbdev.c b/ports/stm32/flashbdev.c index 64faf0eac..4245dd1ec 100644 --- a/ports/stm32/flashbdev.c +++ b/ports/stm32/flashbdev.c @@ -29,7 +29,6 @@ #include "py/obj.h" #include "py/mperrno.h" -#include "systick.h" #include "led.h" #include "flash.h" #include "storage.h" @@ -231,7 +230,7 @@ static void flash_bdev_irq_handler(void) { // If not a forced write, wait at least 5 seconds after last write to flush // On file close and flash unmount we get a forced write, so we can afford to wait a while - if ((flash_flags & FLASH_FLAG_FORCE_WRITE) || sys_tick_has_passed(flash_tick_counter_last_write, 5000)) { + if ((flash_flags & FLASH_FLAG_FORCE_WRITE) || HAL_GetTick() - flash_tick_counter_last_write >= 5000) { // sync the cache RAM buffer by writing it to the flash page flash_write(flash_cache_sector_start, (const uint32_t*)CACHE_MEM_START_ADDR, flash_cache_sector_size / 4); // clear the flash flags now that we have a clean cache diff --git a/ports/stm32/spibdev.c b/ports/stm32/spibdev.c index 007a96a6c..91ec4df5e 100644 --- a/ports/stm32/spibdev.c +++ b/ports/stm32/spibdev.c @@ -26,7 +26,7 @@ #include "py/obj.h" #include "py/mperrno.h" -#include "systick.h" +#include "irq.h" #include "led.h" #include "storage.h" @@ -39,7 +39,7 @@ int32_t spi_bdev_ioctl(spi_bdev_t *bdev, uint32_t op, uint32_t arg) { return 0; case BDEV_IOCTL_IRQ_HANDLER: - if ((bdev->spiflash.flags & 1) && sys_tick_has_passed(bdev->flash_tick_counter_last_write, 1000)) { + if ((bdev->spiflash.flags & 1) && HAL_GetTick() - bdev->flash_tick_counter_last_write >= 1000) { mp_spiflash_flush(&bdev->spiflash); led_state(PYB_LED_RED, 0); // indicate a clean cache with LED off }