diff options
| author | Jeff Epler <jepler@gmail.com> | 2019-11-22 14:30:08 -0600 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2019-11-22 14:30:08 -0600 |
| commit | bfdfe0e68191554b70103f249ae1fe08f7fc85f0 (patch) | |
| tree | b5ec96b0d1a10033dc76925bc17d1b8a12a8e11f | |
| parent | 77b78d7fb931b7d063c122b6155299587b46786b (diff) | |
stm32: fix uses of ticks_ms global
| -rw-r--r-- | ports/stm32f4/common-hal/busio/UART.c | 4 | ||||
| -rw-r--r-- | ports/stm32f4/common-hal/microcontroller/__init__.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/ports/stm32f4/common-hal/busio/UART.c b/ports/stm32f4/common-hal/busio/UART.c index c4ab237cd..5ddfa6a4c 100644 --- a/ports/stm32f4/common-hal/busio/UART.c +++ b/ports/stm32f4/common-hal/busio/UART.c @@ -250,10 +250,10 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t } size_t rx_bytes = 0; - uint64_t start_ticks = ticks_ms; + uint64_t start_ticks = supervisor_ticks_ms64(); // Wait for all bytes received or timeout, same as nrf - while ( (ringbuf_count(&self->rbuf) < len) && (ticks_ms - start_ticks < self->timeout_ms) ) { + while ( (ringbuf_count(&self->rbuf) < len) && (supervisor_ticks_ms64() - start_ticks < self->timeout_ms) ) { RUN_BACKGROUND_TASKS; //restart if it failed in the callback if (errflag != HAL_OK) { diff --git a/ports/stm32f4/common-hal/microcontroller/__init__.c b/ports/stm32f4/common-hal/microcontroller/__init__.c index c7493a4d6..ffab5d1e5 100644 --- a/ports/stm32f4/common-hal/microcontroller/__init__.c +++ b/ports/stm32f4/common-hal/microcontroller/__init__.c @@ -48,9 +48,9 @@ STATIC uint32_t get_us(void) { uint32_t ticks_per_us = HAL_RCC_GetSysClockFreq()/1000000; uint32_t micros, sys_cycles; do { - micros = ticks_ms; + micros = supervisor_ticks_ms32(); sys_cycles = SysTick->VAL; //counts backwards - } while (micros != ticks_ms); //try again if ticks_ms rolled over + } while (micros != supervisor_ticks_ms32()); //try again if ticks_ms rolled over return (micros * 1000) + (ticks_per_us * 1000 - sys_cycles) / ticks_per_us; } |
