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: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
Diff: Libs/XbeeManager/CAN-xbee/CAN-xbee.h
- Revision:
- 33:6bc82b6b62e5
- Child:
- 34:18bcf276d3bf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Libs/XbeeManager/CAN-xbee/CAN-xbee.h Tue Jan 06 20:45:26 2015 +0000
@@ -0,0 +1,32 @@
+#ifndef CAN_XBEE_H
+#define CAN_XBEE_H
+
+#include "mbed.h"
+#include "MODSERIAL.h"
+
+// The string format of a CAN message shall be:
+// char0: Letter 'C' - start of a CAN message
+// char1: message type = (extended?1:0 << 0) | (RTR?1:0 << 1) | (DLC << 2)
+// char1: ID lower byte
+// char2: ID upper byte
+// char3-10: data bytes (lowest first)
+// lastChar: \n - newline = end of message
+//
+// Extended ID message is the same but with more ID bytes.
+// RTR messages show up as empty messages (no data, DLC=0) but are otherwise indistinguishable.
+
+class CANxbee {
+public:
+ CANxbee(PinName tx, PinName rx, int baud, int txSize, int rxSize);
+
+ bool send(CANMessage &msg); // Send a CANMessage object over the xbee (first converts to serial)
+ bool receive(CANMessage &msg); // Receive a CANMessage object over the xbee (converts from serial message to CAN)
+
+private:
+ MODSERIAL serial;
+ char rxBuff[14];
+ int rx_i;
+ bool building;
+};
+
+#endif
\ No newline at end of file
