Packing and Unpacking messages
Packing a frame to send
- Build Message
- Calculate CRC
- Add CRC MSB and LSB
- Replace with escape sequences where necessary
- Frame data between a START and END character.
- Send message
Unpacking a received frame
- Unescape: For each incoming byte after START character until END character reached. Replace escape sequences with original byte.
- Calculate CRC
- Verify with received CRC
- Process incoming message