最近在做双CAN通信,对于Filter的设置心里一直有一个问题,请教一下论坛里的大虾。
用的是库函数操作。库函数中关于Filter设置的函数为
void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct)
看了官网库之后发现该函数中,操作的寄存器全部为CAN1->XXX,那么在对CAN2设置filter
时,是如何实现针对CAN2实现的呢?
还有一个问题,CAN_FilterFIFOAssignment这个操作时,对应代码如下
if (CAN_FilterInitStruct->CAN_FilterFIFOAssignment == CAN_Filter_FIFO0)
[/mw_shl_code]
{[/mw_shl_code]
[/mw_shl_code]
[/mw_shl_code]
[/mw_shl_code]
}[/mw_shl_code]
if (CAN_FilterInitStruct->CAN_FilterFIFOAssignment == CAN_Filter_FIFO1)[/mw_shl_code]
{[/mw_shl_code]
[/mw_shl_code]
CAN1->FFA1R |= (uint32_t)filter_number_bit_pos;
[/mw_shl_code]
}
[/mw_shl_code]
都是基于CAN1的寄存器操作。。。那我想设置CAN2与其FIFO0,FIFO1关联时,怎么实现的?谢谢[/mw_shl_code]
一周热门 更多>