Serialize key states much more efficiently by using bits instead of bytes.

This commit is contained in:
László Monda
2017-05-31 01:26:16 +02:00
parent 8b69dd7d90
commit 0edd56fa82
4 changed files with 40 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
#include "slave_protocol.h"
#include "main.h"
#include "init_peripherals.h"
#include "bool_array_converter.h"
void SetError(uint8_t error);
void SetGenericError(void);
@@ -33,7 +34,8 @@ void SlaveProtocolHandler(void)
switch (commandId) {
case SlaveCommand_GetKeyStates:
SlaveTxSize = KEYBOARD_MATRIX_COLS_NUM*KEYBOARD_MATRIX_ROWS_NUM;
memcpy(SlaveTxBuffer, keyMatrix.keyStates, SlaveTxSize);
BoolBytesToBits(keyMatrix.keyStates, SlaveTxBuffer, SlaveTxSize);
// memcpy(SlaveTxBuffer, keyMatrix.keyStates, SlaveTxSize);
break;
case SlaveCommand_SetTestLed:
SlaveTxSize = 0;