Gerardo Antonio / Mbed 2 deprecated BMS_8

Dependencies:   CANnucleo LTC68041 mbed

Fork of BMS_4 by Gerardo Antonio

Files at this revision

API Documentation at this revision

Comitter:
hudakz
Date:
Sat Aug 13 12:45:16 2016 +0000
Parent:
18:22977a898fe9
Child:
20:eb1a8042605e
Commit message:
Updated.

Changed in this revision

CANnucleo.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-STM32F103C8T6.lib Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/CANnucleo.lib	Thu Aug 11 12:07:34 2016 +0000
+++ b/CANnucleo.lib	Sat Aug 13 12:45:16 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/hudakz/code/CANnucleo/#ea766d08c9db
+http://mbed.org/users/hudakz/code/CANnucleo/#c5d348e65e24
--- a/main.cpp	Thu Aug 11 12:07:34 2016 +0000
+++ b/main.cpp	Sat Aug 13 12:45:16 2016 +0000
@@ -19,14 +19,15 @@
  *
  */ 
 
-#define TARGET_STM32F103C8T6  1     // comment out this line when using official NUCLEO boards!                                    
+//#define TARGET_STM32F103C8T6  1     // uncomment this line when using STM32F103C8T6 boards!                                    
 #define BOARD1                1     // comment out this line when compiling for board #2
 
 #if defined(TARGET_STM32F103C8T6)
-    #include "stm32f103c8t6.h"
+    #define LED_PIN PC_13
     const int OFF = 1;
     const int ON  = 0;
 #else
+    #define LED_PIN LED1
     const int OFF = 0;
     const int ON  = 1;
 #endif
@@ -39,8 +40,8 @@
     const unsigned int TX_ID = 0x100;
 #endif
 
+#include "CANnucleo.h"
 #include "mbed.h"
-#include "CANnucleo.h"
 
 /* 
  * To avaoid name collision with the CAN and CANMessage classes built into the mbed library
@@ -50,7 +51,7 @@
 CANnucleo::CAN          can(PA_11, PA_12);  // CAN Rx pin name, CAN Tx pin name
 CANnucleo::CANMessage   rxMsg;
 CANnucleo::CANMessage   txMsg;
-DigitalOut              led(LED1);
+DigitalOut              led(LED_PIN);
 int                     ledState;
 Timer                   timer;
 int                     counter = 0;
@@ -74,9 +75,6 @@
  * @retval
  */
 int main() {
-#if defined(TARGET_STM32F103C8T6)
-    confSysClock();
-#endif
     can.frequency(1000000);                     // set bit rate to 1Mbps
     can.attach(&onMsgReceived);                 // attach 'CAN receive-complete' interrupt handler
     
@@ -108,14 +106,14 @@
         if(msgAvailable) {
             msgAvailable = false;               // reset flag for next use
             can.read(rxMsg);                    // read message into Rx message storage
-            printf("CAN message received:\r\n");
-            printf("  ID     = 0x%.3x\r\n", rxMsg.id);
-            printf("  Type   = %d\r\n", rxMsg.type);
-            printf("  Format = %d\r\n", rxMsg.format);
-            printf("  Length = %d\r\n", rxMsg.len);
-            printf("  Data   =");            
+            printf("CAN message received\r\n");
+            printf("  ID      = 0x%.3x\r\n", rxMsg.id);
+            printf("  Type    = %d\r\n", rxMsg.type);
+            printf("  Format  = %d\r\n", rxMsg.format);
+            printf("  Length  = %d\r\n", rxMsg.len);
+            printf("  Data    =");            
             for(int i = 0; i < rxMsg.len; i++)
-                printf(" 0x%.2x", rxMsg.data[i]);
+                printf(" %.2x", rxMsg.data[i]);
             printf("\r\n");
             // Filtering performed by software:           
             if(rxMsg.id == RX_ID) {             // See comments in CAN.cpp for filtering performed by hardware
--- a/mbed-STM32F103C8T6.lib	Thu Aug 11 12:07:34 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/hudakz/code/mbed-STM32F103C8T6/#9fbbea76d6f6
--- a/mbed.bld	Thu Aug 11 12:07:34 2016 +0000
+++ b/mbed.bld	Sat Aug 13 12:45:16 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/f9eeca106725
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/b0220dba8be7
\ No newline at end of file