6 #ifdef STM32_EEPROM_ENABLE
8 #include "eeprom_stm32.h"
11 extern uint32_t default_layer_state;
12 /** \brief eeconfig enable
16 __attribute__ ((weak))
17 void eeconfig_init_user(void) {
18 // Reset user EEPROM value to blank, rather than to a set value
19 eeconfig_update_user(0);
22 __attribute__ ((weak))
23 void eeconfig_init_kb(void) {
24 // Reset Keyboard EEPROM value to blank, rather than to a set value
25 eeconfig_update_kb(0);
34 void eeconfig_init_quantum(void) {
35 #ifdef STM32_EEPROM_ENABLE
38 eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
39 eeprom_update_byte(EECONFIG_DEBUG, 0);
40 eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0);
41 default_layer_state = 0;
42 eeprom_update_byte(EECONFIG_KEYMAP, 0);
43 eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0);
44 eeprom_update_byte(EECONFIG_BACKLIGHT, 0);
45 eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default
46 eeprom_update_dword(EECONFIG_RGBLIGHT, 0);
47 eeprom_update_byte(EECONFIG_STENOMODE, 0);
48 eeprom_update_dword(EECONFIG_HAPTIC, 0);
49 eeprom_update_byte(EECONFIG_VELOCIKEY, 0);
50 #ifdef EECONFIG_RGB_MATRIX
51 eeprom_update_dword(EECONFIG_RGB_MATRIX, 0);
57 /** \brief eeconfig initialization
61 void eeconfig_init(void) {
63 eeconfig_init_quantum();
66 /** \brief eeconfig enable
70 void eeconfig_enable(void)
72 eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
75 /** \brief eeconfig disable
79 void eeconfig_disable(void)
81 #ifdef STM32_EEPROM_ENABLE
84 eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER_OFF);
87 /** \brief eeconfig is enabled
91 bool eeconfig_is_enabled(void)
93 return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER);
96 /** \brief eeconfig is disabled
100 bool eeconfig_is_disabled(void)
102 return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER_OFF);
105 /** \brief eeconfig read debug
109 uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); }
110 /** \brief eeconfig update debug
114 void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); }
116 /** \brief eeconfig read default layer
120 uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); }
121 /** \brief eeconfig update default layer
125 void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); }
127 /** \brief eeconfig read keymap
131 uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); }
132 /** \brief eeconfig update keymap
136 void eeconfig_update_keymap(uint8_t val) { eeprom_update_byte(EECONFIG_KEYMAP, val); }
138 /** \brief eeconfig read backlight
142 uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); }
143 /** \brief eeconfig update backlight
147 void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); }
150 /** \brief eeconfig read audio
154 uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); }
155 /** \brief eeconfig update audio
159 void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); }
162 /** \brief eeconfig read kb
166 uint32_t eeconfig_read_kb(void) { return eeprom_read_dword(EECONFIG_KEYBOARD); }
167 /** \brief eeconfig update kb
172 void eeconfig_update_kb(uint32_t val) { eeprom_update_dword(EECONFIG_KEYBOARD, val); }
173 /** \brief eeconfig read user
177 uint32_t eeconfig_read_user(void) { return eeprom_read_dword(EECONFIG_USER); }
178 /** \brief eeconfig update user
182 void eeconfig_update_user(uint32_t val) { eeprom_update_dword(EECONFIG_USER, val); }
185 uint32_t eeconfig_read_haptic(void) { return eeprom_read_dword(EECONFIG_HAPTIC); }
186 /** \brief eeconfig update user
190 void eeconfig_update_haptic(uint32_t val) { eeprom_update_dword(EECONFIG_HAPTIC, val); }