summaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-09-24 15:24:12 +0100
committerFlorian Didron <fdidron@users.noreply.github.com>2020-01-09 08:57:11 +0900
commita15119dc6f85e35b061cf41a4da37ac15a9cb16b (patch)
treedd68a41b36b7401b95d82091cdb47aa1cfa802b7 /tmk_core/common
parent1f66fd1a3c31911f083d4f0f45bd24446d15bfb1 (diff)
ARM split - Add bootmagic/magic keycodes for setting handedness (#6545)
* Add docs on bootmagic/magic keycodes for setting handedness * Clang format fixes * Maintain backwards compatibility * Maintain backwards compatibility
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/bootmagic.c8
-rw-r--r--tmk_core/common/bootmagic.h6
-rw-r--r--tmk_core/common/eeconfig.c19
-rw-r--r--tmk_core/common/eeconfig.h3
4 files changed, 34 insertions, 2 deletions
diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c
index 09b1664c90..bb2aa0db8c 100644
--- a/tmk_core/common/bootmagic.c
+++ b/tmk_core/common/bootmagic.c
@@ -122,6 +122,14 @@ void bootmagic(void) {
default_layer = eeconfig_read_default_layer();
default_layer_set((layer_state_t)default_layer);
}
+
+ /* EE_HANDS handedness */
+ if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) {
+ eeconfig_update_handedness(true);
+ }
+ if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) {
+ eeconfig_update_handedness(false);
+ }
}
/** \brief Scan Keycode
diff --git a/tmk_core/common/bootmagic.h b/tmk_core/common/bootmagic.h
index fb76472579..c64dc17858 100644
--- a/tmk_core/common/bootmagic.h
+++ b/tmk_core/common/bootmagic.h
@@ -36,6 +36,12 @@
#ifndef BOOTMAGIC_KEY_DEBUG_MOUSE
# define BOOTMAGIC_KEY_DEBUG_MOUSE KC_M
#endif
+#ifndef BOOTMAGIC_KEY_EE_HANDS_LEFT
+# define BOOTMAGIC_KEY_EE_HANDS_LEFT KC_L
+#endif
+#ifndef BOOTMAGIC_KEY_EE_HANDS_RIGHT
+# define BOOTMAGIC_KEY_EE_HANDS_RIGHT KC_R
+#endif
/*
* keymap config
diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c
index f33d831f77..4369e44ac2 100644
--- a/tmk_core/common/eeconfig.c
+++ b/tmk_core/common/eeconfig.c
@@ -163,8 +163,8 @@ uint32_t eeconfig_read_kb(void) { return eeprom_read_dword(EECONFIG_KEYBOARD); }
*
* FIXME: needs doc
*/
-
void eeconfig_update_kb(uint32_t val) { eeprom_update_dword(EECONFIG_KEYBOARD, val); }
+
/** \brief eeconfig read user
*
* FIXME: needs doc
@@ -176,9 +176,24 @@ uint32_t eeconfig_read_user(void) { return eeprom_read_dword(EECONFIG_USER); }
*/
void eeconfig_update_user(uint32_t val) { eeprom_update_dword(EECONFIG_USER, val); }
+/** \brief eeconfig read haptic
+ *
+ * FIXME: needs doc
+ */
uint32_t eeconfig_read_haptic(void) { return eeprom_read_dword(EECONFIG_HAPTIC); }
-/** \brief eeconfig update user
+/** \brief eeconfig update haptic
*
* FIXME: needs doc
*/
void eeconfig_update_haptic(uint32_t val) { eeprom_update_dword(EECONFIG_HAPTIC, val); }
+
+/** \brief eeconfig read split handedness
+ *
+ * FIXME: needs doc
+ */
+bool eeconfig_read_handedness(void) { return !!eeprom_read_byte(EECONFIG_HANDEDNESS); }
+/** \brief eeconfig update split handedness
+ *
+ * FIXME: needs doc
+ */
+void eeconfig_update_handedness(bool val) { eeprom_update_byte(EECONFIG_HANDEDNESS, !!val); }
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h
index 6db1b0c220..a7a78b352e 100644
--- a/tmk_core/common/eeconfig.h
+++ b/tmk_core/common/eeconfig.h
@@ -107,4 +107,7 @@ uint32_t eeconfig_read_haptic(void);
void eeconfig_update_haptic(uint32_t val);
#endif
+bool eeconfig_read_handedness(void);
+void eeconfig_update_handedness(bool val);
+
#endif