2 Commits

Author SHA1 Message Date
eeeck 657d6914ac Syncronize semaphore counters to queue dimension 2026-06-15 14:01:55 +02:00
eeeck cad3d841f4 Transition from timer based to task based LED signal
- Remove RTOS timers
- Create LED task
- Avoid polling, instead wait for semaphore
2026-06-15 14:01:51 +02:00
+2 -15
View File
@@ -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 */
}