global refactoring
This commit is contained in:
@@ -77,11 +77,14 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||
break;
|
||||
|
||||
case 0x1E00: //PGN BEM (ERROR)
|
||||
GBT_Stop();
|
||||
//Error force stop
|
||||
GBT_ForceStop();
|
||||
break;
|
||||
|
||||
case 0x1900: //PGN BST (STOP)
|
||||
GBT_Stop();
|
||||
//Normal stop
|
||||
GBT_Stop(GBT_CST_BMS_ACTIVELY_SUSPENDS);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -106,6 +109,7 @@ void GBT_CAN_ReInit(){
|
||||
MX_CAN1_Init();
|
||||
HAL_CAN_Start(&hcan1);
|
||||
HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING);
|
||||
GBT_CAN_FilterInit();
|
||||
}
|
||||
|
||||
void J_SendPacket(uint32_t PGN, uint8_t pri, uint8_t DLC, uint8_t *data){
|
||||
@@ -161,3 +165,22 @@ void J_SendACK(j_receive_t rx){//uint32_t PGN, uint8_t step, uint8_t packet){
|
||||
J_SendPacket(0x00EC00, 7, 8, data);
|
||||
}
|
||||
|
||||
void GBT_CAN_FilterInit(){
|
||||
CAN_FilterTypeDef sFilterConfig;
|
||||
|
||||
sFilterConfig.FilterBank = 0;
|
||||
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
|
||||
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
|
||||
sFilterConfig.FilterIdHigh = 0x0000;
|
||||
sFilterConfig.FilterIdLow = 0x0000;
|
||||
sFilterConfig.FilterMaskIdHigh = 0x0000;
|
||||
sFilterConfig.FilterMaskIdLow = 0x0000;
|
||||
sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0;
|
||||
sFilterConfig.FilterActivation = ENABLE;
|
||||
//sFilterConfig.SlaveStartFilterBank = 14;
|
||||
if(HAL_CAN_ConfigFilter(&hcan1, &sFilterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user