Skip to content

Commit 5d07a0e

Browse files
committed
fix: include a timeout when waiting for the cmd_resp
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 542e007 commit 5d07a0e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/utility/STM32Cube_FW/shci_tl.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "stm_list.h"
2424
#include "shci_tl.h"
2525
#include "stm32_def.h"
26+
#include "wiring_time.h"
2627

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

0 commit comments

Comments
 (0)