4 Commits

Author SHA1 Message Date
eeeck 6bcc977c65 Switch ISR semaphore release to normal semaphore release 2026-06-16 23:07:50 +02:00
eeeck 8ec62d9fcd Fix typo in comment 2026-06-16 23:07:03 +02:00
eeeck cbefb45099 Add externs 2026-06-16 23:06:54 +02:00
eeeck f7581d49ce Fix task priority with correct handles 2026-06-16 23:06:35 +02:00
2 changed files with 9 additions and 7 deletions
+6 -4
View File
@@ -22,10 +22,14 @@
#include "canlog.h" #include "canlog.h"
/* USER CODE END Includes */ /* USER CODE END Includes */
extern UART_HandleTypeDef huart1;
extern osSemaphoreId_t xUARTDMASemaphore;
extern osMessageQueueId_t xUARTQueue;
/* BEGIN format_can_message */ /* BEGIN format_can_message */
/** /**
* @brief Format CAN message for friendly reading on terminal emulators and other MCUs. * @brief Format CAN message for friendly reading on terminal emulators and other MCUs.
* @param arguments: buffer, sourse, message * @param arguments: buffer, source, message
* @retval None * @retval None
*/ */
static void format_can_message(char *buf, uint8_t source, const CanMessage_t *message) static void format_can_message(char *buf, uint8_t source, const CanMessage_t *message)
@@ -81,9 +85,7 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{ {
if (huart->Instance == USART1) if (huart->Instance == USART1)
{ {
BaseType_t xHigherPriorityTaskWoken = pdFALSE; osSemaphoreRelease(xUARTDMASemaphore);
osSemaphoreReleaseFromISR(xUARTDMASemaphore, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
} }
} }
/* END HAL_UART_TxCpltCallback */ /* END HAL_UART_TxCpltCallback */
+3 -3
View File
@@ -138,17 +138,17 @@ int main(void)
const osThreadAttr_t UartLoggerAttributes = { const osThreadAttr_t UartLoggerAttributes = {
.name = "UART_Logger", .name = "UART_Logger",
.stack_size = 256 * 4, .stack_size = 256 * 4,
.priority = (osPriority_t) osPriorityVeryHigh, .priority = (osPriority_t) osPriorityHigh,
}; };
const osThreadAttr_t LEDHeartbeatCAN1Attributes = { const osThreadAttr_t LEDHeartbeatCAN1Attributes = {
.name = "LED_HB_CAN1", .name = "LED_HB_CAN1",
.stack_size = 128 * 4, .stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityVeryLow1, .priority = (osPriority_t) osPriorityLow1,
}; };
const osThreadAttr_t LEDHeartbeatCAN2Attributes = { const osThreadAttr_t LEDHeartbeatCAN2Attributes = {
.name = "LED_HB_CAN2", .name = "LED_HB_CAN2",
.stack_size = 128 * 4, .stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityVeryLow, .priority = (osPriority_t) osPriorityLow,
}; };
/* USER CODE END RTOS_TASKS */ /* USER CODE END RTOS_TASKS */