diff options
author | Drashna Jaelre <drashna@live.com> | 2018-10-01 17:53:14 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-10-01 20:53:14 -0400 |
commit | e885c793bcffcba03e18e93e41120b21cdfb6b75 (patch) | |
tree | 9018aab46625ff555b32190dd3e141a39f2ef872 /tmk_core/common/eeconfig.h | |
parent | 4318797d198b58bb807b3e436c7d8924d8b4a6fe (diff) | |
download | qmk_firmware-e885c793bcffcba03e18e93e41120b21cdfb6b75.tar.gz qmk_firmware-e885c793bcffcba03e18e93e41120b21cdfb6b75.zip |
Add Function level EECONFIG code for EEPROM (#3084)
* Add Function level EEPROM configuration
Add kb and user functions for EEPROM, and example of how to use it.
* Bug fixes and demo
* Additional cleanup
* Add EEPROM reset macro to example
* Forgot init function in list
* Move eeconfig_init_quantum function to quantum.c and actually set default layer
* See if removing weak quantum function fixes issue
* Fix travis compile error
* Remove ifdef blocks from EECONFIG so settings are always set
* Fix for ARM EEPROM updates
* Fix merge issues
* Fix potential STM32 EEPROM issues
Diffstat (limited to 'tmk_core/common/eeconfig.h')
-rw-r--r-- | tmk_core/common/eeconfig.h | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index fa498df48..a45cb8b12 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h | |||
@@ -23,36 +23,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
23 | 23 | ||
24 | 24 | ||
25 | #define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEED | 25 | #define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEED |
26 | #define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF | ||
26 | 27 | ||
27 | /* eeprom parameteter address */ | 28 | /* eeprom parameteter address */ |
28 | #if !defined(STM32F303xC) | 29 | #if !defined(STM32F303xC) |
29 | #define EECONFIG_MAGIC (uint16_t *)0 | 30 | #define EECONFIG_MAGIC (uint16_t *)0 |
30 | #define EECONFIG_DEBUG (uint8_t *)2 | 31 | #define EECONFIG_DEBUG (uint8_t *)2 |
31 | #define EECONFIG_DEFAULT_LAYER (uint8_t *)3 | 32 | #define EECONFIG_DEFAULT_LAYER (uint8_t *)3 |
32 | #define EECONFIG_KEYMAP (uint8_t *)4 | 33 | #define EECONFIG_KEYMAP (uint8_t *)4 |
33 | #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5 | 34 | #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5 |
34 | #define EECONFIG_BACKLIGHT (uint8_t *)6 | 35 | #define EECONFIG_BACKLIGHT (uint8_t *)6 |
35 | #define EECONFIG_AUDIO (uint8_t *)7 | 36 | #define EECONFIG_AUDIO (uint8_t *)7 |
36 | #define EECONFIG_RGBLIGHT (uint32_t *)8 | 37 | #define EECONFIG_RGBLIGHT (uint32_t *)8 |
37 | #define EECONFIG_UNICODEMODE (uint8_t *)12 | 38 | #define EECONFIG_UNICODEMODE (uint8_t *)12 |
38 | #define EECONFIG_STENOMODE (uint8_t *)13 | 39 | #define EECONFIG_STENOMODE (uint8_t *)13 |
39 | // EEHANDS for two handed boards | 40 | // EEHANDS for two handed boards |
40 | #define EECONFIG_HANDEDNESS (uint8_t *)14 | 41 | #define EECONFIG_HANDEDNESS (uint8_t *)14 |
42 | #define EECONFIG_KEYBOARD (uint32_t *)15 | ||
43 | #define EECONFIG_USER (uint32_t *)19 | ||
41 | 44 | ||
42 | #else | 45 | #else |
43 | /* STM32F3 uses 16byte block. Reconfigure memory map */ | 46 | /* STM32F3 uses 16byte block. Reconfigure memory map */ |
44 | #define EECONFIG_MAGIC (uint16_t *)0 | 47 | #define EECONFIG_MAGIC (uint16_t *)0 |
45 | #define EECONFIG_DEBUG (uint8_t *)1 | 48 | #define EECONFIG_DEBUG (uint8_t *)1 |
46 | #define EECONFIG_DEFAULT_LAYER (uint8_t *)2 | 49 | #define EECONFIG_DEFAULT_LAYER (uint8_t *)2 |
47 | #define EECONFIG_KEYMAP (uint8_t *)3 | 50 | #define EECONFIG_KEYMAP (uint8_t *)3 |
48 | #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)4 | 51 | #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)4 |
49 | #define EECONFIG_BACKLIGHT (uint8_t *)5 | 52 | #define EECONFIG_BACKLIGHT (uint8_t *)5 |
50 | #define EECONFIG_AUDIO (uint8_t *)6 | 53 | #define EECONFIG_AUDIO (uint8_t *)6 |
51 | #define EECONFIG_RGBLIGHT (uint32_t *)7 | 54 | #define EECONFIG_RGBLIGHT (uint32_t *)7 |
52 | #define EECONFIG_UNICODEMODE (uint8_t *)9 | 55 | #define EECONFIG_UNICODEMODE (uint8_t *)9 |
53 | #define EECONFIG_STENOMODE (uint8_t *)10 | 56 | #define EECONFIG_STENOMODE (uint8_t *)10 |
54 | // EEHANDS for two handed boards | 57 | // EEHANDS for two handed boards |
55 | #define EECONFIG_HANDEDNESS (uint8_t *)11 | 58 | #define EECONFIG_HANDEDNESS (uint8_t *)11 |
59 | #define EECONFIG_KEYBOARD (uint32_t *)12 | ||
60 | #define EECONFIG_USER (uint32_t *)14 | ||
56 | #endif | 61 | #endif |
57 | 62 | ||
58 | /* debug bit */ | 63 | /* debug bit */ |
@@ -73,8 +78,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
73 | 78 | ||
74 | 79 | ||
75 | bool eeconfig_is_enabled(void); | 80 | bool eeconfig_is_enabled(void); |
81 | bool eeconfig_is_disabled(void); | ||
76 | 82 | ||
77 | void eeconfig_init(void); | 83 | void eeconfig_init(void); |
84 | void eeconfig_init_quantum(void); | ||
85 | void eeconfig_init_kb(void); | ||
86 | void eeconfig_init_user(void); | ||
78 | 87 | ||
79 | void eeconfig_enable(void); | 88 | void eeconfig_enable(void); |
80 | 89 | ||
@@ -99,4 +108,9 @@ uint8_t eeconfig_read_audio(void); | |||
99 | void eeconfig_update_audio(uint8_t val); | 108 | void eeconfig_update_audio(uint8_t val); |
100 | #endif | 109 | #endif |
101 | 110 | ||
111 | uint32_t eeconfig_read_kb(void); | ||
112 | void eeconfig_update_kb(uint32_t val); | ||
113 | uint32_t eeconfig_read_user(void); | ||
114 | void eeconfig_update_user(uint32_t val); | ||
115 | |||
102 | #endif | 116 | #endif |