Skip to content

Commit 0d821e8

Browse files
committed
fix: include a timeout when waiting for the cmd_resp
Signed-off-by: Francois Ramu <[email protected]> Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent 6eb25bc commit 0d821e8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/utility/STM32Cube_FW/shci_tl.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
/* Includes ------------------------------------------------------------------*/
2121
#include "stm32_wpan_common.h"
2222

23+
#include <Arduino.h>
24+
2325
#include "stm_list.h"
2426
#include "shci_tl.h"
2527
#include "stm32_def.h"
@@ -250,11 +252,12 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
250252
/* Weak implementation ----------------------------------------------------------------*/
251253
__WEAK void shci_cmd_resp_wait(uint32_t timeout)
252254
{
253-
(void)timeout;
254-
255255
CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT;
256-
while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
257-
256+
for (unsigned long start = millis(); (millis() - start) < timeout;) {
257+
if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) {
258+
break;
259+
}
260+
}
258261
return;
259262
}
260263

0 commit comments

Comments
 (0)