2 Commits

Author SHA1 Message Date
eeeck c540ff7800 Remove dead code 2026-06-16 22:13:52 +02:00
eeeck dfc116b2e9 Fix linker error by moving RTOS thread declaration to global scope 2026-06-16 22:12:40 +02:00
2 changed files with 6 additions and 7 deletions
-3
View File
@@ -71,7 +71,6 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
uint8_t data[8]; uint8_t data[8];
osMessageQueueId_t queue; osMessageQueueId_t queue;
uint32_t flag;
osThreadId_t led_task; osThreadId_t led_task;
// TODO: manage the case of FIFO overflow // TODO: manage the case of FIFO overflow
@@ -86,13 +85,11 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
if (hcan->Instance == CAN1) if (hcan->Instance == CAN1)
{ {
queue = xCAN1RxQueue; queue = xCAN1RxQueue;
flag = 0x01;
led_task = xCAN1LedTask; led_task = xCAN1LedTask;
} }
else else
{ {
queue = xCAN2RxQueue; queue = xCAN2RxQueue;
flag = 0x02;
led_task = xCAN2LedTask; led_task = xCAN2LedTask;
} }
+6 -4
View File
@@ -52,6 +52,11 @@ LED_Config led_can1 = {GPIOB, GPIO_PIN_2};
LED_Config led_can2 = {GPIOB, GPIO_PIN_5}; LED_Config led_can2 = {GPIOB, GPIO_PIN_5};
LED_Config led_error = {GPIOB, GPIO_PIN_3}; LED_Config led_error = {GPIOB, GPIO_PIN_3};
osThreadId_t xCAN1rxTask;
osThreadId_t xCAN2rxTask;
osThreadId_t xCAN1LedTask;
osThreadId_t xCAN2LedTask;
osMessageQueueId_t xCAN1RxQueue; osMessageQueueId_t xCAN1RxQueue;
osMessageQueueId_t xCAN2RxQueue; osMessageQueueId_t xCAN2RxQueue;
osMessageQueueId_t xUARTQueue; osMessageQueueId_t xUARTQueue;
@@ -120,14 +125,13 @@ int main(void)
osKernelInitialize(); osKernelInitialize();
/* USER CODE BEGIN RTOS_TASKS */ /* USER CODE BEGIN RTOS_TASKS */
osThreadId_t xCAN1rxTask;
const osThreadAttr_t CAN1rxAttributes = { const osThreadAttr_t CAN1rxAttributes = {
.name = "CAN1rx", .name = "CAN1rx",
.stack_size = 128 * 4, .stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityRealtime1, .priority = (osPriority_t) osPriorityRealtime1,
}; };
osThreadId_t xCAN2rxTask;
const osThreadAttr_t CAN2rxAttributes = { const osThreadAttr_t CAN2rxAttributes = {
.name = "CAN2rx", .name = "CAN2rx",
.stack_size = 128 * 4, .stack_size = 128 * 4,
@@ -140,14 +144,12 @@ int main(void)
.priority = (osPriority_t) osPriorityVeryHigh, .priority = (osPriority_t) osPriorityVeryHigh,
}; };
osThreadId_t xCAN1LedTask;
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) osPriorityVeryLow1,
}; };
osThreadId_t xCAN2LedTask;
const osThreadAttr_t LEDHeartbeatCAN2Attributes = { const osThreadAttr_t LEDHeartbeatCAN2Attributes = {
.name = "LED_HB_CAN2", .name = "LED_HB_CAN2",
.stack_size = 128 * 4, .stack_size = 128 * 4,