aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboard/planck/keymaps/keymap_default.c76
-rw-r--r--protocol/bluefruit.mk2
-rw-r--r--quantum.mk4
-rw-r--r--quantum/keymap_common.c30
-rw-r--r--quantum/keymap_common.h40
5 files changed, 104 insertions, 48 deletions
diff --git a/keyboard/planck/keymaps/keymap_default.c b/keyboard/planck/keymaps/keymap_default.c
index edfc21d0a..4468247b9 100644
--- a/keyboard/planck/keymaps/keymap_default.c
+++ b/keyboard/planck/keymaps/keymap_default.c
@@ -1,52 +1,52 @@
1#include "planck.h" 1#include "planck.h"
2#include "backlight.h" 2#include "backlight.h"
3 3
4#define QWERTY_LAYER 0 4#define _QW 0
5#define COLEMAK_LAYER 1 5#define _CM 1
6#define DVORAK_LAYER 2 6#define _DV 2
7#define LOWER_LAYER 3 7#define _LW 3
8#define RAISE_LAYER 4 8#define _RS 4
9 9
10const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 10const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11[QWERTY_LAYER] = { /* Qwerty */ 11[_QW] = { /* Qwerty */
12 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, 12 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
13 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, 13 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
14 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, 14 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
15 {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} 15 {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(2), KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
16}, 16},
17[COLEMAK_LAYER] = { /* Colemak */ 17[_CM] = { /* Colemak */
18 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, 18 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
19 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, 19 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
20 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, 20 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
21 {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} 21 {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(2), KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
22}, 22},
23[DVORAK_LAYER] = { /* Dvorak */ 23[_DV] = { /* Dvorak */
24 {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, 24 {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
25 {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, 25 {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
26 {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT}, 26 {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
27 {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} 27 {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(2), KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
28}, 28},
29[RAISE_LAYER] = { /* RAISE */ 29[_RS] = { /* RAISE */
30 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, 30 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
31 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, 31 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
32 {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, FUNC(3), FUNC(4), FUNC(5), RESET, KC_TRNS}, 32 {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
33 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 33 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
34}, 34},
35[LOWER_LAYER] = { /* LOWER */ 35[_LW] = { /* LOWER */
36 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, 36 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
37 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, 37 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
38 {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, FUNC(3), FUNC(4), FUNC(5), RESET, KC_TRNS}, 38 {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
39 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 39 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
40} 40}
41}; 41};
42 42
43const uint16_t PROGMEM fn_actions[] = { 43const uint16_t PROGMEM fn_actions[] = {
44 [1] = ACTION_LAYER_MOMENTARY(RAISE_LAYER), // to RAISE 44 [1] = ACTION_LAYER_MOMENTARY(_RS), // to RAISE
45 [2] = ACTION_LAYER_MOMENTARY(LOWER_LAYER), // to LOWER 45 [2] = ACTION_LAYER_MOMENTARY(_LW), // to LOWER
46 46
47 [3] = ACTION_DEFAULT_LAYER_SET(QWERTY_LAYER), 47 [3] = ACTION_DEFAULT_LAYER_SET(_QW),
48 [4] = ACTION_DEFAULT_LAYER_SET(COLEMAK_LAYER), 48 [4] = ACTION_DEFAULT_LAYER_SET(_CM),
49 [5] = ACTION_DEFAULT_LAYER_SET(DVORAK_LAYER), 49 [5] = ACTION_DEFAULT_LAYER_SET(_DV),
50 50
51}; 51};
52 52
@@ -55,12 +55,12 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
55 // MACRODOWN only works in this function 55 // MACRODOWN only works in this function
56 switch(id) { 56 switch(id) {
57 case 0: 57 case 0:
58 if (record->event.pressed) { 58 if (record->event.pressed) {
59 register_code(KC_RSFT); 59 register_code(KC_RSFT);
60 backlight_step(); 60 backlight_step();
61 } else { 61 } else {
62 unregister_code(KC_RSFT); 62 unregister_code(KC_RSFT);
63 } 63 }
64 break; 64 break;
65 } 65 }
66 return MACRO_NONE; 66 return MACRO_NONE;
diff --git a/protocol/bluefruit.mk b/protocol/bluefruit.mk
index 473d73e01..85313ba62 100644
--- a/protocol/bluefruit.mk
+++ b/protocol/bluefruit.mk
@@ -3,7 +3,7 @@ PJRC_DIR = protocol/pjrc
3 3
4SRC += $(BLUEFRUIT_DIR)/main.c \ 4SRC += $(BLUEFRUIT_DIR)/main.c \
5 $(BLUEFRUIT_DIR)/bluefruit.c \ 5 $(BLUEFRUIT_DIR)/bluefruit.c \
6 ../serial_uart.c \ 6 protocol/serial_uart.c \
7 $(PJRC_DIR)/pjrc.c \ 7 $(PJRC_DIR)/pjrc.c \
8 $(PJRC_DIR)/usb_keyboard.c \ 8 $(PJRC_DIR)/usb_keyboard.c \
9 $(PJRC_DIR)/usb_debug.c \ 9 $(PJRC_DIR)/usb_debug.c \
diff --git a/quantum.mk b/quantum.mk
index c68bce8ff..c760dbdb5 100644
--- a/quantum.mk
+++ b/quantum.mk
@@ -38,7 +38,7 @@
38# To rebuild project do "make clean" then "make all". 38# To rebuild project do "make clean" then "make all".
39#---------------------------------------------------------------------------- 39#----------------------------------------------------------------------------
40 40
41QUANTUM_DIR = $(TOP_DIR)/quantum 41QUANTUM_DIR = quantum
42 42
43# # project specific files 43# # project specific files
44SRC += $(QUANTUM_DIR)/keymap_common.c \ 44SRC += $(QUANTUM_DIR)/keymap_common.c \
@@ -61,7 +61,7 @@ endif
61#EXTRALDFLAGS = -Wl,--relax 61#EXTRALDFLAGS = -Wl,--relax
62 62
63# Search Path 63# Search Path
64VPATH += $(QUANTUM_DIR) 64VPATH += $(TOP_DIR)/$(QUANTUM_DIR)
65 65
66include $(TOP_DIR)/protocol/lufa.mk 66include $(TOP_DIR)/protocol/lufa.mk
67 67
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