aboutsummaryrefslogtreecommitdiffstats
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 @@
#include "planck.h"
#include "backlight.h"
-#define QWERTY_LAYER 0
-#define COLEMAK_LAYER 1
-#define DVORAK_LAYER 2
-#define LOWER_LAYER 3
-#define RAISE_LAYER 4
+#define _QW 0
+#define _CM 1
+#define _DV 2
+#define _LW 3
+#define _RS 4
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-[QWERTY_LAYER] = { /* Qwerty */
- {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
- {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
- {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
- {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+[_QW] = { /* Qwerty */
+ {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
+ {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
+ {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
+ {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(2), KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
-[COLEMAK_LAYER] = { /* Colemak */
+[_CM] = { /* Colemak */
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
- {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
- {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
- {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+ {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
+ {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
+ {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(2), KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
-[DVORAK_LAYER] = { /* Dvorak */
- {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
- {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
- {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT},
- {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+[_DV] = { /* Dvorak */
+ {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
+ {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
+ {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
+ {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(2), KC_SPC, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
-[RAISE_LAYER] = { /* RAISE */
+[_RS] = { /* RAISE */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
- {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, FUNC(3), FUNC(4), FUNC(5), RESET, KC_TRNS},
- {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
+ {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
+ {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
-[LOWER_LAYER] = { /* LOWER */
- {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},
- {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)},
- {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, FUNC(3), FUNC(4), FUNC(5), RESET, KC_TRNS},
- {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
+[_LW] = { /* LOWER */
+ {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
+ {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
+ {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
+ {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}
};
const uint16_t PROGMEM fn_actions[] = {
- [1] = ACTION_LAYER_MOMENTARY(RAISE_LAYER), // to RAISE
- [2] = ACTION_LAYER_MOMENTARY(LOWER_LAYER), // to LOWER
+ [1] = ACTION_LAYER_MOMENTARY(_RS), // to RAISE
+ [2] = ACTION_LAYER_MOMENTARY(_LW), // to LOWER
- [3] = ACTION_DEFAULT_LAYER_SET(QWERTY_LAYER),
- [4] = ACTION_DEFAULT_LAYER_SET(COLEMAK_LAYER),
- [5] = ACTION_DEFAULT_LAYER_SET(DVORAK_LAYER),
+ [3] = ACTION_DEFAULT_LAYER_SET(_QW),
+ [4] = ACTION_DEFAULT_LAYER_SET(_CM),
+ [5] = ACTION_DEFAULT_LAYER_SET(_DV),
};
@@ -55,12 +55,12 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
// MACRODOWN only works in this function
switch(id) {
case 0:
- if (record->event.pressed) {
- register_code(KC_RSFT);
- backlight_step();
- } else {
- unregister_code(KC_RSFT);
- }
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+ backlight_step();
+ } else {
+ unregister_code(KC_RSFT);
+ }
break;
}
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
SRC += $(BLUEFRUIT_DIR)/main.c \
$(BLUEFRUIT_DIR)/bluefruit.c \
- ../serial_uart.c \
+ protocol/serial_uart.c \
$(PJRC_DIR)/pjrc.c \
$(PJRC_DIR)/usb_keyboard.c \
$(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 @@
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
-QUANTUM_DIR = $(TOP_DIR)/quantum
+QUANTUM_DIR = quantum
# # project specific files
SRC += $(QUANTUM_DIR)/keymap_common.c \
@@ -61,7 +61,7 @@ endif
#EXTRALDFLAGS = -Wl,--relax
# Search Path
-VPATH += $(QUANTUM_DIR)
+VPATH += $(TOP_DIR)/$(QUANTUM_DIR)
include $(TOP_DIR)/protocol/lufa.mk
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)
print("\nDEBUG: enabled.\n");
debug_enable = true;
return;
- } else if (keycode >= 0x5000 && keycode < 0x6000) {
- int when = (keycode >> 0x9) & 0x3;
- int layer = keycode & 0xFF;
- action_t action;
- action.code = ACTION_LAYER_SET(layer, when);
- return action;
+ } else if (keycode >= 0x5000 && keycode < 0x6000) {
+ // Layer movement shortcuts
+ // See .h to see constraints/usage
+ int type = (keycode >> 0x8) & 0xF;
+ if (type == 0x1) {
+ // Layer set "GOTO"
+ int when = (keycode >> 0x4) & 0x3;
+ int layer = keycode & 0xF;
+ action_t action;
+ action.code = ACTION_LAYER_SET(layer, when);
+ return action;
+ } else if (type == 0x2) {
+ // Momentary layer
+ int layer = keycode & 0xFF;
+ action_t action;
+ action.code = ACTION_LAYER_MOMENTARY(layer);
+ return action;
+ } else if (type == 0x3) {
+ // Set default layer
+ int layer = keycode & 0xFF;
+ action_t action;
+ action.code = ACTION_DEFAULT_LAYER_SET(layer);
+ return action;
+ }
#ifdef MIDI_ENABLE
} else if (keycode >= 0x6000 && keycode < 0x7000) {
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[];
#define RALT(kc) kc | 0x1400
#define RGUI(kc) kc | 0x1800
+// Aliases for shifted symbols
+#define KC_TILD LSFT(KC_GRV) // ~
+#define KC_TILDE KC_TILD
+#define KC_EXLM LSFT(KC_1) // !
+#define KC_EXCLAIM KC_EXLM
+#define KC_AT LSFT(KC_2) // @
+#define KC_HASH LSFT(KC_3) // #
+#define KC_DLR LSFT(KC_4) // $
+#define KC_DOLLAR KC_DLR
+#define KC_PERC LSFT(KC_5) // %
+#define KC_PERCENT KC_PERC
+#define KC_CIRC LSFT(KC_6) // ^
+#define KC_CIRCUMFLEX KC_CIRC
+#define KC_AMPR LSFT(KC_7) // &
+#define KC_AMPERSAND KC_AMPR
+#define KC_ASTR LSFT(KC_8) // *
+#define KC_ASTERISK KC_ASTR
+#define KC_LPRN LSFT(KC_9) // (
+#define KC_LEFT_PAREN KC_LPRN
+#define KC_RPRN LSFT(KC_0) // )
+#define KC_RIGHT_PAREN KC_RPRN
+#define KC_UNDS LSFT(KC_MINS) // _
+#define KC_UNDERSCORE KC_UNDS
+#define KC_PLUS LSFT(KC_EQL) // +
+#define KC_LCBR LSFT(KC_LBRC) // {
+#define KC_LEFT_CURLY_BRACE KC_LCBR
+#define KC_RCBR LSFT(KC_RBRC) // }
+#define KC_RIGHT_CURLY_BRACE KC_RCBR
+#define KC_PIPE LSFT(KC_SLSH) // |
+
// Alias for function layers than expand past FN31
#define FUNC(kc) kc | 0x2000
@@ -108,10 +138,18 @@ extern const uint16_t fn_actions[];
#define RESET 0x5000
#define DEBUG 0x5001
+// GOTO layer - 16 layers max
+// when:
// ON_PRESS = 1
// ON_RELEASE = 2
// ON_BOTH = 3
-#define TO(layer, when) (layer | 0x5100 | (when << 0x9))
+#define TO(layer, when) (layer | 0x5100 | (when << 0x4))
+
+// Momentary switch layer - 256 layer max
+#define MO(layer) (layer | 0x5200)
+
+// Set default layer - 256 layer max
+#define DF(layer) (layer | 0x5300)
#define MIDI(n) (n | 0x6000)