Configure filter banks and start CAN
This commit is contained in:
+29
-1
@@ -42,7 +42,35 @@ const osThreadAttr_t vLED_CAN2_Heartbeat_attributes = {
|
|||||||
|
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
void CAN_Logger_Init(CAN_HandleTypeDef *hcan1, CAN_HandleTypeDef *hcan2){}
|
/* BEGIN CAN_Logger_Init */
|
||||||
|
/**
|
||||||
|
* @brief Initialize CAN
|
||||||
|
* @param argument: hcan1, hcan2
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void CAN_Logger_Init(CAN_HandleTypeDef *hcan1, CAN_HandleTypeDef *hcan2)
|
||||||
|
{
|
||||||
|
CAN_FilterTypeDef filter = {0};
|
||||||
|
filter.FilterMode = CAN_FILTERMODE_IDMASK;
|
||||||
|
filter.FilterScale = CAN_FILTERSCALE_32BIT;
|
||||||
|
filter.FilterIdHigh = 0x0000;
|
||||||
|
filter.FilterMaskIdHigh = 0x0000;
|
||||||
|
filter.FilterIdLow = 0x0000;
|
||||||
|
filter.FilterMaskIdLow = 0x0000;
|
||||||
|
filter.FilterFIFOAssignment = CAN_FILTER_FIFO0;
|
||||||
|
filter.FilterActivation = ENABLE;
|
||||||
|
filter.SlaveStartFilterBank = 14;
|
||||||
|
|
||||||
|
filter.FilterBank = 0;
|
||||||
|
if (HAL_CAN_ConfigFilter(hcan1, &filter) != HAL_OK) Error_Handler();
|
||||||
|
filter.FilterBank = 14;
|
||||||
|
if (HAL_CAN_ConfigFilter(hcan2, &filter) != HAL_OK) Error_Handler();
|
||||||
|
|
||||||
|
if (HAL_CAN_Start(hcan1) != HAL_OK) Error_Handler();
|
||||||
|
if (HAL_CAN_Start(hcan2) != HAL_OK) Error_Handler();
|
||||||
|
}
|
||||||
|
/* END CAN_Logger_Init */
|
||||||
|
|
||||||
static void CAN_Listen(void *argument){}
|
static void CAN_Listen(void *argument){}
|
||||||
|
|
||||||
/* BEGIN vCAN_Get */
|
/* BEGIN vCAN_Get */
|
||||||
|
|||||||
Reference in New Issue
Block a user