mirror of https://github.com/ARMmbed/mbed-os.git
Fix can_read() return value for STM32 boards
parent
e7361ebc44
commit
7e0b4fe3c9
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue