summary refs log tree commit diff
path: root/quantum/keycode_config.c
diff options
context:
space:
mode:
authorRyan Ascheman <rascheman@groupon.com>2016-10-18 12:42:02 -0700
committerRyan Ascheman <rascheman@groupon.com>2016-10-18 12:42:02 -0700
commit55b8b8477cc6aee82dfe6792eea4e589cac433d5 (patch)
treece5bfbd1b0ee59dbffdc2044bcf90c89614392ed /quantum/keycode_config.c
parentd1c70328f8d8ded6ce1e5422b468fc41ef315e7d (diff)
parent04df74f6360464661bcc1e6794e9fd3549084390 (diff)
Merge remote-tracking branch 'upstream/master'
* upstream/master: (1239 commits)
  Update ez.c
  removes planck/rev3 temporarily
  Move hand_swap_config to ez.c, removes error for infinity
  Update Makefile
  ergodox: Update algernon's keymap to v1.9
  Added VS Code dir to .gitignore
  Support the Pegasus Hoof controller.
  [Jack & Erez] Simplifies and documents TO
  add readme
  use wait_ms instead of _delay_ms
  add messenger
  init keymap
  Add example keymap
  Adding whiskey_tango_foxtrot_capslock ergodox keymap
  Unicode map framework. Allow unicode up to 0xFFFFF using separate mapping table
  CIE 1931 dim curve
  Apply the dim curve to the RGB output
  Update the Cluecard readme files
  Tune snake and knight intervals for Cluecard
  Tunable RGB light intervals
  ...
Diffstat (limited to 'quantum/keycode_config.c')
-rw-r--r--quantum/keycode_config.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c
new file mode 100644
index 0000000000..6d90781a17
--- /dev/null
+++ b/quantum/keycode_config.c
@@ -0,0 +1,74 @@
+#include "keycode_config.h"
+
+extern keymap_config_t keymap_config;
+
+uint16_t keycode_config(uint16_t keycode) {
+
+    switch (keycode) {
+        case KC_CAPSLOCK:
+        case KC_LOCKING_CAPS:
+            if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) {
+                return KC_LCTL;
+            }
+            return keycode;
+        case KC_LCTL:
+            if (keymap_config.swap_control_capslock) {
+                return KC_CAPSLOCK;
+            }
+            return KC_LCTL;
+        case KC_LALT:
+            if (keymap_config.swap_lalt_lgui) {
+                if (keymap_config.no_gui) {
+                    return KC_NO;
+                }
+                return KC_LGUI;
+            }
+            return KC_LALT;
+        case KC_LGUI:
+            if (keymap_config.swap_lalt_lgui) {
+                return KC_LALT;
+            }
+            if (keymap_config.no_gui) {
+                return KC_NO;
+            }
+            return KC_LGUI;
+        case KC_RALT:
+            if (keymap_config.swap_ralt_rgui) {
+                if (keymap_config.no_gui) {
+                    return KC_NO;
+                }
+                return KC_RGUI;
+            }
+            return KC_RALT;
+        case KC_RGUI:
+            if (keymap_config.swap_ralt_rgui) {
+                return KC_RALT;
+            }
+            if (keymap_config.no_gui) {
+                return KC_NO;
+            }
+            return KC_RGUI;
+        case KC_GRAVE:
+            if (keymap_config.swap_grave_esc) {
+                return KC_ESC;
+            }
+            return KC_GRAVE;
+        case KC_ESC:
+            if (keymap_config.swap_grave_esc) {
+                return KC_GRAVE;
+            }
+            return KC_ESC;
+        case KC_BSLASH:
+            if (keymap_config.swap_backslash_backspace) {
+                return KC_BSPACE;
+            }
+            return KC_BSLASH;
+        case KC_BSPACE:
+            if (keymap_config.swap_backslash_backspace) {
+                return KC_BSLASH;
+            }
+            return KC_BSPACE;
+        default:
+            return keycode;
+    }
+}
\ No newline at end of file