Fix can_read() return value for STM32 boards

pull/3492/head
Adrien Chardon 2016-12-21 15:02:39 +01:00
parent e7361ebc44
commit 7e0b4fe3c9
No known key found for this signature in database
GPG Key ID: 33F90F54BB79836B
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) {