mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-02-17 18:16:53 +00:00
convert api to structs/unions
This commit is contained in:
parent
4d46e95ea8
commit
2c3af2bfa8
@ -45,4 +45,4 @@
|
||||
// And if VIA isn't enabled, fall back to using standard QMK for configuration
|
||||
#ifndef VIA_ENABLE
|
||||
#define EECONFIG_KB_DATA_SIZE VIA_EEPROM_CUSTOM_CONFIG_SIZE
|
||||
#endif
|
||||
#endif
|
||||
|
@ -219,7 +219,7 @@ bool is_oneshot_layer_active(void) {
|
||||
void oneshot_set(bool active) {
|
||||
if (keymap_config.oneshot_enable != active) {
|
||||
keymap_config.oneshot_enable = active;
|
||||
eeconfig_update_keymap(keymap_config.raw);
|
||||
eeconfig_update_keymap(&keymap_config);
|
||||
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
|
||||
dprintf("Oneshot: active: %d\n", active);
|
||||
}
|
||||
|
@ -149,14 +149,14 @@ void audio_driver_start(void) {
|
||||
}
|
||||
|
||||
void eeconfig_update_audio_current(void) {
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
eeconfig_update_audio(&audio_config);
|
||||
}
|
||||
|
||||
void eeconfig_update_audio_default(void) {
|
||||
audio_config.valid = true;
|
||||
audio_config.enable = AUDIO_DEFAULT_ON;
|
||||
audio_config.clicky_enable = AUDIO_DEFAULT_CLICKY_ON;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
eeconfig_update_audio(&audio_config);
|
||||
}
|
||||
|
||||
void audio_init(void) {
|
||||
@ -164,7 +164,7 @@ void audio_init(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
audio_config.raw = eeconfig_read_audio();
|
||||
eeconfig_read_audio(&audio_config);
|
||||
if (!audio_config.valid) {
|
||||
dprintf("audio_init audio_config.valid = 0. Write default values to EEPROM.\n");
|
||||
eeconfig_update_audio_default();
|
||||
@ -196,7 +196,7 @@ void audio_toggle(void) {
|
||||
stop_all_notes();
|
||||
}
|
||||
audio_config.enable ^= 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
eeconfig_update_audio(&audio_config);
|
||||
if (audio_config.enable) {
|
||||
audio_on_user();
|
||||
} else {
|
||||
@ -206,7 +206,7 @@ void audio_toggle(void) {
|
||||
|
||||
void audio_on(void) {
|
||||
audio_config.enable = 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
eeconfig_update_audio(&audio_config);
|
||||
audio_on_user();
|
||||
PLAY_SONG(audio_on_song);
|
||||
}
|
||||
@ -217,7 +217,7 @@ void audio_off(void) {
|
||||
wait_ms(100);
|
||||
audio_stop_all();
|
||||
audio_config.enable = 0;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
eeconfig_update_audio(&audio_config);
|
||||
}
|
||||
|
||||
bool audio_is_on(void) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
# include "audio_dac.h"
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
typedef union audio_config_t {
|
||||
uint8_t raw;
|
||||
struct {
|
||||
bool enable : 1;
|
||||
|
@ -54,7 +54,7 @@ static void backlight_check_config(void) {
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void backlight_init(void) {
|
||||
backlight_config.raw = eeconfig_read_backlight();
|
||||
eeconfig_read_backlight(&backlight_config);
|
||||
if (!backlight_config.valid) {
|
||||
dprintf("backlight_init backlight_config.valid = 0. Write default values to EEPROM.\n");
|
||||
eeconfig_update_backlight_default();
|
||||
@ -73,7 +73,7 @@ void backlight_increase(void) {
|
||||
backlight_config.level++;
|
||||
}
|
||||
backlight_config.enable = 1;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
dprintf("backlight increase: %u\n", backlight_config.level);
|
||||
backlight_set(backlight_config.level);
|
||||
}
|
||||
@ -86,7 +86,7 @@ void backlight_decrease(void) {
|
||||
if (backlight_config.level > 0) {
|
||||
backlight_config.level--;
|
||||
backlight_config.enable = !!backlight_config.level;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
}
|
||||
dprintf("backlight decrease: %u\n", backlight_config.level);
|
||||
backlight_set(backlight_config.level);
|
||||
@ -115,7 +115,7 @@ void backlight_enable(void) {
|
||||
backlight_config.enable = true;
|
||||
if (backlight_config.raw == 1) // enabled but level == 0
|
||||
backlight_config.level = 1;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
dprintf("backlight enable\n");
|
||||
backlight_set(backlight_config.level);
|
||||
}
|
||||
@ -128,7 +128,7 @@ void backlight_disable(void) {
|
||||
if (!backlight_config.enable) return; // do nothing if backlight is already off
|
||||
|
||||
backlight_config.enable = false;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
dprintf("backlight disable\n");
|
||||
backlight_set(0);
|
||||
}
|
||||
@ -151,7 +151,7 @@ void backlight_step(void) {
|
||||
backlight_config.level = 0;
|
||||
}
|
||||
backlight_config.enable = !!backlight_config.level;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
dprintf("backlight step: %u\n", backlight_config.level);
|
||||
backlight_set(backlight_config.level);
|
||||
}
|
||||
@ -172,11 +172,11 @@ void backlight_level_noeeprom(uint8_t level) {
|
||||
*/
|
||||
void backlight_level(uint8_t level) {
|
||||
backlight_level_noeeprom(level);
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
}
|
||||
|
||||
void eeconfig_update_backlight_current(void) {
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
}
|
||||
|
||||
void eeconfig_update_backlight_default(void) {
|
||||
@ -184,7 +184,7 @@ void eeconfig_update_backlight_default(void) {
|
||||
backlight_config.enable = BACKLIGHT_DEFAULT_ON;
|
||||
backlight_config.breathing = BACKLIGHT_DEFAULT_BREATHING;
|
||||
backlight_config.level = BACKLIGHT_DEFAULT_LEVEL;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
}
|
||||
|
||||
/** \brief Get backlight level
|
||||
@ -217,7 +217,7 @@ void backlight_enable_breathing(void) {
|
||||
if (backlight_config.breathing) return; // do nothing if breathing is already on
|
||||
|
||||
backlight_config.breathing = true;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
dprintf("backlight breathing enable\n");
|
||||
breathing_enable();
|
||||
}
|
||||
@ -230,7 +230,7 @@ void backlight_disable_breathing(void) {
|
||||
if (!backlight_config.breathing) return; // do nothing if breathing is already off
|
||||
|
||||
backlight_config.breathing = false;
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
eeconfig_update_backlight(&backlight_config);
|
||||
dprintf("backlight breathing disable\n");
|
||||
breathing_disable();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# define BREATHING_PERIOD 6
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
typedef union backlight_config_t {
|
||||
uint8_t raw;
|
||||
struct {
|
||||
bool enable : 1;
|
||||
@ -58,10 +58,8 @@ void backlight_level_noeeprom(uint8_t level);
|
||||
void backlight_level(uint8_t level);
|
||||
uint8_t get_backlight_level(void);
|
||||
|
||||
uint8_t eeconfig_read_backlight(void);
|
||||
void eeconfig_update_backlight(uint8_t val);
|
||||
void eeconfig_update_backlight_current(void);
|
||||
void eeconfig_update_backlight_default(void);
|
||||
void eeconfig_update_backlight_current(void);
|
||||
void eeconfig_update_backlight_default(void);
|
||||
|
||||
// implementation specific
|
||||
void backlight_init_ports(void);
|
||||
|
@ -295,7 +295,7 @@ static void print_eeconfig(void) {
|
||||
# ifdef BACKLIGHT_ENABLE
|
||||
|
||||
backlight_config_t bc;
|
||||
bc.raw = eeconfig_read_backlight();
|
||||
eeconfig_read_backlight(&bc);
|
||||
xprintf(/* clang-format off */
|
||||
"backlight_config"
|
||||
|
||||
|
@ -5,11 +5,16 @@
|
||||
#include "eeconfig.h"
|
||||
#include "action_layer.h"
|
||||
#include "nvm_eeconfig.h"
|
||||
#include "keycode_config.h"
|
||||
|
||||
#ifdef EEPROM_DRIVER
|
||||
# include "eeprom_driver.h"
|
||||
#endif // EEPROM_DRIVER
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# include "rgblight.h"
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
|
||||
#ifdef HAPTIC_ENABLE
|
||||
# include "haptic.h"
|
||||
#endif // HAPTIC_ENABLE
|
||||
@ -45,8 +50,23 @@ void eeconfig_init_quantum(void) {
|
||||
eeconfig_update_debug(0);
|
||||
default_layer_state = (layer_state_t)1 << 0;
|
||||
eeconfig_update_default_layer(default_layer_state);
|
||||
// Enable oneshot and autocorrect by default: 0b0001 0100 0000 0000
|
||||
eeconfig_update_keymap(0x1400);
|
||||
|
||||
keymap_config_t keymap_config = {
|
||||
.swap_control_capslock = false,
|
||||
.capslock_to_control = false,
|
||||
.swap_lalt_lgui = false,
|
||||
.swap_ralt_rgui = false,
|
||||
.no_gui = false,
|
||||
.swap_grave_esc = false,
|
||||
.swap_backslash_backspace = false,
|
||||
.nkro = false,
|
||||
.swap_lctl_lgui = false,
|
||||
.swap_rctl_rgui = false,
|
||||
.oneshot_enable = true, // Enable oneshot by default
|
||||
.swap_escape_capslock = false,
|
||||
.autocorrect_enable = true, // Enable autocorrect by default
|
||||
};
|
||||
eeconfig_update_keymap(&keymap_config);
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
eeconfig_update_backlight(0);
|
||||
@ -135,11 +155,11 @@ bool eeconfig_is_disabled(void) {
|
||||
return is_eeprom_disabled;
|
||||
}
|
||||
|
||||
uint8_t eeconfig_read_debug(void) {
|
||||
return nvm_eeconfig_read_debug();
|
||||
void eeconfig_read_debug(debug_config_t *debug_config) {
|
||||
nvm_eeconfig_read_debug(debug_config);
|
||||
}
|
||||
void eeconfig_update_debug(uint8_t val) {
|
||||
nvm_eeconfig_update_debug(val);
|
||||
void eeconfig_update_debug(const debug_config_t *debug_config) {
|
||||
nvm_eeconfig_update_debug(debug_config);
|
||||
}
|
||||
|
||||
uint8_t eeconfig_read_default_layer(void) {
|
||||
@ -149,37 +169,37 @@ void eeconfig_update_default_layer(uint8_t val) {
|
||||
nvm_eeconfig_update_default_layer(val);
|
||||
}
|
||||
|
||||
uint16_t eeconfig_read_keymap(void) {
|
||||
return nvm_eeconfig_read_keymap();
|
||||
void eeconfig_read_keymap(keymap_config_t *keymap_config) {
|
||||
nvm_eeconfig_read_keymap(keymap_config);
|
||||
}
|
||||
void eeconfig_update_keymap(uint16_t val) {
|
||||
nvm_eeconfig_update_keymap(val);
|
||||
void eeconfig_update_keymap(const keymap_config_t *keymap_config) {
|
||||
nvm_eeconfig_update_keymap(keymap_config);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
uint8_t eeconfig_read_audio(void) {
|
||||
return nvm_eeconfig_read_audio();
|
||||
void eeconfig_read_audio(audio_config_t *audio_config) {
|
||||
nvm_eeconfig_read_audio(audio_config);
|
||||
}
|
||||
void eeconfig_update_audio(uint8_t val) {
|
||||
nvm_eeconfig_update_audio(val);
|
||||
void eeconfig_update_audio(const audio_config_t *audio_config) {
|
||||
nvm_eeconfig_update_audio(audio_config);
|
||||
}
|
||||
#endif // AUDIO_ENABLE
|
||||
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
uint8_t eeconfig_read_unicode_mode(void) {
|
||||
return nvm_eeconfig_read_unicode_mode();
|
||||
void eeconfig_read_unicode_mode(unicode_config_t *unicode_config) {
|
||||
return nvm_eeconfig_read_unicode_mode(unicode_config);
|
||||
}
|
||||
void eeconfig_update_unicode_mode(uint8_t val) {
|
||||
nvm_eeconfig_update_unicode_mode(val);
|
||||
void eeconfig_update_unicode_mode(const unicode_config_t *unicode_config) {
|
||||
nvm_eeconfig_update_unicode_mode(unicode_config);
|
||||
}
|
||||
#endif // UNICODE_COMMON_ENABLE
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
uint8_t eeconfig_read_backlight(void) {
|
||||
return nvm_eeconfig_read_backlight();
|
||||
void eeconfig_read_backlight(backlight_config_t *backlight_config) {
|
||||
nvm_eeconfig_read_backlight(backlight_config);
|
||||
}
|
||||
void eeconfig_update_backlight(uint8_t val) {
|
||||
nvm_eeconfig_update_backlight(val);
|
||||
void eeconfig_update_backlight(const backlight_config_t *backlight_config) {
|
||||
nvm_eeconfig_update_backlight(backlight_config);
|
||||
}
|
||||
#endif // BACKLIGHT_ENABLE
|
||||
|
||||
|
@ -21,18 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h> // offsetof
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# include "rgb_matrix_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
# include "led_matrix_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# include "rgblight.h"
|
||||
#endif
|
||||
|
||||
// Size of EEPROM dedicated to keyboard- and user-specific data
|
||||
#ifndef EECONFIG_KB_DATA_SIZE
|
||||
# define EECONFIG_KB_DATA_SIZE 0
|
||||
@ -74,28 +62,33 @@ void eeconfig_init_user(void);
|
||||
void eeconfig_enable(void);
|
||||
void eeconfig_disable(void);
|
||||
|
||||
uint8_t eeconfig_read_debug(void);
|
||||
void eeconfig_update_debug(uint8_t val);
|
||||
typedef union debug_config_t debug_config_t;
|
||||
void eeconfig_read_debug(debug_config_t *debug_config);
|
||||
void eeconfig_update_debug(const debug_config_t *debug_config);
|
||||
|
||||
uint8_t eeconfig_read_default_layer(void);
|
||||
void eeconfig_update_default_layer(uint8_t val);
|
||||
|
||||
uint16_t eeconfig_read_keymap(void);
|
||||
void eeconfig_update_keymap(uint16_t val);
|
||||
typedef union keymap_config_t keymap_config_t;
|
||||
void eeconfig_read_keymap(keymap_config_t *keymap_config);
|
||||
void eeconfig_update_keymap(const keymap_config_t *keymap_config);
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
uint8_t eeconfig_read_audio(void);
|
||||
void eeconfig_update_audio(uint8_t val);
|
||||
typedef union audio_config_t audio_config_t;
|
||||
void eeconfig_read_audio(audio_config_t *audio_config);
|
||||
void eeconfig_update_audio(const audio_config_t *audio_config);
|
||||
#endif // AUDIO_ENABLE
|
||||
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
uint8_t eeconfig_read_unicode_mode(void);
|
||||
void eeconfig_update_unicode_mode(uint8_t val);
|
||||
typedef union unicode_config_t unicode_config_t;
|
||||
void eeconfig_read_unicode_mode(unicode_config_t *unicode_config);
|
||||
void eeconfig_update_unicode_mode(const unicode_config_t *unicode_config);
|
||||
#endif // UNICODE_COMMON_ENABLE
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
uint8_t eeconfig_read_backlight(void);
|
||||
void eeconfig_update_backlight(uint8_t val);
|
||||
typedef union backlight_config_t backlight_config_t;
|
||||
void eeconfig_read_backlight(backlight_config_t *backlight_config);
|
||||
void eeconfig_update_backlight(const backlight_config_t *backlight_config);
|
||||
#endif // BACKLIGHT_ENABLE
|
||||
|
||||
#ifdef STENO_ENABLE
|
||||
@ -104,18 +97,21 @@ void eeconfig_update_steno_mode(uint8_t val);
|
||||
#endif // STENO_ENABLE
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void eeconfig_read_rgb_matrix(rgb_config_t *rgb_matrix_config);
|
||||
void eeconfig_update_rgb_matrix(const rgb_config_t *rgb_matrix_config);
|
||||
typedef struct rgb_config_t rgb_config_t;
|
||||
void eeconfig_read_rgb_matrix(rgb_config_t *rgb_matrix_config);
|
||||
void eeconfig_update_rgb_matrix(const rgb_config_t *rgb_matrix_config);
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
void eeconfig_read_led_matrix(led_eeconfig_t *led_matrix_config);
|
||||
void eeconfig_update_led_matrix(const led_eeconfig_t *led_matrix_config);
|
||||
typedef struct led_eeconfig_t led_eeconfig_t;
|
||||
void eeconfig_read_led_matrix(led_eeconfig_t *led_matrix_config);
|
||||
void eeconfig_update_led_matrix(const led_eeconfig_t *led_matrix_config);
|
||||
#endif // LED_MATRIX_ENABLE
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
void eeconfig_read_rgblight(rgblight_config_t *rgblight_config);
|
||||
void eeconfig_update_rgblight(const rgblight_config_t *rgblight_config);
|
||||
typedef union rgblight_config_t rgblight_config_t;
|
||||
void eeconfig_read_rgblight(rgblight_config_t *rgblight_config);
|
||||
void eeconfig_update_rgblight(const rgblight_config_t *rgblight_config);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
|
||||
#if (EECONFIG_KB_DATA_SIZE) == 0
|
||||
|
@ -386,8 +386,8 @@ void quantum_init(void) {
|
||||
}
|
||||
|
||||
/* init globals */
|
||||
debug_config.raw = eeconfig_read_debug();
|
||||
keymap_config.raw = eeconfig_read_keymap();
|
||||
eeconfig_read_debug(&debug_config);
|
||||
eeconfig_read_keymap(&keymap_config);
|
||||
|
||||
#ifdef BOOTMAGIC_ENABLE
|
||||
bootmagic();
|
||||
|
@ -28,7 +28,7 @@ uint16_t keycode_config(uint16_t keycode);
|
||||
uint8_t mod_config(uint8_t mod);
|
||||
|
||||
/* NOTE: Not portable. Bit field order depends on implementation */
|
||||
typedef union {
|
||||
typedef union keymap_config_t {
|
||||
uint16_t raw;
|
||||
struct {
|
||||
bool swap_control_capslock : 1;
|
||||
|
@ -28,7 +28,7 @@ extern "C" {
|
||||
/*
|
||||
* Debug output control
|
||||
*/
|
||||
typedef union {
|
||||
typedef union debug_config_t {
|
||||
struct {
|
||||
bool enable : 1;
|
||||
bool matrix : 1;
|
||||
|
@ -5,12 +5,38 @@
|
||||
#include "nvm_eeprom_eeconfig_internal.h"
|
||||
#include "util.h"
|
||||
#include "eeconfig.h"
|
||||
#include "debug.h"
|
||||
#include "eeprom.h"
|
||||
#include "keycode_config.h"
|
||||
|
||||
#if defined(EEPROM_DRIVER)
|
||||
#ifdef EEPROM_DRIVER
|
||||
# include "eeprom_driver.h"
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
# include "audio.h"
|
||||
#endif
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
# include "backlight.h"
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# include "rgblight.h"
|
||||
#endif
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# include "rgb_matrix_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
# include "led_matrix_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
# include "unicode.h"
|
||||
#endif
|
||||
|
||||
bool nvm_eeconfig_is_enabled(void) {
|
||||
return eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER;
|
||||
}
|
||||
@ -30,11 +56,11 @@ void nvm_eeconfig_disable(void) {
|
||||
eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER_OFF);
|
||||
}
|
||||
|
||||
uint8_t nvm_eeconfig_read_debug(void) {
|
||||
return eeprom_read_byte(EECONFIG_DEBUG);
|
||||
void nvm_eeconfig_read_debug(debug_config_t *debug_config) {
|
||||
debug_config->raw = eeprom_read_byte(EECONFIG_DEBUG);
|
||||
}
|
||||
void nvm_eeconfig_update_debug(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_DEBUG, val);
|
||||
void nvm_eeconfig_update_debug(const debug_config_t *debug_config) {
|
||||
eeprom_update_byte(EECONFIG_DEBUG, debug_config->raw);
|
||||
}
|
||||
|
||||
uint8_t nvm_eeconfig_read_default_layer(void) {
|
||||
@ -44,37 +70,37 @@ void nvm_eeconfig_update_default_layer(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val);
|
||||
}
|
||||
|
||||
uint16_t nvm_eeconfig_read_keymap(void) {
|
||||
return eeprom_read_word(EECONFIG_KEYMAP);
|
||||
void nvm_eeconfig_read_keymap(keymap_config_t *keymap_config) {
|
||||
keymap_config->raw = eeprom_read_word(EECONFIG_KEYMAP);
|
||||
}
|
||||
void nvm_eeconfig_update_keymap(uint16_t val) {
|
||||
eeprom_update_word(EECONFIG_KEYMAP, val);
|
||||
void nvm_eeconfig_update_keymap(const keymap_config_t *keymap_config) {
|
||||
eeprom_update_word(EECONFIG_KEYMAP, keymap_config->raw);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
uint8_t nvm_eeconfig_read_audio(void) {
|
||||
return eeprom_read_byte(EECONFIG_AUDIO);
|
||||
void nvm_eeconfig_read_audio(audio_config_t *audio_config) {
|
||||
audio_config->raw = eeprom_read_byte(EECONFIG_AUDIO);
|
||||
}
|
||||
void nvm_eeconfig_update_audio(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_AUDIO, val);
|
||||
void nvm_eeconfig_update_audio(const audio_config_t *audio_config) {
|
||||
eeprom_update_byte(EECONFIG_AUDIO, audio_config->raw);
|
||||
}
|
||||
#endif // AUDIO_ENABLE
|
||||
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
uint8_t nvm_eeconfig_read_unicode_mode(void) {
|
||||
return eeprom_read_byte(EECONFIG_UNICODEMODE);
|
||||
void nvm_eeconfig_read_unicode_mode(unicode_config_t *unicode_config) {
|
||||
unicode_config->raw = eeprom_read_byte(EECONFIG_UNICODEMODE);
|
||||
}
|
||||
void nvm_eeconfig_update_unicode_mode(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_UNICODEMODE, val);
|
||||
void nvm_eeconfig_update_unicode_mode(const unicode_config_t *unicode_config) {
|
||||
eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config->raw);
|
||||
}
|
||||
#endif // UNICODE_COMMON_ENABLE
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
uint8_t nvm_eeconfig_read_backlight(void) {
|
||||
return eeprom_read_byte(EECONFIG_BACKLIGHT);
|
||||
void nvm_eeconfig_read_backlight(backlight_config_t *backlight_config) {
|
||||
backlight_config->raw = eeprom_read_byte(EECONFIG_BACKLIGHT);
|
||||
}
|
||||
void nvm_eeconfig_update_backlight(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_BACKLIGHT, val);
|
||||
void nvm_eeconfig_update_backlight(const backlight_config_t *backlight_config) {
|
||||
eeprom_update_byte(EECONFIG_BACKLIGHT, backlight_config->raw);
|
||||
}
|
||||
#endif // BACKLIGHT_ENABLE
|
||||
|
||||
|
@ -5,46 +5,39 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# include "rgb_matrix_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
# include "led_matrix_types.h"
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# include "rgblight.h"
|
||||
#endif
|
||||
|
||||
bool nvm_eeconfig_is_enabled(void);
|
||||
bool nvm_eeconfig_is_disabled(void);
|
||||
|
||||
void nvm_eeconfig_enable(void);
|
||||
void nvm_eeconfig_disable(void);
|
||||
|
||||
uint8_t nvm_eeconfig_read_debug(void);
|
||||
void nvm_eeconfig_update_debug(uint8_t val);
|
||||
typedef union debug_config_t debug_config_t;
|
||||
void nvm_eeconfig_read_debug(debug_config_t *debug_config);
|
||||
void nvm_eeconfig_update_debug(const debug_config_t *debug_config);
|
||||
|
||||
uint8_t nvm_eeconfig_read_default_layer(void);
|
||||
void nvm_eeconfig_update_default_layer(uint8_t val);
|
||||
|
||||
uint16_t nvm_eeconfig_read_keymap(void);
|
||||
void nvm_eeconfig_update_keymap(uint16_t val);
|
||||
typedef union keymap_config_t keymap_config_t;
|
||||
void nvm_eeconfig_read_keymap(keymap_config_t *keymap_config);
|
||||
void nvm_eeconfig_update_keymap(const keymap_config_t *keymap_config);
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
uint8_t nvm_eeconfig_read_audio(void);
|
||||
void nvm_eeconfig_update_audio(uint8_t val);
|
||||
typedef union audio_config_t audio_config_t;
|
||||
void nvm_eeconfig_read_audio(audio_config_t *audio_config);
|
||||
void nvm_eeconfig_update_audio(const audio_config_t *audio_config);
|
||||
#endif // AUDIO_ENABLE
|
||||
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
uint8_t nvm_eeconfig_read_unicode_mode(void);
|
||||
void nvm_eeconfig_update_unicode_mode(uint8_t val);
|
||||
typedef union unicode_config_t unicode_config_t;
|
||||
void nvm_eeconfig_read_unicode_mode(unicode_config_t *unicode_config);
|
||||
void nvm_eeconfig_update_unicode_mode(const unicode_config_t *unicode_config);
|
||||
#endif // UNICODE_COMMON_ENABLE
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
uint8_t nvm_eeconfig_read_backlight(void);
|
||||
void nvm_eeconfig_update_backlight(uint8_t val);
|
||||
typedef union backlight_config_t backlight_config_t;
|
||||
void nvm_eeconfig_read_backlight(backlight_config_t *backlight_config);
|
||||
void nvm_eeconfig_update_backlight(const backlight_config_t *backlight_config);
|
||||
#endif // BACKLIGHT_ENABLE
|
||||
|
||||
#ifdef STENO_ENABLE
|
||||
@ -53,18 +46,21 @@ void nvm_eeconfig_update_steno_mode(uint8_t val);
|
||||
#endif // STENO_ENABLE
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void nvm_eeconfig_read_rgb_matrix(rgb_config_t *rgb_matrix_config);
|
||||
void nvm_eeconfig_update_rgb_matrix(const rgb_config_t *rgb_matrix_config);
|
||||
typedef struct rgb_config_t rgb_config_t;
|
||||
void nvm_eeconfig_read_rgb_matrix(rgb_config_t *rgb_matrix_config);
|
||||
void nvm_eeconfig_update_rgb_matrix(const rgb_config_t *rgb_matrix_config);
|
||||
#endif
|
||||
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
void nvm_eeconfig_read_led_matrix(led_eeconfig_t *led_matrix_config);
|
||||
void nvm_eeconfig_update_led_matrix(const led_eeconfig_t *led_matrix_config);
|
||||
typedef struct led_eeconfig_t led_eeconfig_t;
|
||||
void nvm_eeconfig_read_led_matrix(led_eeconfig_t *led_matrix_config);
|
||||
void nvm_eeconfig_update_led_matrix(const led_eeconfig_t *led_matrix_config);
|
||||
#endif // LED_MATRIX_ENABLE
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
void nvm_eeconfig_read_rgblight(rgblight_config_t *rgblight_config);
|
||||
void nvm_eeconfig_update_rgblight(const rgblight_config_t *rgblight_config);
|
||||
typedef union rgblight_config_t rgblight_config_t;
|
||||
void nvm_eeconfig_read_rgblight(rgblight_config_t *rgblight_config);
|
||||
void nvm_eeconfig_update_rgblight(const rgblight_config_t *rgblight_config);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
|
||||
#if (EECONFIG_KB_DATA_SIZE) == 0
|
||||
|
@ -43,6 +43,9 @@ void slave_update_detected_host_os(os_variant_t os);
|
||||
#endif
|
||||
|
||||
#ifdef OS_DETECTION_DEBUG_ENABLE
|
||||
# if defined(DYNAMIC_KEYMAP_ENABLE) || defined(VIA_ENABLE)
|
||||
# error Cannot enable OS Detection debug mode simultaneously with DYNAMIC_KEYMAP or VIA
|
||||
# endif
|
||||
void print_stored_setups(void);
|
||||
void store_setups_in_eeprom(void);
|
||||
#endif
|
||||
|
@ -47,7 +47,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
if (IS_MAGIC_KEYCODE(keycode)) {
|
||||
/* keymap config */
|
||||
keymap_config.raw = eeconfig_read_keymap();
|
||||
eeconfig_read_keymap(&keymap_config);
|
||||
switch (keycode) {
|
||||
case QK_MAGIC_SWAP_CONTROL_CAPS_LOCK:
|
||||
keymap_config.swap_control_capslock = true;
|
||||
@ -187,7 +187,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||
break;
|
||||
}
|
||||
|
||||
eeconfig_update_keymap(keymap_config.raw);
|
||||
eeconfig_update_keymap(&keymap_config);
|
||||
clear_keyboard(); // clear to prevent stuck keys
|
||||
|
||||
return false;
|
||||
|
@ -248,7 +248,7 @@ extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM;
|
||||
extern const uint8_t RGBLED_TWINKLE_INTERVALS[3] PROGMEM;
|
||||
extern bool is_rgblight_initialized;
|
||||
|
||||
typedef union {
|
||||
typedef union rgblight_config_t {
|
||||
uint64_t raw;
|
||||
struct {
|
||||
bool enable : 1;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* \{
|
||||
*/
|
||||
|
||||
typedef union {
|
||||
typedef union unicode_config_t {
|
||||
uint8_t raw;
|
||||
struct {
|
||||
uint8_t input_mode : 8;
|
||||
|
@ -45,7 +45,7 @@ void TestFixture::SetUpTestCase() {
|
||||
|
||||
// The following is enough to bootstrap the values set in main
|
||||
eeconfig_init_quantum();
|
||||
eeconfig_update_debug(debug_config.raw);
|
||||
eeconfig_update_debug(&debug_config);
|
||||
|
||||
TestDriver driver;
|
||||
keyboard_init();
|
||||
|
Loading…
Reference in New Issue
Block a user