mbed library sources. With a patch for the can_api

Fork of mbed-dev by mbed official

Files at this revision

API Documentation at this revision

Comitter:
DangerousElectrician
Date:
Mon Nov 14 04:39:23 2016 +0000
Parent:
150:02e0a0aed4ec
Commit message:
stuff changed?

Changed in this revision

targets/TARGET_STM/TARGET_STM32F0/can_api.c Show annotated file Show diff for this revision Revisions of this file
diff -r 02e0a0aed4ec -r 91825d030f9b targets/TARGET_STM/TARGET_STM32F0/can_api.c
--- a/targets/TARGET_STM/TARGET_STM32F0/can_api.c	Tue Nov 08 17:45:16 2016 +0000
+++ b/targets/TARGET_STM/TARGET_STM32F0/can_api.c	Mon Nov 14 04:39:23 2016 +0000
@@ -234,6 +234,10 @@
     //handle is the FIFO number
 
     CAN_TypeDef *can = (CAN_TypeDef *)(obj->can);    
+
+    if ((uint8_t)(can->RF0R & CAN_RF0R_FMP0) == (uint8_t)0) { // no messages in fifo
+    	return 0;
+	}
     
     /* Get the Id */
     msg->format = (CANFormat)((uint8_t)0x04 & can->sFIFOMailBox[handle].RIR);
@@ -266,7 +270,6 @@
       /* Release FIFO1 */
       can->RF1R = CAN_RF1R_RFOM1;
     }
-
     return 1;
 }