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

@@ -3,6 +3,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "slave_protocol.h"
#define CRC16_HASH_LENGTH 2 // bytes
@@ -25,7 +26,7 @@ void crc16_update(crc16_data_t *crc16Config, const uint8_t *src, uint32_t length
//! @param hash Pointer to the value returned for the final calculated crc value.
void crc16_finalize(crc16_data_t *crc16Config, uint16_t *hash);
void CRC16_AppendToMessage(uint8_t *message, uint32_t lengthInBytes);
bool CRC16_IsMessageValid(uint8_t *message, uint32_t lengthInBytes);
void CRC16_UpdateMessageChecksum(i2c_message_t *message);
bool CRC16_IsMessageValid(i2c_message_t *message);
#endif