stm32/fdcan: Support maximum timeout of HAL_MAX_DELAY in can_receive.
This commit is contained in:
parent
63b2eb27d4
commit
d07073f4e2
@ -215,11 +215,13 @@ int can_receive(FDCAN_HandleTypeDef *can, int fifo, FDCAN_RxHeaderTypeDef *hdr,
|
|||||||
// Wait for a message to become available, with timeout
|
// Wait for a message to become available, with timeout
|
||||||
uint32_t start = HAL_GetTick();
|
uint32_t start = HAL_GetTick();
|
||||||
while ((*rxf & fl) == 0) {
|
while ((*rxf & fl) == 0) {
|
||||||
MICROPY_EVENT_POLL_HOOK
|
if (timeout_ms != HAL_MAX_DELAY) {
|
||||||
if (HAL_GetTick() - start >= timeout_ms) {
|
if (HAL_GetTick() - start >= timeout_ms) {
|
||||||
return -MP_ETIMEDOUT;
|
return -MP_ETIMEDOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MICROPY_EVENT_POLL_HOOK
|
||||||
|
}
|
||||||
|
|
||||||
// Get pointer to incoming message
|
// Get pointer to incoming message
|
||||||
uint32_t index, *address;
|
uint32_t index, *address;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user