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.
Fork of Can_sniffer_BMS4 by
Diff: main.cpp
- Revision:
- 17:18d4d0ff26a6
- Parent:
- 16:a86f339d1c25
- Child:
- 18:22977a898fe9
--- a/main.cpp Sun Jul 31 21:36:52 2016 +0000 +++ b/main.cpp Wed Aug 10 18:30:01 2016 +0000 @@ -9,7 +9,7 @@ * * For more details see the wiki page <https://developer.mbed.org/users/hudakz/code/CANnucleo_Hello/> * - * NOTE: If you'd like to use the official NUCLEO boards comment out line 25 + * NOTE: If you'd like to use the official NUCLEO boards comment out line 22 * * The same code is used for both NUCLEO boards, but: * For board #1 compile the example without any change. @@ -19,7 +19,7 @@ * */ -//#define TARGET_STM32F103C8T6 1 // comment out this line when using official NUCLEO boards! +#define TARGET_STM32F103C8T6 1 // comment out this line when using official NUCLEO boards! #define BOARD1 1 // comment out this line when compiling for board #2 #if defined(TARGET_STM32F103C8T6) @@ -42,14 +42,19 @@ #include "mbed.h" #include "CANnucleo.h" -DigitalOut led(LED1); -int ledState; -Timer timer; -CAN can(PA_11, PA_12); // CAN Rx pin name, CAN Tx pin name -CANMessage rxMsg; -CANMessage txMsg; -int counter = 0; -volatile bool msgAvailable = false; +DigitalOut led(LED1); +int ledState; +Timer timer; +/* + * To avaoid name collision with the CAN and CANMessage classes built into the mbed library + * the CANnucleo's CAN and CANMessage classes have been moved into the CANnucleo namespace. + * So remember to qualify them with the CANnucleo namespace. + */ +CANnucleo::CAN can(PA_11, PA_12); // CAN Rx pin name, CAN Tx pin name +CANnucleo::CANMessage rxMsg; +CANnucleo::CANMessage txMsg; +int counter = 0; +volatile bool msgAvailable = false; /** * @brief 'CAN receive-complete' interrup handler. @@ -125,3 +130,4 @@ } +