From 17febf569aca675f5a22f8f491e62f599c59b032 Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Sun, 14 Jun 2026 17:10:34 +0200 Subject: [PATCH] Use a more generic name as semaphore will be used by other tasks --- Core/Src/canlog.c | 5 ++--- Core/Src/main.c | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Core/Src/canlog.c b/Core/Src/canlog.c index 509a9b2..9071f58 100644 --- a/Core/Src/canlog.c +++ b/Core/Src/canlog.c @@ -111,9 +111,8 @@ void vCANLoggerListen(void *argument) { if (osMessageQueueGet(queue, &message, NULL, osWaitForever) == osOK) { - // TODO: parse message send message to serial/uart - - osSemaphoreRelease( (hcan->Instance == CAN1) ? xLEDSemaphoreCAN1 : xLEDSemaphoreCAN2 ); + osSemaphoreRelease( (hcan->Instance == CAN1) ? xSemaphoreCAN1 : xLEDSemaphoreCAN2 ); + // TODO: use this semaphore } } diff --git a/Core/Src/main.c b/Core/Src/main.c index 82611d8..bf17822 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -68,7 +68,7 @@ LED_Config led_error = {GPIOB, GPIO_PIN_3}; LEDContext ledContextCAN1; LEDContext ledContextCAN2; -osSemaphoreId_t xLEDSemaphoreCAN1; +osSemaphoreId_t xSemaphoreCAN1; osSemaphoreId_t xLEDSemaphoreCAN2; osTimerId_t xHeartbeatTimerCAN1; @@ -155,13 +155,13 @@ int main(void) /* USER CODE END RTOS_MUTEX */ /* USER CODE BEGIN RTOS_SEMAPHORES */ - xLEDSemaphoreCAN1 = osSemaphoreNew(10, 0, NULL); + xSemaphoreCAN1 = osSemaphoreNew(10, 0, NULL); xLEDSemaphoreCAN2 = osSemaphoreNew(10, 0, NULL); - if (xLEDSemaphoreCAN1 == NULL || xLEDSemaphoreCAN2 == NULL) Error_Handler(); + if (xSemaphoreCAN1 == NULL || xLEDSemaphoreCAN2 == NULL) Error_Handler(); ledContextCAN1.led = &led_can1; - ledContextCAN1.semaphore = xLEDSemaphoreCAN1; + ledContextCAN1.semaphore = xSemaphoreCAN1; ledContextCAN2.led = &led_can2; ledContextCAN2.semaphore = xLEDSemaphoreCAN2; /* USER CODE END RTOS_SEMAPHORES */ @@ -197,7 +197,7 @@ int main(void) /* USER CODE BEGIN 3 */ ledContextCAN1.led = &led_can1; - ledContextCAN1.semaphore = xLEDSemaphoreCAN1; + ledContextCAN1.semaphore = xSemaphoreCAN1; ledContextCAN1.timer = xHeartbeatTimerCAN1; ledContextCAN2.led = &led_can2;