Working fork to test F0 application

Dependents:   ppCANOpen_Example

Fork of CANnucleo by Zoltan Hudak

Revision:
11:439f3a34c42e
Parent:
10:227a455d0f9f
Child:
12:c45310ff2233
--- a/can_api.c	Sat Dec 05 10:18:24 2015 +0000
+++ b/can_api.c	Tue Dec 22 18:19:16 2015 +0000
@@ -25,7 +25,11 @@
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
   */
-#include "stm32f1xx_hal.h"
+#if defined(TARGET_NUCLEO_F103RB)
+    #include "stm32f1xx_hal.h"
+#elif defined(TARGET_NUCLEO_F303RE)
+    #include "stm32f3xx_hal.h"
+#endif
 #include "can_api.h"
 #include "can_helper.h"
 #include "pinmap.h"
@@ -61,7 +65,11 @@
  * @retval
  */
 int can_frequency(can_t* obj, int hz) {
+#if defined(TARGET_NUCLEO_F103RB)
     HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn);
+#elif defined(TARGET_NUCLEO_F303RB)
+    HAL_NVIC_DisableIRQ(CAN_RX1_IRQn);
+#endif
 
     // APB1 peripheral clock = 36000000Hz
 
@@ -111,8 +119,12 @@
     }
 
     HAL_CAN_Init(&_canHandle);
-    HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
-    
+#if defined(TARGET_NUCLEO_F103RB)
+     HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
+#elif defined(TARGET_NUCLEO_F303RB)
+    HAL_NVIC_EnableIRQ(CAN_RX1_IRQn);
+#endif
+   
     return 1;
 }
 
@@ -137,7 +149,7 @@
  * @retval
  */
 void can_irq_free(can_t* obj) {
-    rxCompleteCallback = NULL;
+    rxCompleteCallback = 0;
 }
 
 /**
@@ -303,3 +315,4 @@
 
 
 
+