From 69a347fa7b05291d2de88e87d1bf9f711b33455b Mon Sep 17 00:00:00 2001 From: cosmo Date: Tue, 2 Feb 2021 14:10:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=B1=82=E8=AE=BE=E7=BD=AEhdr=20=3D=20-1=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E5=B1=82=E6=B2=A1=E6=9C=89=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E9=97=AE=E9=A2=98=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E6=BB=A4=E6=B3=A2=E8=A1=A8=E9=A1=BA=E5=BA=8F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEFilterBank?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/libraries/HAL_Drivers/drv_can.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_can.c b/bsp/stm32/libraries/HAL_Drivers/drv_can.c index c7d0428d48..335ac01f19 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_can.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_can.c @@ -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) |