FuriHal: temporary switch to hal ticks for timeouts. (#880)

This commit is contained in:
あく 2021-12-08 06:27:16 +03:00 committed by GitHub
parent 9708b30965
commit bb96509ed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -51,11 +51,11 @@ bool furi_hal_i2c_tx(
furi_assert(timeout > 0); furi_assert(timeout > 0);
bool ret = true; bool ret = true;
uint32_t timeout_tick = osKernelGetTickCount() + timeout; uint32_t timeout_tick = HAL_GetTick() + timeout;
do { do {
while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) {
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }
@ -80,7 +80,7 @@ bool furi_hal_i2c_tx(
size--; size--;
} }
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }
@ -103,11 +103,11 @@ bool furi_hal_i2c_rx(
furi_assert(timeout > 0); furi_assert(timeout > 0);
bool ret = true; bool ret = true;
uint32_t timeout_tick = osKernelGetTickCount() + timeout; uint32_t timeout_tick = HAL_GetTick() + timeout;
do { do {
while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) {
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }
@ -132,7 +132,7 @@ bool furi_hal_i2c_rx(
size--; size--;
} }
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }

View File

@ -51,11 +51,11 @@ bool furi_hal_i2c_tx(
furi_assert(timeout > 0); furi_assert(timeout > 0);
bool ret = true; bool ret = true;
uint32_t timeout_tick = osKernelGetTickCount() + timeout; uint32_t timeout_tick = HAL_GetTick() + timeout;
do { do {
while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) {
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }
@ -80,7 +80,7 @@ bool furi_hal_i2c_tx(
size--; size--;
} }
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }
@ -103,11 +103,11 @@ bool furi_hal_i2c_rx(
furi_assert(timeout > 0); furi_assert(timeout > 0);
bool ret = true; bool ret = true;
uint32_t timeout_tick = osKernelGetTickCount() + timeout; uint32_t timeout_tick = HAL_GetTick() + timeout;
do { do {
while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) { while(LL_I2C_IsActiveFlag_BUSY(handle->bus->i2c)) {
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }
@ -132,7 +132,7 @@ bool furi_hal_i2c_rx(
size--; size--;
} }
if(osKernelGetTickCount() >= timeout_tick) { if(HAL_GetTick() >= timeout_tick) {
ret = false; ret = false;
break; break;
} }