4 Commits

Author SHA1 Message Date
eeeck b38d4d5403 Remove static declare 2026-06-10 13:07:24 +02:00
eeeck d32c03c8f0 Update function prototype names 2026-06-10 13:07:15 +02:00
eeeck 0b05331fff Fix error handling for CAN bus 2026-06-10 13:01:43 +02:00
eeeck 0f6011d05b Use CMSIS-RTOS2 instead of FreeRTOS for consistency 2026-06-10 11:38:30 +02:00
3 changed files with 10 additions and 8 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ extern const osThreadAttr_t vLED_CAN2_Heartbeat_attributes;
* @param hcan2 Pointer to the CAN2 handle
*/
void CAN_Logger_Init(CAN_HandleTypeDef *hcan1, CAN_HandleTypeDef *hcan2);
void vCAN_Get(void *argument);
void vLED_HeartbeatOnCanRx(void *argument);
void vCAN_Logger_Listen(void *argument);
void vLED_Heartbeat(void *argument);
#endif /* CANLOG_H */
+3 -3
View File
@@ -99,7 +99,7 @@ void CAN_Logger_Init(CAN_HandleTypeDef *hcan1, CAN_HandleTypeDef *hcan2)
* @param argument: Not used
* @retval None
*/
static void vCAN_Logger_Listen(void *argument)
void vCAN_Logger_Listen(void *argument)
{
/* CODE BEGIN */
/* Infinite loop */
@@ -129,9 +129,9 @@ void vLED_Heartbeat(void *argument)
HAL_GPIO_WritePin(led->port, led->pin, GPIO_PIN_SET);
vTaskDelay(pdMS_TO_TICKS(100));
osDelay(100);
HAL_GPIO_WritePin(led->port, led->pin, GPIO_PIN_RESET);
vTaskDelay(pdMS_TO_TICKS(100));
osDelay(100);
}
/* CODE END */
}
+5 -3
View File
@@ -445,9 +445,11 @@ void Error_Handler(void)
//TODO: check if it is necessary to stop FreeRTOS
uint32_t error_code;
if (hcan == &hcan1) error_code = HAL_CAN_GetError(&hcan1);
else if (hcan == &hcan2) error_code = HAL_CAN_GetError(&hcan2);
uint32_t error_can1 == 0;
uint32_t error_can2 == 0;
if (HAL_CAN_GetState(&hcan1) != HAL_CAN_STATE_READY) error_code = HAL_CAN_GetError(&hcan1);
else if (HAL_CAN_GetState(&hcan2) != HAL_CAN_STATE_READY) error_code = HAL_CAN_GetError(&hcan2);
// TODO: write error to SD and/or serial