Libraries to support working with GMLAN - General Motors CAN BUS network in most of their vehicles between 2007-present day. Please note this is a work in progress and not guaranteed to be correct, use at your own risk! Read commit logs / subscribe to see what has been added, it's a work in progress after all ;)

Revision:
4:486fec88517e
Parent:
3:09fdfec053cd
Child:
5:d0b067be6d44
--- a/GMLAN.cpp	Wed Feb 20 20:10:50 2013 +0000
+++ b/GMLAN.cpp	Wed Mar 13 14:50:15 2013 +0000
@@ -22,7 +22,7 @@
     if (_header < 0x800)
     {
         // 11-bit header
-        arbitrationID = _header;
+        arbitrationID = (_header >> 0) & 0x7FF;
     } else {
         // 29-bit header
         priorityID = (_header >> 26) & 0x7;
@@ -37,4 +37,10 @@
     buffer = (buffer << 13) | arbitrationID;
     buffer = (buffer << 13) | senderID;
     return buffer;
+}
+int CANHeader::encode11bit(void) {
+    short int buffer = 0;
+    buffer = (buffer << 5) | 0x0; // 5 bit padding
+    buffer = (buffer << 11) | arbitrationID;
+    return buffer;
 }
\ No newline at end of file