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);
52 /** \brief eeconfig initialization
56 void eeconfig_init(void) {
58 eeconfig_init_quantum();
61 /** \brief eeconfig enable
65 void eeconfig_enable(void)
67 eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
70 /** \brief eeconfig disable
74 void eeconfig_disable(void)
76 #ifdef STM32_EEPROM_ENABLE
79 eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER_OFF);
82 /** \brief eeconfig is enabled
86 bool eeconfig_is_enabled(void)
88 return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER);
91 /** \brief eeconfig is disabled
95 bool eeconfig_is_disabled(void)
97 return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER_OFF);
100 /** \brief eeconfig read debug
104 uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); }
105 /** \brief eeconfig update debug
109 void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); }
111 /** \brief eeconfig read default layer
115 uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); }
116 /** \brief eeconfig update default layer
120 void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); }
122 /** \brief eeconfig read keymap
126 uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); }
127 /** \brief eeconfig update keymap
131 void eeconfig_update_keymap(uint8_t val) { eeprom_update_byte(EECONFIG_KEYMAP, val); }
133 /** \brief eeconfig read backlight
137 uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); }
138 /** \brief eeconfig update backlight
142 void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); }
145 /** \brief eeconfig read audio
149 uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); }
150 /** \brief eeconfig update audio
154 void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); }
157 /** \brief eeconfig read kb
161 uint32_t eeconfig_read_kb(void) { return eeprom_read_dword(EECONFIG_KEYBOARD); }
162 /** \brief eeconfig update kb
167 void eeconfig_update_kb(uint32_t val) { eeprom_update_dword(EECONFIG_KEYBOARD, val); }
168 /** \brief eeconfig read user
172 uint32_t eeconfig_read_user(void) { return eeprom_read_dword(EECONFIG_USER); }
173 /** \brief eeconfig update user
177 void eeconfig_update_user(uint32_t val) { eeprom_update_dword(EECONFIG_USER, val); }