接收邮箱配置
初始化的配置是在初始化canfd外设完成后进行的配置
//初始化的配置
Canfd_Sdu.Can_MailboxHeader[0].TransceiveType = MAIL_RECEIVE;
for(uint8_t i = 1 ; i<=20 ; i++)
{
//调用更新邮箱的函数,配置为接受邮箱
Can_m_FdMailBox_Write(CANfd6, i,&Canfd_Sdu.Can_MailboxHeader[0]);
}
//中断服务函数里面,判断到接收中断后,去查询接收邮箱
if (Can_Controller_InterruptFlag.RxIntFlag == 0x01)
{
for(uint8_t i = 1 ; i<=20 ; i++)
{
if(Can_m_FdGetMailBoxState(CANfd6,i) == MAIL_RECEIVE_SUCCESS)
{
/* Read recevie mailbox information and reinitialize mailbox code */
if(Can_m_FdMailBox_Read(CANfd6, i, &Canfd_MailboxHeader_R,MAIL_RECEIVE) == CAN_OK)
{
//USER CODE
}
}
}
}
|
———————————————— 版权声明:本文为CSDN博主「阿范1」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/Fanshijun1/article/details/128143846