Separate the configuration to hardware configuration and user configuration. Implement async I2C EEPROM handling. Remove USB functions that dealt with EEPROM and individual LEDs because they were dependent on sync I2C functions.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#include "config_state.h"
|
||||
|
||||
config_buffer_t ConfigBuffer;
|
||||
static uint8_t hardwareConfig[HARDWARE_CONFIG_SIZE];
|
||||
config_buffer_t HardwareConfigBuffer = {hardwareConfig};
|
||||
|
||||
static uint8_t userConfig[USER_CONFIG_SIZE];
|
||||
config_buffer_t UserConfigBuffer = {userConfig};
|
||||
|
||||
uint8_t readUInt8(config_buffer_t *buffer) {
|
||||
return buffer->buffer[buffer->offset++];
|
||||
|
||||
@@ -9,17 +9,20 @@
|
||||
// Macros:
|
||||
|
||||
#define EEPROM_SIZE (32*1024)
|
||||
#define HARDWARE_CONFIG_SIZE 64
|
||||
#define USER_CONFIG_SIZE (EEPROM_SIZE - HARDWARE_CONFIG_SIZE)
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef struct {
|
||||
uint8_t buffer[EEPROM_SIZE];
|
||||
uint8_t *buffer;
|
||||
uint16_t offset;
|
||||
} config_buffer_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
extern config_buffer_t ConfigBuffer;
|
||||
extern config_buffer_t HardwareConfigBuffer;
|
||||
extern config_buffer_t UserConfigBuffer;
|
||||
|
||||
// Functions:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user