diff --git a/right/src/config_parser/config_state.c b/right/src/config_parser/basic_types.c similarity index 66% rename from right/src/config_parser/config_state.c rename to right/src/config_parser/basic_types.c index 3bb01c3..aa1e41c 100644 --- a/right/src/config_parser/config_state.c +++ b/right/src/config_parser/basic_types.c @@ -1,14 +1,4 @@ -#include "config_state.h" - -static uint8_t hardwareConfig[HARDWARE_CONFIG_SIZE]; -config_buffer_t HardwareConfigBuffer = {hardwareConfig}; - -static uint8_t userConfig1[USER_CONFIG_SIZE]; -static uint8_t __attribute__((section (".m_data_2"))) userConfig2[USER_CONFIG_SIZE]; -config_buffer_t UserConfigBuffer = { userConfig1 }; -config_buffer_t StagingUserConfigBuffer = { userConfig2 }; - -bool ParserRunDry; +#include "basic_types.h" uint8_t readUInt8(config_buffer_t *buffer) { return buffer->buffer[buffer->offset++]; diff --git a/right/src/config_parser/config_state.h b/right/src/config_parser/basic_types.h similarity index 54% rename from right/src/config_parser/config_state.h rename to right/src/config_parser/basic_types.h index 84dfd00..3e4897d 100644 --- a/right/src/config_parser/config_state.h +++ b/right/src/config_parser/basic_types.h @@ -1,16 +1,9 @@ -#ifndef __CONFIG_STATE_H__ -#define __CONFIG_STATE_H__ +#ifndef __BASIC_TYPES_H__ +#define __BASIC_TYPES_H__ // Includes: - #include #include "fsl_common.h" - #include "eeprom.h" - -// Macros: - - #define HARDWARE_CONFIG_SIZE 64 - #define USER_CONFIG_SIZE (EEPROM_SIZE - HARDWARE_CONFIG_SIZE) // Typedefs: @@ -19,13 +12,6 @@ uint16_t offset; } config_buffer_t; -// Variables: - - extern bool ParserRunDry; - extern config_buffer_t HardwareConfigBuffer; - extern config_buffer_t UserConfigBuffer; - extern config_buffer_t StagingUserConfigBuffer; - // Functions: uint8_t readUInt8(config_buffer_t *buffer); diff --git a/right/src/config_parser/config_globals.c b/right/src/config_parser/config_globals.c new file mode 100644 index 0000000..6afe018 --- /dev/null +++ b/right/src/config_parser/config_globals.c @@ -0,0 +1,11 @@ +#include "config_globals.h" + +static uint8_t hardwareConfig[HARDWARE_CONFIG_SIZE]; +config_buffer_t HardwareConfigBuffer = {hardwareConfig}; + +static uint8_t userConfig1[USER_CONFIG_SIZE]; +static uint8_t __attribute__((section (".m_data_2"))) userConfig2[USER_CONFIG_SIZE]; +config_buffer_t UserConfigBuffer = { userConfig1 }; +config_buffer_t StagingUserConfigBuffer = { userConfig2 }; + +bool ParserRunDry; diff --git a/right/src/config_parser/config_globals.h b/right/src/config_parser/config_globals.h new file mode 100644 index 0000000..c94862f --- /dev/null +++ b/right/src/config_parser/config_globals.h @@ -0,0 +1,22 @@ +#ifndef __CONFIG_STATE_H__ +#define __CONFIG_STATE_H__ + +// Includes: + + #include "fsl_common.h" + #include "eeprom.h" + #include "basic_types.h" + +// Macros: + + #define HARDWARE_CONFIG_SIZE 64 + #define USER_CONFIG_SIZE (EEPROM_SIZE - HARDWARE_CONFIG_SIZE) + +// Variables: + + extern bool ParserRunDry; + extern config_buffer_t HardwareConfigBuffer; + extern config_buffer_t UserConfigBuffer; + extern config_buffer_t StagingUserConfigBuffer; + +#endif diff --git a/right/src/config_parser/parse_config.c b/right/src/config_parser/parse_config.c index d2b7dad..ea31cff 100644 --- a/right/src/config_parser/parse_config.c +++ b/right/src/config_parser/parse_config.c @@ -2,6 +2,7 @@ #include "parse_keymap.h" #include "parse_macro.h" #include "keymaps.h" +#include "config_globals.h" static parser_error_t parseModuleConfiguration(config_buffer_t *buffer) { uint8_t id = readUInt8(buffer); diff --git a/right/src/config_parser/parse_config.h b/right/src/config_parser/parse_config.h index 117c3a4..b4d203a 100644 --- a/right/src/config_parser/parse_config.h +++ b/right/src/config_parser/parse_config.h @@ -3,7 +3,7 @@ // Includes: - #include "config_state.h" + #include "basic_types.h" // Typedefs: diff --git a/right/src/config_parser/parse_keymap.c b/right/src/config_parser/parse_keymap.c index a78e0b3..da79be0 100644 --- a/right/src/config_parser/parse_keymap.c +++ b/right/src/config_parser/parse_keymap.c @@ -1,3 +1,5 @@ +#include "config_parser/config_globals.h" +#include "config_parser/parse_config.h" #include "config_parser/parse_keymap.h" #include "key_action.h" #include "keymaps.h" diff --git a/right/src/eeprom.c b/right/src/eeprom.c index 638e956..fc0d308 100644 --- a/right/src/eeprom.c +++ b/right/src/eeprom.c @@ -1,5 +1,5 @@ #include "fsl_common.h" -#include "config_parser/config_state.h" +#include "config_parser/config_globals.h" #include "i2c_addresses.h" #include "i2c.h" #include "eeprom.h" diff --git a/right/src/keymaps.c b/right/src/keymaps.c index 535ebfe..1abb508 100644 --- a/right/src/keymaps.c +++ b/right/src/keymaps.c @@ -3,6 +3,7 @@ #include "keymaps.h" #include "led_display.h" #include "config_parser/parse_keymap.h" +#include "config_parser/config_globals.h" // TODO: Restore Ctrl and Super keys and Mod+N. diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index b39cda0..032f23b 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -5,7 +5,7 @@ #include "peripherals/led_driver.h" #include "peripherals/merge_sensor.h" #include "config_parser/parse_config.h" -#include "config_parser/config_state.h" +#include "config_parser/config_globals.h" #include "led_pwm.h" #include "slave_scheduler.h" #include "slave_drivers/uhk_module_driver.h"