[at32][can]修复CAN驱动返回消息时,错误给id和ide赋值问题

该驱动收到can消息时,给上级返回消息结构的id和ide成员赋值不正确。

Signed-off-by: 李刚 <lg28870983@163.com>
This commit is contained in:
Meco Man 2023-01-12 01:35:20 -05:00 committed by Man, Jianting (Meco)
parent 9db73a47c4
commit 7e177ebf1a
1 changed files with 7 additions and 2 deletions

View File

@ -589,12 +589,17 @@ static int _can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t fifo)
pmsg->data[7] = rx_message.data[7]; pmsg->data[7] = rx_message.data[7];
pmsg->len = rx_message.dlc; pmsg->len = rx_message.dlc;
pmsg->id = rx_message.id_type;
if (rx_message.id_type == CAN_ID_STANDARD) if (rx_message.id_type == CAN_ID_STANDARD)
{
pmsg->id = rx_message.standard_id; pmsg->id = rx_message.standard_id;
pmsg->ide = RT_CAN_STDID;
}
else else
pmsg->ide = rx_message.extended_id; {
pmsg->id = rx_message.extended_id;
pmsg->ide = RT_CAN_EXTID;
}
pmsg->rtr = rx_message.frame_type; pmsg->rtr = rx_message.frame_type;
pmsg->hdr_index = rx_message.filter_index; pmsg->hdr_index = rx_message.filter_index;