Add i2c_message_t and use it all across the codebase. This will allow handling variable-length I2C messages and validation with minimal effort. The test LED and brightness PWM update features got temporarily broken and will fix them soon.

This commit is contained in:
László Monda
2017-09-25 03:03:14 +02:00
parent ef9d9ee9a7
commit b88c6e4291
11 changed files with 93 additions and 60 deletions

View File

@@ -5,24 +5,20 @@
#include "fsl_port.h"
#include "crc16.h"
#include "slave_protocol.h"
// Macros:
#define SLAVE_RX_BUFFER_SIZE 100
#define SLAVE_TX_BUFFER_SIZE 100
#define PROTOCOL_RESPONSE_SUCCESS 0
#define PROTOCOL_RESPONSE_GENERIC_ERROR 1
#define LEFT_KEYBOARD_HALF_KEY_COUNT (KEYBOARD_MATRIX_COLS_NUM*KEYBOARD_MATRIX_ROWS_NUM)
#define KEY_STATE_SIZE (LEFT_KEYBOARD_HALF_KEY_COUNT/8 + 1)
#define KEY_STATE_BUFFER_SIZE (KEY_STATE_SIZE + CRC16_HASH_LENGTH)
// Variables:
uint8_t SlaveRxBuffer[SLAVE_RX_BUFFER_SIZE];
uint8_t SlaveTxBuffer[SLAVE_TX_BUFFER_SIZE];
uint8_t SlaveTxSize;
extern i2c_message_t rxMessage;
extern i2c_message_t txMessage;
// Functions: