Skip to content

Commit 09680e7

Browse files
committed
fix: include a timeout when waiting for the cmd_resp
Signed-off-by: Francois Ramu <[email protected]>
1 parent 108f46f commit 09680e7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/utility/STM32Cube_FW/shci_tl.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
/* Includes ------------------------------------------------------------------*/
2222
#include "stm32_wpan_common.h"
2323

24+
#include <Arduino.h>
25+
2426
#include "stm_list.h"
2527
#include "shci_tl.h"
2628
#include "stm32_def.h"
@@ -346,11 +348,12 @@ static void OutputEvtTrace(TL_EvtPacket_t *phcievtbuffer)
346348
/* Weak implementation ----------------------------------------------------------------*/
347349
__WEAK void shci_cmd_resp_wait(uint32_t timeout)
348350
{
349-
(void)timeout;
350-
351351
CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT;
352-
while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
353-
352+
for (unsigned long start = millis(); (millis() - start) < timeout;) {
353+
if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) {
354+
break;
355+
}
356+
}
354357
return;
355358
}
356359

@@ -363,4 +366,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag)
363366
return;
364367
}
365368

366-
#endif /* STM32WBxx */
369+
#endif /* STM32WBxx */

0 commit comments

Comments
 (0)