Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAX34417_demo MAXREFDES1265 MAXREFDES1265
Fork of mbed-dev by
Diff: targets/TARGET_STM/TARGET_STM32F3/can_api.c
- Revision:
- 156:95d6b41a828b
- Parent:
- 149:156823d33999
diff -r 88546b34ff1c -r 95d6b41a828b targets/TARGET_STM/TARGET_STM32F3/can_api.c
--- a/targets/TARGET_STM/TARGET_STM32F3/can_api.c Thu Jan 05 10:51:54 2017 +0000
+++ b/targets/TARGET_STM/TARGET_STM32F3/can_api.c Mon Jan 16 15:03:32 2017 +0000
@@ -238,6 +238,12 @@
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) {
@@ -264,10 +270,10 @@
/* Release the FIFO */
if(handle == CAN_FIFO0) {
/* Release FIFO0 */
- can->RF0R = CAN_RF0R_RFOM0;
+ can->RF0R |= CAN_RF0R_RFOM0;
} else { /* FIFONumber == CAN_FIFO1 */
/* Release FIFO1 */
- can->RF1R = CAN_RF1R_RFOM1;
+ can->RF1R |= CAN_RF1R_RFOM1;
}
return 1;
