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.
Diff: canutils.cpp
- Revision:
- 3:92dae9083c83
- Parent:
- 2:bf3a2b29259a
- Child:
- 4:682d96ff6d79
diff -r bf3a2b29259a -r 92dae9083c83 canutils.cpp
--- a/canutils.cpp Tue Dec 14 21:50:35 2010 +0000
+++ b/canutils.cpp Tue Jun 07 12:23:28 2011 +0000
@@ -42,16 +42,42 @@
return (can.frequency(speed)) ? TERM_OK : TERM_ERR;
}
-
-void show_can_message() {
+//
+// show_can_message
+//
+// Displays a CAN message in the RX buffer if there is one.
+//
+// inputs: none
+// return: bool TRUE if there was a message, FALSE if no message.
+//
+extern void show_can_message() {
CANMessage can_MsgRx;
if (can.read(can_MsgRx)) {
+ CANRXLEDON;
printf("w%03x%d", can_MsgRx.id, can_MsgRx.len);
- for (char i=0; i<can_MsgRx.len; i++) {
+ for (char i=0; i<can_MsgRx.len; i++)
printf("%02x", can_MsgRx.data[i]);
- }
+ printf(" %c ", can_MsgRx.data[2]);
printf("\r\n");
}
+ return;
+}
+
+//
+// silent_can_message
+//
+// Turns on the CAN receive LED if there is a CAN message
+// but doesn't displays anything.
+//
+// inputs: none
+// return: bool TRUE if there was a message, FALSE if no message.
+//
+extern void silent_can_message() {
+ CANMessage can_MsgRx;
+ if (can.read(can_MsgRx)) {
+ CANRXLEDON;
+ }
+ return;
}
//