Remove KEY_STATE_SIZE in favor of the more general BOOL_BYTES_TO_BITS_COUNT() macro.

This commit is contained in:
László Monda
2017-09-30 00:57:10 +02:00
parent abc1923897
commit ea71253d6a
4 changed files with 5 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ void SlaveTxHandler(void)
} }
case SlaveCommand_RequestKeyStates: case SlaveCommand_RequestKeyStates:
BoolBytesToBits(keyMatrix.keyStates, TxMessage.data, MODULE_KEY_COUNT); BoolBytesToBits(keyMatrix.keyStates, TxMessage.data, MODULE_KEY_COUNT);
TxMessage.length = KEY_STATE_SIZE; TxMessage.length = BOOL_BYTES_TO_BITS_COUNT(MODULE_KEY_COUNT);
break; break;
} }

View File

@@ -12,8 +12,6 @@
#define PROTOCOL_RESPONSE_SUCCESS 0 #define PROTOCOL_RESPONSE_SUCCESS 0
#define PROTOCOL_RESPONSE_GENERIC_ERROR 1 #define PROTOCOL_RESPONSE_GENERIC_ERROR 1
#define KEY_STATE_SIZE (MODULE_KEY_COUNT/8 + (MODULE_KEY_COUNT % 8 ? 1 : 0))
// Variables: // Variables:
extern i2c_message_t RxMessage; extern i2c_message_t RxMessage;

View File

@@ -9,7 +9,6 @@
// Macros: // Macros:
#define UHK_MODULE_MAX_COUNT 3 #define UHK_MODULE_MAX_COUNT 3
#define KEY_STATE_SIZE (LEFT_KEYBOARD_HALF_KEY_COUNT/8 + (LEFT_KEYBOARD_HALF_KEY_COUNT % 8 ? 1 : 0))
#define MAX_PWM_BRIGHTNESS 0x64 #define MAX_PWM_BRIGHTNESS 0x64
// Typedefs: // Typedefs:

View File

@@ -5,6 +5,10 @@
#include <stdint.h> #include <stdint.h>
// Macros:
#define BOOL_BYTES_TO_BITS_COUNT(BYTE_COUNT) (BYTE_COUNT/8 + (BYTE_COUNT % 8 ? 1 : 0))
// Functions: // Functions:
void BoolBytesToBits(uint8_t *srcBytes, uint8_t *dstBits, uint8_t byteCount); void BoolBytesToBits(uint8_t *srcBytes, uint8_t *dstBits, uint8_t byteCount);