diff --git a/right/src/config/config_state.c b/right/src/config/config_state.c index 38624f5..812dcfa 100644 --- a/right/src/config/config_state.c +++ b/right/src/config/config_state.c @@ -7,9 +7,9 @@ uint8_t readUInt8(config_buffer_t *buffer) { } uint16_t readUInt16(config_buffer_t *buffer) { - uint16_t uInt16 = *(uint16_t *)(buffer->buffer + buffer->offset); + uint16_t uInt16 = readUInt8(buffer); - buffer->offset += 2; + uInt16 |= readUInt8(buffer) << 8; return uInt16; } @@ -27,7 +27,7 @@ const char *readString(config_buffer_t *buffer, uint16_t *len) { const char *string; *len = readCompactLength(buffer); - string = buffer->buffer + buffer->offset; + string = (const char *)(buffer->buffer + buffer->offset); buffer->offset += *len; return string; } diff --git a/right/src/config/config_state.h b/right/src/config/config_state.h index 47c4a69..d741be1 100644 --- a/right/src/config/config_state.h +++ b/right/src/config/config_state.h @@ -13,7 +13,7 @@ // Typedefs: typedef struct { - uint8_t const buffer[EEPROM_SIZE]; + uint8_t buffer[EEPROM_SIZE]; uint16_t offset; } config_buffer_t;