aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-10-26 20:02:25 -0400
committerJack Humbert <jack.humb@gmail.com>2015-10-26 20:02:25 -0400
commitcc1c32671eb1eb43a87e55ac4ffa60b15115e48d (patch)
tree4f57c95c9c22d858b1eac8bcd3d489c0d6214719 /quantum
parent402122744c26704f378cda828d30bf11e8d6dabf (diff)
downloadqmk_firmware-cc1c32671eb1eb43a87e55ac4ffa60b15115e48d.tar.gz
qmk_firmware-cc1c32671eb1eb43a87e55ac4ffa60b15115e48d.zip
fixed makefile, added MO DF shortcuts
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_common.c30
-rw-r--r--quantum/keymap_common.h40
2 files changed, 63 insertions, 7 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index c9e1494fd..5c00c0afa 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -78,12 +78,30 @@ action_t action_for_key(uint8_t layer, keypos_t key)
78 print("\nDEBUG: enabled.\n"); 78 print("\nDEBUG: enabled.\n");
79 debug_enable = true; 79 debug_enable = true;
80 return; 80 return;
81 } else if (keycode >= 0x5000 && keycode < 0x6000) { 81 } else if (keycode >= 0x5000 && keycode < 0x6000) {
82 int when = (keycode >> 0x9) & 0x3; 82 // Layer movement shortcuts
83 int layer = keycode & 0xFF; 83 // See .h to see constraints/usage
84 action_t action; 84 int type = (keycode >> 0x8) & 0xF;
85 action.code = ACTION_LAYER_SET(layer, when); 85 if (type == 0x1) {
86 return action; 86 // Layer set "GOTO"
87 int when = (keycode >> 0x4) & 0x3;
88 int layer = keycode & 0xF;
89 action_t action;
90 action.code = ACTION_LAYER_SET(layer, when);
91 return action;
92 } else if (type == 0x2) {
93 // Momentary layer
94 int layer = keycode & 0xFF;
95 action_t action;
96 action.code = ACTION_LAYER_MOMENTARY(layer);
97 return action;
98 } else if (type == 0x3) {
99 // Set default layer
100 int layer = keycode & 0xFF;
101 action_t action;
102 action.code = ACTION_DEFAULT_LAYER_SET(layer);
103 return action;
104 }
87#ifdef MIDI_ENABLE 105#ifdef MIDI_ENABLE
88 } else if (keycode >= 0x6000 && keycode < 0x7000) { 106 } else if (keycode >= 0x6000 && keycode < 0x7000) {
89 action_t action; 107 action_t action;
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h
index 091f7d8f3..30ef9365a 100644
--- a/quantum/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -71,6 +71,36 @@ extern const uint16_t fn_actions[];
71#define RALT(kc) kc | 0x1400 71#define RALT(kc) kc | 0x1400
72#define RGUI(kc) kc | 0x1800 72#define RGUI(kc) kc | 0x1800
73 73
74// Aliases for shifted symbols
75#define KC_TILD LSFT(KC_GRV) // ~
76#define KC_TILDE KC_TILD
77#define KC_EXLM LSFT(KC_1) // !
78#define KC_EXCLAIM KC_EXLM
79#define KC_AT LSFT(KC_2) // @
80#define KC_HASH LSFT(KC_3) // #
81#define KC_DLR LSFT(KC_4) // $
82#define KC_DOLLAR KC_DLR
83#define KC_PERC LSFT(KC_5) // %
84#define KC_PERCENT KC_PERC
85#define KC_CIRC LSFT(KC_6) // ^
86#define KC_CIRCUMFLEX KC_CIRC
87#define KC_AMPR LSFT(KC_7) // &
88#define KC_AMPERSAND KC_AMPR
89#define KC_ASTR LSFT(KC_8) // *
90#define KC_ASTERISK KC_ASTR
91#define KC_LPRN LSFT(KC_9) // (
92#define KC_LEFT_PAREN KC_LPRN
93#define KC_RPRN LSFT(KC_0) // )
94#define KC_RIGHT_PAREN KC_RPRN
95#define KC_UNDS LSFT(KC_MINS) // _
96#define KC_UNDERSCORE KC_UNDS
97#define KC_PLUS LSFT(KC_EQL) // +
98#define KC_LCBR LSFT(KC_LBRC) // {
99#define KC_LEFT_CURLY_BRACE KC_LCBR
100#define KC_RCBR LSFT(KC_RBRC) // }
101#define KC_RIGHT_CURLY_BRACE KC_RCBR
102#define KC_PIPE LSFT(KC_SLSH) // |
103
74// Alias for function layers than expand past FN31 104// Alias for function layers than expand past FN31
75#define FUNC(kc) kc | 0x2000 105#define FUNC(kc) kc | 0x2000
76 106
@@ -108,10 +138,18 @@ extern const uint16_t fn_actions[];
108#define RESET 0x5000 138#define RESET 0x5000
109#define DEBUG 0x5001 139#define DEBUG 0x5001
110 140
141// GOTO layer - 16 layers max
142// when:
111// ON_PRESS = 1 143// ON_PRESS = 1
112// ON_RELEASE = 2 144// ON_RELEASE = 2
113// ON_BOTH = 3 145// ON_BOTH = 3
114#define TO(layer, when) (layer | 0x5100 | (when << 0x9)) 146#define TO(layer, when) (layer | 0x5100 | (when << 0x4))
147
148// Momentary switch layer - 256 layer max
149#define MO(layer) (layer | 0x5200)
150
151// Set default layer - 256 layer max
152#define DF(layer) (layer | 0x5300)
115 153
116#define MIDI(n) (n | 0x6000) 154#define MIDI(n) (n | 0x6000)
117 155