Merge pull request #689 from AubrCool/fix-bxcan.ide.frm.fltr.err

[BSP] stm32f10x bxcan correct ext frame filter
This commit is contained in:
Bernard Xiong 2016-12-29 08:41:52 +08:00 committed by GitHub
commit 04658b9f54
1 changed files with 14 additions and 4 deletions

View File

@ -1008,10 +1008,20 @@ static rt_err_t bxmodifyfilter(struct stm_bxcan *pbxcan, struct rt_can_filter_it
}
break;
}
CAN_FilterInitStructure.CAN_FilterIdHigh = ((ID[1]) & 0x0000FFFF);
CAN_FilterInitStructure.CAN_FilterIdLow = ID[0] & 0x0000FFFF;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = (ID[1] & 0xFFFF0000) >> 16;
CAN_FilterInitStructure.CAN_FilterMaskIdLow = (ID[0] & 0xFFFF0000) >> 16;
if(pitem->ide)
{
CAN_FilterInitStructure.CAN_FilterIdHigh = (ID[0] & 0xFFFF0000) >> 16;
CAN_FilterInitStructure.CAN_FilterIdLow = ID[0] & 0x0000FFFF;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = (ID[1] & 0xFFFF0000) >> 16;
CAN_FilterInitStructure.CAN_FilterMaskIdLow = ((ID[1]) & 0x0000FFFF);
}
else
{
CAN_FilterInitStructure.CAN_FilterIdHigh = ((ID[1]) & 0x0000FFFF);
CAN_FilterInitStructure.CAN_FilterIdLow = ID[0] & 0x0000FFFF;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = (ID[1] & 0xFFFF0000) >> 16;
CAN_FilterInitStructure.CAN_FilterMaskIdLow = (ID[0] & 0xFFFF0000) >> 16;
}
if (fbase >= pbxcan->fifo1filteroff)
{
CAN_FilterInitStructure.CAN_FilterFIFOAssignment = 1;