stefan frey / CANnucleo

Fork of CANnucleo by Zoltan Hudak

Files at this revision

API Documentation at this revision

Comitter:
hudakz
Date:
Sun Jul 19 14:04:31 2015 +0000
Parent:
0:e29bc8e0dddd
Child:
2:09a0d2838572
Commit message:
rev 01

Changed in this revision

can_api.c Show annotated file Show diff for this revision Revisions of this file
stm32f1xx_hal_msp.c Show annotated file Show diff for this revision Revisions of this file
stm32f1xx_hal_msp.h Show annotated file Show diff for this revision Revisions of this file
--- a/can_api.c	Sun Jul 19 09:06:26 2015 +0000
+++ b/can_api.c	Sun Jul 19 14:04:31 2015 +0000
@@ -1,15 +1,13 @@
 /*
  can_api.c for STMicroelectronics mbed boards equipped with Controller Area Network interface:
 
- NUCLEO-F070RB
  NUCLEO-F072RB
+ NUCLEO-F091RC
  NUCLEO-F103RB
  NUCLEO-F302R8
+ NUCLEO-F303RE
  NUCLEO-F334R8
- NUCLEO-F303RE
- NUCLEO-F091RC
  DISCO-F334C8
- DISCO-F746NG
 
  Copyright (c) 2015 Zoltan Hudak <hudakz@inbox.com>
  All rights reserved.
@@ -63,15 +61,12 @@
  * @retval
  */
 int can_frequency(can_t* obj, int hz) {
-
-    /* Disable the NVIC for CAN reception */
-
     HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn);
 
 #if defined(TARGET_NUCLEO_F103RB) || \
     defined(TARGET_NUCLEO_F302R8) || \
+    defined(TARGET_NUCLEO_F303RE) || \
     defined(TARGET_NUCLEO_F334R8) || \
-    defined(TARGET_NUCLEO_F303RE) || \
     defined(TARGET_DISCO_F334C8)
     // APB1 pheripheral clock = 36000000Hz
 
@@ -118,8 +113,7 @@
         _canHandle.Init.BS2 = CAN_BS2_4TQ;
     }
 
-#elif defined(TARGET_NUCLEO_F070RB) || \
-      defined(TARGET_NUCLEO_F072RB) || \ 
+#elif defined(TARGET_NUCLEO_F072RB) || \ 
       defined(TARGET_NUCLEO_F091RC)
     // APB1 pheripheral clock = 48000000Hz
 
@@ -198,10 +192,6 @@
  * @param
  * @retval
  */
-//void can_irq_set(can_t* obj, CanIrqType irq, uint32_t enable)
-//{
-
-//}
 void can_irq_set(void (*fptr) (void)) {
     rxCompleteCallback = fptr;
 }
@@ -351,3 +341,4 @@
 
     // not implemented
 }
+
--- a/stm32f1xx_hal_msp.c	Sun Jul 19 09:06:26 2015 +0000
+++ b/stm32f1xx_hal_msp.c	Sun Jul 19 14:04:31 2015 +0000
@@ -76,16 +76,15 @@
     // 125kbps bit rate (default)
 #if defined(TARGET_NUCLEO_F103RB) || \
     defined(TARGET_NUCLEO_F302R8) || \
+    defined(TARGET_NUCLEO_F303RE) || \
     defined(TARGET_NUCLEO_F334R8) || \
-    defined(TARGET_NUCLEO_F303RE) || \
     defined(TARGET_DISCO_F334C8)
     // APB1 pheripheral clock = 36000000Hz
     _canHandle.Init.Prescaler = 18;      // number of time quanta = 36000000/18/125000 = 16
     _canHandle.Init.SJW = CAN_SJW_1TQ;
     _canHandle.Init.BS1 = CAN_BS1_11TQ;  // sample point at (1 + 11) / 16 * 100 = 75%
     _canHandle.Init.BS2 = CAN_BS2_4TQ;
-#elif defined(TARGET_NUCLEO_F070RB) || \
-      defined(TARGET_NUCLEO_F072RB) || \ 
+#elif defined(TARGET_NUCLEO_F072RB) || \ 
       defined(TARGET_NUCLEO_F091RC)
     // APB1 pheripheral clock = 48000000Hz
     _canHandle.Init.Prescaler = 24;     // number of time quanta = 48000000/24/125000 = 16
--- a/stm32f1xx_hal_msp.h	Sun Jul 19 09:06:26 2015 +0000
+++ b/stm32f1xx_hal_msp.h	Sun Jul 19 14:04:31 2015 +0000
@@ -36,9 +36,6 @@
 #ifndef stm32f1xx_hal_H
 #define stm32f1xx_hal_H
 
-//#include "stm32f1xx_hal.h"
-//#include "can_api.h"
-//#include "can_helper.h"
 #include "pinmap.h"
 
 typedef struct can_s    can_t;