- #READ BACK BUFFER 0 to check what we're about to send out
- data=self.SPItrans([0x03, 0x31,
- 0x00,0x00, #SID
- 0x00,0x00, #EID
- 0x00, #DLC
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- ]);
- print "about to transmit:" + self.packet2str(data[2:len(data)]);
+
+ def simpleParse(self,packet):
+ dataPt = ord(packet[0]);
+ dataPt2 = ord(packet[1]);
+ # check if we have a standard frame, the msb of the second
+ # nibble will be 1. otherwise it is an extended rame
+ stdCheck = dataPt2 & 0x0f
+ if( stdCheck == 16 ):
+ #arb id is first byte + 3 msb of the 2nd byte
+ dataPt = dataPt<<3 | dataPt2>>5
+ print "Standard Packet \n Arb ID: "+("%d"%dataPt)
+ else:
+ #arb id is first byte + 3 msb + 2 lsb of 2nd byte +
+ # 3rd byte + 4th byte
+ dataPt = dataPt<<3 | dataPt2>>5
+ dataPt = dataPt<<2 | (dataPt2 & 0x03)
+ dataPt = dataPt<<8 | ord(packet[2])
+ dataPt = dataPt<<8 | ord(packet[3])
+ print "Extended Data Frame \n Arb ID: "+("%d"%dataPt)