From bb96509ed1e92c12b0b622f105eaa813d32009b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Wed, 8 Dec 2021 06:27:16 +0300 Subject: [PATCH] FuriHal: temporary switch to hal ticks for timeouts. (#880) --- firmware/targets/f6/furi-hal/furi-hal-i2c.c | 12 ++++++------ firmware/targets/f7/furi-hal/furi-hal-i2c.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/firmware/targets/f6/furi-hal/furi-hal-i2c.c b/firmware/targets/f6/furi-hal/furi-hal-i2c.c index 3e64b390..826d98a5 100644 --- a/firmware/targets/f6/furi-hal/furi-hal-i2c.c +++ b/firmware/targets/f6/furi-hal/furi-hal-i2c.c @@ -51,11 +51,11 @@ bool furi_hal_i2c_tx( furi_assert(timeout > 0); bool ret = true; - uint32_t timeout_tick = osKernelGetTickCount() + timeout; + uint32_t timeout_tick = HAL_GetTick() + timeout; do { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; } @@ -80,7 +80,7 @@ bool furi_hal_i2c_tx( size--; } - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; } @@ -103,11 +103,11 @@ bool furi_hal_i2c_rx( furi_assert(timeout > 0); bool ret = true; - uint32_t timeout_tick = osKernelGetTickCount() + timeout; + uint32_t timeout_tick = HAL_GetTick() + timeout; do { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; } @@ -132,7 +132,7 @@ bool furi_hal_i2c_rx( size--; } - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; } diff --git a/firmware/targets/f7/furi-hal/furi-hal-i2c.c b/firmware/targets/f7/furi-hal/furi-hal-i2c.c index 3e64b390..826d98a5 100644 --- a/firmware/targets/f7/furi-hal/furi-hal-i2c.c +++ b/firmware/targets/f7/furi-hal/furi-hal-i2c.c @@ -51,11 +51,11 @@ bool furi_hal_i2c_tx( furi_assert(timeout > 0); bool ret = true; - uint32_t timeout_tick = osKernelGetTickCount() + timeout; + uint32_t timeout_tick = HAL_GetTick() + timeout; do { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; } @@ -80,7 +80,7 @@ bool furi_hal_i2c_tx( size--; } - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; } @@ -103,11 +103,11 @@ bool furi_hal_i2c_rx( furi_assert(timeout > 0); bool ret = true; - uint32_t timeout_tick = osKernelGetTickCount() + timeout; + uint32_t timeout_tick = HAL_GetTick() + timeout; do { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; } @@ -132,7 +132,7 @@ bool furi_hal_i2c_rx( size--; } - if(osKernelGetTickCount() >= timeout_tick) { + if(HAL_GetTick() >= timeout_tick) { ret = false; break; }