Skip to content

Commit 974ce4c

Browse files
committed
fix: include a timeout when waiting for the cmd_resp
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 20b8a4c commit 974ce4c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/utility/STM32_WPAN/shci_tl.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "stm_list.h"
2525
#include "shci_tl.h"
2626
#include "stm32_def.h"
27+
#include "wiring_time.h"
2728

2829
/* Private typedef -----------------------------------------------------------*/
2930
typedef enum
@@ -251,10 +252,11 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
251252
/* Weak implementation ----------------------------------------------------------------*/
252253
__WEAK void shci_cmd_resp_wait(uint32_t timeout)
253254
{
254-
(void)timeout;
255-
256-
while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
257-
255+
for (unsigned long start = millis(); (millis() - start) < timeout;) {
256+
if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) {
257+
break;
258+
}
259+
}
258260
return;
259261
}
260262

0 commit comments

Comments
 (0)