diff --git a/keyboards/akko/5087/5087.c b/keyboards/akko/5087/5087.c index 746a9a78161..75dea14625e 100644 --- a/keyboards/akko/5087/5087.c +++ b/keyboards/akko/5087/5087.c @@ -164,7 +164,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { if (record->event.pressed) { set_single_persistent_default_layer(MAC_B); keymap_config.no_gui = 0; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; case RGB_TOG: diff --git a/keyboards/contra/keymaps/default/keymap.c b/keyboards/contra/keymaps/default/keymap.c index 29f98033d61..06e96caafad 100644 --- a/keyboards/contra/keymaps/default/keymap.c +++ b/keyboards/contra/keymaps/default/keymap.c @@ -240,9 +240,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; break; diff --git a/keyboards/dm9records/plaid/keymaps/default/keymap.c b/keyboards/dm9records/plaid/keymaps/default/keymap.c index 2b366f49309..42b5a297559 100644 --- a/keyboards/dm9records/plaid/keymaps/default/keymap.c +++ b/keyboards/dm9records/plaid/keymaps/default/keymap.c @@ -329,9 +329,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; break; diff --git a/keyboards/handwired/ortho_brass/keymaps/default/keymap.c b/keyboards/handwired/ortho_brass/keymaps/default/keymap.c index d5ab0ba3985..e4690385c9e 100644 --- a/keyboards/handwired/ortho_brass/keymaps/default/keymap.c +++ b/keyboards/handwired/ortho_brass/keymaps/default/keymap.c @@ -199,9 +199,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; break; diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c index ded22bbe933..7502ad0552f 100644 --- a/keyboards/helix/rev2/rev2.c +++ b/keyboards/helix/rev2/rev2.c @@ -32,7 +32,7 @@ void set_mac_mode_kb(bool macmode) { * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81 */ keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = !macmode; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } void matrix_init_kb(void) { diff --git a/keyboards/helix/rev3_4rows/rev3_4rows.c b/keyboards/helix/rev3_4rows/rev3_4rows.c index ff61027a961..7f655b6852d 100644 --- a/keyboards/helix/rev3_4rows/rev3_4rows.c +++ b/keyboards/helix/rev3_4rows/rev3_4rows.c @@ -27,7 +27,7 @@ void set_mac_mode(bool macmode) { * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81 */ keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = !macmode; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } #ifdef DIP_SWITCH_ENABLE diff --git a/keyboards/helix/rev3_5rows/rev3_5rows.c b/keyboards/helix/rev3_5rows/rev3_5rows.c index 28fa314a7ba..af7276a2b52 100644 --- a/keyboards/helix/rev3_5rows/rev3_5rows.c +++ b/keyboards/helix/rev3_5rows/rev3_5rows.c @@ -27,7 +27,7 @@ void set_mac_mode(bool macmode) { * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81 */ keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = !macmode; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } #ifdef DIP_SWITCH_ENABLE diff --git a/keyboards/inland/kb83/kb83.c b/keyboards/inland/kb83/kb83.c index 65093a3c383..76738144d2c 100644 --- a/keyboards/inland/kb83/kb83.c +++ b/keyboards/inland/kb83/kb83.c @@ -317,7 +317,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } if(active){ keymap_config.no_gui = 0; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return true; } diff --git a/keyboards/jian/keymaps/advanced/keymap.c b/keyboards/jian/keymaps/advanced/keymap.c index eaf57cdd78d..e3e58a0e9f2 100644 --- a/keyboards/jian/keymaps/advanced/keymap.c +++ b/keyboards/jian/keymaps/advanced/keymap.c @@ -472,9 +472,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; case EXT_PLV: diff --git a/keyboards/monsgeek/m1/m1.c b/keyboards/monsgeek/m1/m1.c index 006eb66d7f9..1d519be4417 100644 --- a/keyboards/monsgeek/m1/m1.c +++ b/keyboards/monsgeek/m1/m1.c @@ -190,7 +190,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { set_single_persistent_default_layer(MAC_B); layer_state_set(1<event.pressed) { set_single_persistent_default_layer(MAC_B); keymap_config.no_gui = 0; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; case GU_TOGG: diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index a1ad5c65d66..0a2bd220c6c 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c @@ -233,9 +233,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; break; diff --git a/keyboards/planck/rev7/keymaps/default/keymap.c b/keyboards/planck/rev7/keymaps/default/keymap.c index 85f5097332c..385ae1089d7 100644 --- a/keyboards/planck/rev7/keymaps/default/keymap.c +++ b/keyboards/planck/rev7/keymaps/default/keymap.c @@ -270,9 +270,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } return false; break; diff --git a/keyboards/splitography/keymaps/default/keymap.c b/keyboards/splitography/keymaps/default/keymap.c index 9c6c7d6b26e..5d26eb96825 100644 --- a/keyboards/splitography/keymaps/default/keymap.c +++ b/keyboards/splitography/keymaps/default/keymap.c @@ -214,9 +214,9 @@ void plover(keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } } diff --git a/keyboards/splitography/keymaps/default_with_ctl_shft_alt_switched/keymap.c b/keyboards/splitography/keymaps/default_with_ctl_shft_alt_switched/keymap.c index 787f448ffbe..a3cb1837589 100644 --- a/keyboards/splitography/keymaps/default_with_ctl_shft_alt_switched/keymap.c +++ b/keyboards/splitography/keymaps/default_with_ctl_shft_alt_switched/keymap.c @@ -214,9 +214,9 @@ void plover(keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } } diff --git a/keyboards/splitography/keymaps/dvorak/keymap.c b/keyboards/splitography/keymaps/dvorak/keymap.c index 992cfd0abb0..0edec7043c8 100644 --- a/keyboards/splitography/keymaps/dvorak/keymap.c +++ b/keyboards/splitography/keymaps/dvorak/keymap.c @@ -214,9 +214,9 @@ void plover(keyrecord_t *record) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - keymap_config.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&keymap_config); keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } } diff --git a/quantum/command.c b/quantum/command.c index 78d2fc0615f..51bc92d55a1 100644 --- a/quantum/command.c +++ b/quantum/command.c @@ -245,7 +245,7 @@ static void print_eeconfig(void) { xprintf("eeconfig:\ndefault_layer: %u\n", eeconfig_read_default_layer()); debug_config_t dc; - dc.raw = eeconfig_read_debug(); + eeconfig_read_debug(&dc); xprintf(/* clang-format off */ "debug_config.raw: %02X\n" @@ -262,7 +262,7 @@ static void print_eeconfig(void) { ); /* clang-format on */ keymap_config_t kc; - kc.raw = eeconfig_read_keymap(); + eeconfig_read_keymap(&kc); xprintf(/* clang-format off */ "keymap_config.raw: %02X\n" diff --git a/quantum/eeconfig.c b/quantum/eeconfig.c index d38c46424af..a18786d1f95 100644 --- a/quantum/eeconfig.c +++ b/quantum/eeconfig.c @@ -258,11 +258,11 @@ void eeconfig_update_user(uint32_t val) { #endif // (EECONFIG_USER_DATA_SIZE) == 0 #ifdef HAPTIC_ENABLE -uint32_t eeconfig_read_haptic(void) { - return nvm_eeconfig_read_haptic(); +void eeconfig_read_haptic(haptic_config_t *haptic_config) { + nvm_eeconfig_read_haptic(haptic_config); } -void eeconfig_update_haptic(uint32_t val) { - nvm_eeconfig_update_haptic(val); +void eeconfig_update_haptic(const haptic_config_t *haptic_config) { + nvm_eeconfig_update_haptic(haptic_config); } #endif // HAPTIC_ENABLE diff --git a/quantum/eeconfig.h b/quantum/eeconfig.h index 064b849fa2c..3f4d3e0110d 100644 --- a/quantum/eeconfig.h +++ b/quantum/eeconfig.h @@ -125,8 +125,9 @@ void eeconfig_update_user(uint32_t val); #endif // (EECONFIG_USER_DATA_SIZE) == 0 #ifdef HAPTIC_ENABLE -uint32_t eeconfig_read_haptic(void); -void eeconfig_update_haptic(uint32_t val); +typedef union haptic_config_t haptic_config_t; +void eeconfig_read_haptic(haptic_config_t *haptic_config); +void eeconfig_update_haptic(const haptic_config_t *haptic_config); #endif bool eeconfig_read_handedness(void); diff --git a/quantum/haptic.c b/quantum/haptic.c index 6a466293a74..1e352d64141 100644 --- a/quantum/haptic.c +++ b/quantum/haptic.c @@ -67,7 +67,7 @@ void haptic_init(void) { if (!eeconfig_is_enabled()) { eeconfig_init(); } - haptic_config.raw = eeconfig_read_haptic(); + eeconfig_read_haptic(&haptic_config); #ifdef HAPTIC_SOLENOID solenoid_set_dwell(haptic_config.dwell); #endif @@ -122,13 +122,13 @@ void eeconfig_debug_haptic(void) { void haptic_enable(void) { set_haptic_config_enable(true); dprintf("haptic_config.enable = %u\n", haptic_config.enable); - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); } void haptic_disable(void) { set_haptic_config_enable(false); dprintf("haptic_config.enable = %u\n", haptic_config.enable); - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); } void haptic_toggle(void) { @@ -137,14 +137,14 @@ void haptic_toggle(void) { } else { haptic_enable(); } - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); } void haptic_feedback_toggle(void) { haptic_config.feedback++; if (haptic_config.feedback >= HAPTIC_FEEDBACK_MAX) haptic_config.feedback = KEY_PRESS; dprintf("haptic_config.feedback = %u\n", !haptic_config.feedback); - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); } void haptic_buzz_toggle(void) { @@ -225,26 +225,26 @@ void haptic_reset(void) { haptic_config.dwell = 0; haptic_config.buzz = 0; #endif - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); dprintf("haptic_config.feedback = %u\n", haptic_config.feedback); dprintf("haptic_config.mode = %u\n", haptic_config.mode); } void haptic_set_feedback(uint8_t feedback) { haptic_config.feedback = feedback; - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); dprintf("haptic_config.feedback = %u\n", haptic_config.feedback); } void haptic_set_mode(uint8_t mode) { haptic_config.mode = mode; - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); dprintf("haptic_config.mode = %u\n", haptic_config.mode); } void haptic_set_amplitude(uint8_t amp) { haptic_config.amplitude = amp; - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); dprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude); #ifdef HAPTIC_DRV2605L drv2605l_amplitude(amp); @@ -253,13 +253,13 @@ void haptic_set_amplitude(uint8_t amp) { void haptic_set_buzz(uint8_t buzz) { haptic_config.buzz = buzz; - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); dprintf("haptic_config.buzz = %u\n", haptic_config.buzz); } void haptic_set_dwell(uint8_t dwell) { haptic_config.dwell = dwell; - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); dprintf("haptic_config.dwell = %u\n", haptic_config.dwell); } @@ -291,7 +291,7 @@ uint8_t haptic_get_dwell(void) { void haptic_enable_continuous(void) { haptic_config.cont = 1; dprintf("haptic_config.cont = %u\n", haptic_config.cont); - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); #ifdef HAPTIC_DRV2605L drv2605l_rtp_init(); #endif @@ -300,7 +300,7 @@ void haptic_enable_continuous(void) { void haptic_disable_continuous(void) { haptic_config.cont = 0; dprintf("haptic_config.cont = %u\n", haptic_config.cont); - eeconfig_update_haptic(haptic_config.raw); + eeconfig_update_haptic(&haptic_config); #ifdef HAPTIC_DRV2605L drv2605l_write(DRV2605L_REG_MODE, 0x00); #endif diff --git a/quantum/haptic.h b/quantum/haptic.h index b283d5d2687..e27f546d408 100644 --- a/quantum/haptic.h +++ b/quantum/haptic.h @@ -28,7 +28,7 @@ #endif /* EEPROM config settings */ -typedef union { +typedef union haptic_config_t { uint32_t raw; struct { bool enable : 1; diff --git a/quantum/keyboard.c b/quantum/keyboard.c index 7f75bb7b8bd..16f1a51d45c 100644 --- a/quantum/keyboard.c +++ b/quantum/keyboard.c @@ -458,7 +458,7 @@ void keyboard_init(void) { #endif #if defined(NKRO_ENABLE) && defined(FORCE_NKRO) keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); #endif #ifdef DIP_SWITCH_ENABLE dip_switch_init(); diff --git a/quantum/nvm/eeprom/nvm_eeconfig.c b/quantum/nvm/eeprom/nvm_eeconfig.c index a496f906410..0a76d928861 100644 --- a/quantum/nvm/eeprom/nvm_eeconfig.c +++ b/quantum/nvm/eeprom/nvm_eeconfig.c @@ -37,6 +37,10 @@ # include "unicode.h" #endif +#ifdef HAPTIC_ENABLE +# include "haptic.h" +#endif + bool nvm_eeconfig_is_enabled(void) { return eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER; } @@ -164,11 +168,11 @@ void nvm_eeconfig_update_user(uint32_t val) { #endif // (EECONFIG_USER_DATA_SIZE) == 0 #ifdef HAPTIC_ENABLE -uint32_t nvm_eeconfig_read_haptic(void) { - return eeprom_read_dword(EECONFIG_HAPTIC); +void nvm_eeconfig_read_haptic(haptic_config_t *haptic_config) { + haptic_config->raw = eeprom_read_dword(EECONFIG_HAPTIC); } -void nvm_eeconfig_update_haptic(uint32_t val) { - eeprom_update_dword(EECONFIG_HAPTIC, val); +void nvm_eeconfig_update_haptic(const haptic_config_t *haptic_config) { + eeprom_update_dword(EECONFIG_HAPTIC, haptic_config->raw); } #endif // HAPTIC_ENABLE diff --git a/quantum/nvm/nvm_eeconfig.h b/quantum/nvm/nvm_eeconfig.h index 4c7bbbfd5a4..310bb8b5f7f 100644 --- a/quantum/nvm/nvm_eeconfig.h +++ b/quantum/nvm/nvm_eeconfig.h @@ -74,8 +74,9 @@ void nvm_eeconfig_update_user(uint32_t val); #endif // (EECONFIG_USER_DATA_SIZE) == 0 #ifdef HAPTIC_ENABLE -uint32_t nvm_eeconfig_read_haptic(void); -void nvm_eeconfig_update_haptic(uint32_t val); +typedef union haptic_config_t haptic_config_t; +void nvm_eeconfig_read_haptic(haptic_config_t *haptic_config); +void nvm_eeconfig_update_haptic(const haptic_config_t *haptic_config); #endif // HAPTIC_ENABLE bool nvm_eeconfig_read_handedness(void); diff --git a/quantum/process_keycode/process_autocorrect.c b/quantum/process_keycode/process_autocorrect.c index edc47718f32..5577b78f8ab 100644 --- a/quantum/process_keycode/process_autocorrect.c +++ b/quantum/process_keycode/process_autocorrect.c @@ -38,7 +38,7 @@ bool autocorrect_is_enabled(void) { */ void autocorrect_enable(void) { keymap_config.autocorrect_enable = true; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } /** @@ -48,7 +48,7 @@ void autocorrect_enable(void) { void autocorrect_disable(void) { keymap_config.autocorrect_enable = false; typo_buffer_size = 0; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } /** @@ -58,7 +58,7 @@ void autocorrect_disable(void) { void autocorrect_toggle(void) { keymap_config.autocorrect_enable = !keymap_config.autocorrect_enable; typo_buffer_size = 0; - eeconfig_update_keymap(keymap_config.raw); + eeconfig_update_keymap(&keymap_config); } /** diff --git a/quantum/process_keycode/process_clicky.c b/quantum/process_keycode/process_clicky.c index 82000db9b30..f50761268a7 100644 --- a/quantum/process_keycode/process_clicky.c +++ b/quantum/process_keycode/process_clicky.c @@ -66,17 +66,17 @@ void clicky_freq_reset(void) { void clicky_toggle(void) { audio_config.clicky_enable ^= 1; - eeconfig_update_audio(audio_config.raw); + eeconfig_update_audio(&audio_config); } void clicky_on(void) { audio_config.clicky_enable = 1; - eeconfig_update_audio(audio_config.raw); + eeconfig_update_audio(&audio_config); } void clicky_off(void) { audio_config.clicky_enable = 0; - eeconfig_update_audio(audio_config.raw); + eeconfig_update_audio(&audio_config); } bool is_clicky_on(void) { diff --git a/quantum/unicode/unicode.c b/quantum/unicode/unicode.c index fb1b033fe36..3da2fd2c60f 100644 --- a/quantum/unicode/unicode.c +++ b/quantum/unicode/unicode.c @@ -136,7 +136,7 @@ static void unicode_play_song(uint8_t mode) { #endif void unicode_input_mode_init(void) { - unicode_config.raw = eeconfig_read_unicode_mode(); + eeconfig_read_unicode_mode(&unicode_config); #if UNICODE_SELECTED_MODES != -1 # if UNICODE_CYCLE_PERSIST // Find input_mode in selected modes diff --git a/quantum/via.c b/quantum/via.c index 43cf8c6c0dc..62cdb80d01c 100644 --- a/quantum/via.c +++ b/quantum/via.c @@ -863,7 +863,7 @@ void via_qmk_audio_set_value(uint8_t *data) { } void via_qmk_audio_save(void) { - eeconfig_update_audio(audio_config.raw); + eeconfig_update_audio(&audio_config); } #endif // QMK_AUDIO_ENABLE