Verify the integrity of key state update messages using CRC16-CCITT.

This commit is contained in:
László Monda
2017-05-31 03:26:50 +02:00
parent 57319489d2
commit 1e290ebc34
6 changed files with 38 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ void SlaveProtocolHandler(void)
case SlaveCommand_GetKeyStates:
SlaveTxSize = KEY_STATE_BUFFER_SIZE;
BoolBytesToBits(keyMatrix.keyStates, SlaveTxBuffer, LEFT_KEYBOARD_HALF_KEY_COUNT);
CRC16_AppendToMessage(SlaveTxBuffer, KEY_STATE_SIZE);
break;
case SlaveCommand_SetTestLed:
SlaveTxSize = 0;