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.
Dependencies: CANnucleo CANnucleo_Hello mbed
Fork of CANnucleo_Hello by
Diff: main.cpp
- Revision:
- 12:e91e44924194
- Parent:
- 11:07d927da1a94
- Child:
- 13:e741def3e4ff
diff -r 07d927da1a94 -r e91e44924194 main.cpp
--- a/main.cpp Fri Mar 11 12:29:38 2016 +0000
+++ b/main.cpp Sat Jul 23 08:29:31 2016 +0000
@@ -20,9 +20,9 @@
*/
#include "mbed.h"
-#include "CAN.h"
+#include "CANnucleo.h"
-#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)
@@ -71,7 +71,7 @@
*/
int main() {
can.frequency(1000000); // set bit rate to 1Mbps
- can.attach(&onMsgReceived, CAN::RxIrq); // attach 'CAN receive-complete' interrupt handler
+ can.attach(&onMsgReceived); // attach 'CAN receive-complete' interrupt handler
#if defined(BOARD1)
led = ON; // turn LED on
@@ -109,7 +109,7 @@
printf(" %x", rxMsg.data[i]);
printf("\r\n");
// Filtering performed by software:
- if(rxMsg.id == RX_ID) { // See comments in CAN.cpp for filtering performed by hadware
+ if(rxMsg.id == RX_ID) { // See comments in CAN.cpp for filtering performed by hardware
rxMsg >> counter; // extract first data item
rxMsg >> ledState; // extract second data item
printf("counter = %d\r\n", counter);
@@ -120,3 +120,4 @@
}
}
+
