Experiment of serial command protocol

Dependencies:   RingBuffer SerialInterfaceProtocol duinotech_16x2_LCD mbed

You can edit this area

Revision:
3:0c4aa3cec685
Parent:
2:54932809c7b2
diff -r 54932809c7b2 -r 0c4aa3cec685 SerialInterfaceProtocol.cpp
--- a/SerialInterfaceProtocol.cpp	Thu Jun 09 12:28:31 2016 +0000
+++ b/SerialInterfaceProtocol.cpp	Thu Jun 16 03:52:01 2016 +0000
@@ -59,10 +59,15 @@
 {
     // prepare for packet buffer
     PacketBuffer.sflag = CommandPacket::CP_SFLAG;
+    
     PacketBuffer.command = 0xE0 | ((uint8_t) PacketBuffer.errno & 0x0f);
+    
     PacketBuffer.length = response_length;
+    
     memcpy(PacketBuffer.payload, response, response_length);
-    PacketBuffer.checksum = generate_checksum(PacketBuffer.payload, PacketBuffer.length),
+    
+    PacketBuffer.checksum = PacketBuffer.generate_checksum();
+    
     PacketBuffer.eflag = CommandPacket::CP_EFLAG;