Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 657d6914ac | |||
| cad3d841f4 |
+2
-15
@@ -121,21 +121,8 @@ void vLEDHeartbeat(void *argument)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
// BLOCK for UP TO 25ms.
|
||||
// - Returns osOK instantly if CAN traffic arrives.
|
||||
// - Returns osTimeout if 25ms pass with NO traffic.
|
||||
if (osSemaphoreAcquire(context->semaphore, 25U) == osOK)
|
||||
{
|
||||
// Traffic detected! Turn ON LED.
|
||||
// Loop immediately to wait for the next message.
|
||||
HAL_GPIO_WritePin(context->led->port, context->led->pin, GPIO_PIN_SET);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Timeout! No CAN traffic for 25ms. Turn OFF LED.
|
||||
// Loop and block again.
|
||||
HAL_GPIO_WritePin(context->led->port, context->led->pin, GPIO_PIN_RESET);
|
||||
}
|
||||
if (osSemaphoreAcquire(context->semaphore, 25U) == osOK) HAL_GPIO_WritePin(context->led->port, context->led->pin, GPIO_PIN_SET);
|
||||
else HAL_GPIO_WritePin(context->led->port, context->led->pin, GPIO_PIN_RESET);
|
||||
}
|
||||
/* CODE END */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user