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:
László Monda
2017-07-22 23:49:47 +02:00
parent cbb0a02f19
commit 8ed4a6ba09
8 changed files with 153 additions and 64 deletions

View File

@@ -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++];

View File

@@ -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: