Fix can_read() return value for STM32 boards

pull/3585/head
Adrien Chardon 2016-12-21 15:02:39 +01:00 committed by Anna Bridge
parent 76e406f323
commit 189747f8fd
7 changed files with 42 additions and 0 deletions

View File

@ -235,6 +235,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
if ((can->RF0R & CAN_RF0R_FMP0) == 0) {
return 0;
}
/* Get the Id */
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
if (!msg->format) {

View File

@ -238,6 +238,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
if ((can->RF0R & CAN_RF0R_FMP0) == 0) {
return 0;
}
/* Get the Id */
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
if (!msg->format) {

View File

@ -248,6 +248,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
if ((can->RF0R & CAN_RF0R_FMP0) == 0) {
return 0;
}
/* Get the Id */
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
if (!msg->format) {

View File

@ -238,6 +238,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
if ((can->RF0R & CAN_RF0R_FMP0) == 0) {
return 0;
}
/* Get the Id */
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
if (!msg->format) {

View File

@ -251,6 +251,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
if ((can->RF0R & CAN_RF0R_FMP0) == 0) {
return 0;
}
/* Get the Id */
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
if (!msg->format) {

View File

@ -251,6 +251,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
if ((can->RF0R & CAN_RF0R_FMP0) == 0) {
return 0;
}
/* Get the Id */
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
if (!msg->format) {

View File

@ -238,6 +238,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);
// check FPM0 which holds the pending message count in FIFO 0
// if no message is pending, return 0
if ((can->RF0R & CAN_RF0R_FMP0) == 0) {
return 0;
}
/* Get the Id */
msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
if (!msg->format) {