/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : canlog.h * @brief : Header for canlog.c file. * This file contains the defines related to SAE J1939 CAN. ****************************************************************************** * @attention * * Copyright (c) 2026 Erick Ahmed. * * SPDX-License-Identifier: GPL-3.0-or-later * ****************************************************************************** */ /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef CANLOG_H #define CANLOG_H /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "cmsis_os.h" /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ #define LED_BLINK_MS 25U /* USER CODE END PD */ extern osMessageQueueId_t xCAN1RxQueue; extern osMessageQueueId_t xCAN2RxQueue; extern osMessageQueueId_t xUARTQueue; /* USER CODE BEGIN PTD */ typedef struct { GPIO_TypeDef* port; uint16_t pin; } LED_Config; typedef struct { uint32_t id; uint8_t payload[8]; uint8_t dlc; uint8_t isExtended; uint8_t source; //uint32_t timestamp; //Enable TIM2: 42 MHz / (41+1) = 1 MHz → 1 µs tick; 32bit autoreload freerunning // this is for getting timestamps on can messages } CanMessage_t; /* USER CODE END PTD */ void CAN_Logger_Init(CAN_HandleTypeDef *hcan1, CAN_HandleTypeDef *hcan2); void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan); void vCANListener(void *argument); void vLEDHeartbeat(void *argument); #endif /* CANLOG_H */