修复 应用层设置hdr = -1时,驱动层没有正确识别问题,默认按照滤波表顺序设置FilterBank

This commit is contained in:
cosmo 2021-02-02 14:10:57 +08:00
parent 59f320783f
commit 69a347fa7b
1 changed files with 8 additions and 0 deletions

View File

@ -303,6 +303,14 @@ static rt_err_t _can_control(struct rt_can_device *can, int cmd, void *arg)
/* get default filter */
for (int i = 0; i < filter_cfg->count; i++)
{
if (filter_cfg->items[i].hdr == -1)
{
drv_can->FilterConfig.FilterBank = i;
}
else
{
drv_can->FilterConfig.FilterBank = filter_cfg->items[i].hdr;
}
drv_can->FilterConfig.FilterBank = filter_cfg->items[i].hdr;
drv_can->FilterConfig.FilterIdHigh = (filter_cfg->items[i].id >> 13) & 0xFFFF;
drv_can->FilterConfig.FilterIdLow = ((filter_cfg->items[i].id << 3) |