summaryrefslogtreecommitdiffstats
path: root/quantum/keycode_config.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-06-18 14:30:24 -0400
committerGitHub <noreply@github.com>2016-06-18 14:30:24 -0400
commitdb32864ce7029d758f57729cc2f75e051a28d0a2 (patch)
treef3ac60d9c826a9ad5ef5bc4d199efaddae156ba6 /quantum/keycode_config.c
parent1923cffd41d9d71cd9f434092654dba05513137b (diff)
Cleans up quantum/keymap situation, removes extra lufa folders (#416)
* sorts out keycodes * move midi around * remove mbed * replaces keymap with qmk/keymap_common * fixes keymap.h * keymap, config, quantum rearrange * removes unneeded lufa stuff
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