summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwanleg <32079073+wanleg@users.noreply.github.com>2018-09-25 15:39:41 -0700
committerDrashna Jaelre <drashna@live.com>2018-09-25 15:39:41 -0700
commit223081bf2b201a53fb0383d6be0cacb8cde39140 (patch)
treeebc0ffe94d3b19999392f5680958cc7fb6928113
parent61f95410666319ac5ef0cb3d533b820f45ae237c (diff)
Keymap: 4x4 pro micro (#3976)
* 4x4 - pro micro version * pro-micro setup on 4x4 * tap dance LCTL/RESET key * remove test file * more research * revert a couple un-intended edits * opt_defs version of adding custom rules.mk variables * cleanup * cleanup * cleanup * cleanup * layout edits * layout edits * keymap edit * numpad layout change * got tap dance layer-switch working * keymap changes * temporary revert * restore previous settings * misc fixes * layer order change * fix layout matrix * Update tapdances.c
-rw-r--r--keyboards/4x4/4x4.h4
-rw-r--r--layouts/community/ortho_4x12/wanleg/config.h19
-rw-r--r--layouts/community/ortho_4x12/wanleg/keymap.c17
-rw-r--r--users/wanleg/rules.mk12
-rw-r--r--users/wanleg/tapdances.c77
-rw-r--r--users/wanleg/wanleg.c6
-rw-r--r--users/wanleg/wanleg.h51
7 files changed, 158 insertions, 28 deletions
diff --git a/keyboards/4x4/4x4.h b/keyboards/4x4/4x4.h
index db67ab34e9..ec75c3e280 100644
--- a/keyboards/4x4/4x4.h
+++ b/keyboards/4x4/4x4.h
@@ -43,7 +43,7 @@
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, ___, ___, ___, ___}, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b, ___, ___, ___, ___}, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b, ___, ___, ___, ___}, \
- { K30, K31, K32, K33, K34, K35, K35, K37, K38, K39, K3a, K3b, ___, ___, ___, ___} \
+ { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3a, K3b, ___, ___, ___, ___} \
}
#define LAYOUT_ortho_4x16( \
@@ -56,7 +56,7 @@
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, K0c, K0d, K0e, K0f }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b, K1c, K1d, K1e, K1f }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b, K2c, K2d, K2e, K2f }, \
- { K30, K31, K32, K33, K34, K35, K35, K37, K38, K39, K3a, K3b, K3c, K3d, K3e, K3f } \
+ { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3a, K3b, K3c, K3d, K3e, K3f } \
}
#endif
diff --git a/layouts/community/ortho_4x12/wanleg/config.h b/layouts/community/ortho_4x12/wanleg/config.h
index 0d2cc591e3..2444b8b976 100644
--- a/layouts/community/ortho_4x12/wanleg/config.h
+++ b/layouts/community/ortho_4x12/wanleg/config.h
@@ -1,7 +1,7 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
-//QMK DFU settings (ProMicro boards)
+//QMK DFU settings (ProMicro boards with QMK bootloader)
// set top left key as bootloader mode escape key on Lets Split rev2
#if defined(KEYBOARD_lets_split_rev2)
#define QMK_LED B0
@@ -13,10 +13,25 @@
#endif
// set top left key as bootloader mode escape key on 4x4 48key layout
-#if defined(KEYBOARD_4x4)
+#if defined(KEYBOARD_4x4) && !defined(PRO_MICRO)
#define QMK_LED B0
#define QMK_ESC_OUTPUT C6 // usually COL
#define QMK_ESC_INPUT B2 // usually ROW
#endif
+// use alternate settings for 4x4 board using ProMicro instead of Micro
+// usage: make 4x4:wanleg PM=yes
+#if defined(KEYBOARD_4x4) && defined(PRO_MICRO)
+#define QMK_ESC_OUTPUT F4 // usually COL
+#define QMK_ESC_INPUT D1 // usually ROW
+#define QMK_LED B0
+
+//need to undefine standard 4x4 array before defining alternate ProMicro array
+#undef MATRIX_ROW_PINS
+#undef MATRIX_COL_PINS
+#define MATRIX_ROW_PINS { D1, D0, D4, C6 }
+//last 4 elements of the column array are are not broken out on a ProMicro (included only to preserve array structure)
+#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, B5, B4, E6, D7, F0, B7, D6, F1 }
+#endif
+
#endif
diff --git a/layouts/community/ortho_4x12/wanleg/keymap.c b/layouts/community/ortho_4x12/wanleg/keymap.c
index f6030469c0..6fe8446f6d 100644
--- a/layouts/community/ortho_4x12/wanleg/keymap.c
+++ b/layouts/community/ortho_4x12/wanleg/keymap.c
@@ -15,6 +15,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______________Qwerty_Row__2_______________,
KC_LCTL, KC_LGUI, KC_LALT, GHERKIN, SUBTER, SH_T(KC_SPC), SH_T(KC_SPC), SUPRA, KC_RGUI, KC_RALT, GHERKIN, KC_RCTL
),
+
+#elif defined(KEYBOARD_4x4)
+[_GK] = LAYOUT_ortho_4x12_wrapper(
+ _______________GherkinLike_0_______________,
+ _______________GherkinLike_1_______________,
+ _______________GherkinLike_2_______________,
+ TD(RST_TAP_DANCE), KC_LGUI, KC_LALT, NUMPAD, NUMBER, ETCETERA, KC_SPC,DIRECTION, KC_RGUI, KC_RALT, KC_DEL, KC_RCTL
+),
+
+[PAD] = LAYOUT_ortho_4x4_wrapper(
+ _______________NUMPAD_Row__0_______________,
+ _______________NUMPAD_Row__1_______________,
+ _______________NUMPAD_Row__2_______________,
+ _______________NUMPAD_Row__3_______________
+),
+
#else
[_GK] = LAYOUT_ortho_4x12_wrapper(
_______________GherkinLike_0_______________,
@@ -64,4 +80,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
______________ETCETERA_Row__2______________,
______________ETCETERA_Row__3______________
),
+
};
diff --git a/users/wanleg/rules.mk b/users/wanleg/rules.mk
index ac86769538..5630401315 100644
--- a/users/wanleg/rules.mk
+++ b/users/wanleg/rules.mk
@@ -1,8 +1,4 @@
-ifeq ($(strip $(KEYBOARD)), lets_split_rev2)
-SRC += ../../keyboards/lets_split/lets_split.c
-endif
-
-SRC += wanleg.c tapdances.c
+SRC += wanleg.c tapdances.c
TAP_DANCE_ENABLE = yes
MOUSEKEY_ENABLE = yes
@@ -12,3 +8,9 @@ MOUSEKEY_ENABLE = yes
ifeq ($(strip $(dfu)), qmk)
BOOTLOADER = qmk-dfu
endif
+
+#use alternate settings for 4x4 board using ProMicro instead of Micro
+#usage: make 4x4:wanleg PM=yes
+ifeq ($(strip $(PM)), yes)
+ OPT_DEFS += -DPRO_MICRO
+endif
diff --git a/users/wanleg/tapdances.c b/users/wanleg/tapdances.c
index 6a98b896a5..0778bf5f7e 100644
--- a/users/wanleg/tapdances.c
+++ b/users/wanleg/tapdances.c
@@ -36,7 +36,7 @@ int cur_dance (qk_tap_dance_state_t *state) {
}
///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION END /////
///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION START /////
-//instantialize an instance of 'tap' for the 'ENT' tap dance.
+//instantiate 'tap' for the 'ENT' tap dance.
static tap ENTtap_state = {
.is_press_action = true,
.state = 0
@@ -67,7 +67,7 @@ void ENT_reset (qk_tap_dance_state_t *state, void *user_data) {
ENTtap_state.state = 0;
}
-//instanalize an instance of 'tap' for the 'DEL' tap dance.
+//instantiate 'tap' for the 'DEL' tap dance.
static tap DELtap_state = {
.is_press_action = true,
.state = 0
@@ -95,7 +95,7 @@ void DEL_reset (qk_tap_dance_state_t *state, void *user_data) {
DELtap_state.state = 0;
}
-//instantialize an instance of 'tap' for the 'CAD' tap dance.
+//instantiate 'tap' for the 'CAD' tap dance.
static tap CADtap_state = {
.is_press_action = true,
.state = 0
@@ -107,7 +107,9 @@ void CAD_finished (qk_tap_dance_state_t *state, void *user_data) {
case SINGLE_TAP:
//register_code(KC_SPC);
SEND_STRING(SS_LGUI("l"));
+ #ifdef BACKLIGHT_ENABLE
backlight_set(3);
+ #endif
break;
case SINGLE_HOLD:
//register_code(KC_NO);
@@ -121,7 +123,9 @@ void CAD_finished (qk_tap_dance_state_t *state, void *user_data) {
case DOUBLE_TAP:
//register_code(KC_ENT);
SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_DELETE))));
+ #ifdef BACKLIGHT_ENABLE
backlight_set(0);
+ #endif
break;
//case DOUBLE_HOLD: register_code(KC_NO); break; //register this keycode when button is tapped and then held
case DOUBLE_HOLD:
@@ -136,7 +140,9 @@ void CAD_reset (qk_tap_dance_state_t *state, void *user_data) {
case SINGLE_TAP:
//unregister_code(KC_SPC);
SEND_STRING(SS_LGUI("l"));
+ #ifdef BACKLIGHT_ENABLE
backlight_set(3);
+ #endif
break;
case SINGLE_HOLD:
register_code(KC_NO); //(un)register this keycode when button is held and then released
@@ -145,13 +151,71 @@ void CAD_reset (qk_tap_dance_state_t *state, void *user_data) {
case DOUBLE_TAP:
//register_code(KC_ENT);
SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_DELETE))));
+ #ifdef BACKLIGHT_ENABLE
backlight_set(0);
+ #endif
break;
case DOUBLE_HOLD: register_code(KC_NO); //(un)register this keycode when button is tapped and then held, and then released
case DOUBLE_SINGLE_TAP: unregister_code(KC_NO);
}
CADtap_state.state = 0;
-}
+}
+
+//instantiate 'tap' for the 'RST' tap dance.
+static tap RSTtap_state = {
+ .is_press_action = true,
+ .state = 0
+};
+
+void RST_finished (qk_tap_dance_state_t *state, void *user_data) {
+ RSTtap_state.state = cur_dance(state);
+ switch (RSTtap_state.state) {
+ case SINGLE_TAP: register_code(KC_LCTL); break;
+ case SINGLE_HOLD: register_code(KC_LCTL); break;
+ case DOUBLE_TAP: reset_keyboard(); break;
+ case DOUBLE_HOLD: register_code(KC_NO); break;
+ case DOUBLE_SINGLE_TAP: register_code(KC_LCTL); unregister_code(KC_LCTL); register_code(KC_LCTL);
+ }
+}
+
+void RST_reset (qk_tap_dance_state_t *state, void *user_data) {
+ switch (RSTtap_state.state) {
+ case SINGLE_TAP: unregister_code(KC_LCTL); break;
+ case SINGLE_HOLD: unregister_code(KC_LCTL); break;
+ case DOUBLE_TAP: unregister_code(KC_NO); break;
+ case DOUBLE_HOLD: unregister_code(KC_NO);
+ case DOUBLE_SINGLE_TAP: unregister_code(KC_LCTL);
+ }
+ RSTtap_state.state = 0;
+}
+
+//instantiate 'tap' for the 'LYR' tap dance.
+static tap LYRtap_state = {
+ .is_press_action = true,
+ .state = 0
+};
+
+void LYR_finished (qk_tap_dance_state_t *state, void *user_data) {
+ LYRtap_state.state = cur_dance(state);
+ switch (LYRtap_state.state) {
+ case SINGLE_TAP: register_code(KC_PSLS); break;
+ case SINGLE_HOLD: register_code(KC_NO); break;
+ case DOUBLE_TAP: set_single_persistent_default_layer(_GK); break;
+ case DOUBLE_HOLD: register_code(KC_NO); break;
+ case DOUBLE_SINGLE_TAP: register_code(KC_PSLS); unregister_code(KC_PSLS); register_code(KC_PSLS);
+ }
+}
+
+void LYR_reset (qk_tap_dance_state_t *state, void *user_data) {
+ switch (LYRtap_state.state) {
+ case SINGLE_TAP: unregister_code(KC_PSLS); break;
+ case SINGLE_HOLD: unregister_code(KC_NO); break;
+ case DOUBLE_TAP: set_single_persistent_default_layer(_GK); break;
+ case DOUBLE_HOLD: unregister_code(KC_NO);
+ case DOUBLE_SINGLE_TAP: unregister_code(KC_PSLS);
+ }
+ LYRtap_state.state = 0;
+}
///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION END /////
//Tap Dance Definitions
@@ -162,8 +226,11 @@ qk_tap_dance_action_t tap_dance_actions[] = {
,[TD_Q_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_ESC)
,[ENT_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ENT_finished, ENT_reset)
,[DEL_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, DEL_finished, DEL_reset)
+ ,[RST_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, RST_finished, RST_reset)
,[CAD_TD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, CAD_finished, CAD_reset)
+ ,[LYR_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, LYR_finished, LYR_reset)
+
};
//In Layer declaration, add tap dance item in place of a key code
-//TD(TD_SFT_CAPS) \ No newline at end of file
+//TD(TD_SFT_CAPS)
diff --git a/users/wanleg/wanleg.c b/users/wanleg/wanleg.c
index 931546c153..f22c34ba30 100644
--- a/users/wanleg/wanleg.c
+++ b/users/wanleg/wanleg.c
@@ -41,6 +41,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
+ case NUMPAD:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(PAD);
+ }
+ return false;
+ break;
case SUBTER:
if (record->event.pressed) {
layer_on(SUB);
diff --git a/users/wanleg/wanleg.h b/users/wanleg/wanleg.h
index 8b98ec7ddf..65028751a9 100644
--- a/users/wanleg/wanleg.h
+++ b/users/wanleg/wanleg.h
@@ -25,7 +25,8 @@ enum userspace_layers {
NUM75,
DIR75,
ETC75,
- FN75
+ FN75,
+ PAD,
};
#elif KEYBOARD_xd75
enum userspace_layers {
@@ -49,29 +50,31 @@ enum userspace_layers {
gNUM,
gDIR,
gETC,
+ PAD,
};
#else
enum userspace_layers {
_GK = 0,
+ PAD,
_QW,
- QW75,
- GK75,
- gGK,
ONE,
SUB,
SUP,
NUM,
DIR,
ETC,
+ gGK,
gNUM,
gDIR,
gETC,
+ QW75,
+ GK75,
SUB75,
SUP75,
NUM75,
DIR75,
ETC75,
- FN75
+ FN75,
};
#endif
@@ -95,7 +98,8 @@ enum userspace_custom_keycodes {
NUMBER75,
DIRECTION75,
ETCETERA75,
- FUNCTION75
+ FUNCTION75,
+ NUMPAD,
};
@@ -107,6 +111,8 @@ enum {
,ENT_TAP_DANCE
,DEL_TAP_DANCE
,CAD_TD
+ ,RST_TAP_DANCE
+ ,LYR_TAP_DANCE
};
#endif
@@ -123,6 +129,7 @@ enum {
#define LAYOUT_ortho_5x10_wrapper(...) LAYOUT_ortho_5x10(__VA_ARGS__)
#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__)
#define LAYOUT_ortho_5x15_wrapper(...) LAYOUT_ortho_5x15(__VA_ARGS__)
+#define LAYOUT_ortho_4x4_wrapper(...) LAYOUT_ortho_4x4(__VA_ARGS__)
// Blocks for each of the major keyboard layouts
// Organized so we can quickly adapt and modify all of them
@@ -141,7 +148,7 @@ enum {
* | A | S | D | F | G | H | J | K | L | SPACE |
* | | | | | | | | | |SFThold |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | Z | X | C | V/gNUM | B/gETC | N | M/gDIR | ,/GUI | ./ALT | BKSC |
+ * | Z | X | C | V/gNUM | B/gETC | N | M/gDIR | ,/GUI | ./ALT | BSPC |
* | SFThold| | | | | | | | |CTRLhold|
* '-----------------------------------------------------------------------------------------'
*/
@@ -168,7 +175,7 @@ enum {
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | F11 | F12 | | | | ENTER | SHIFT | GUI | ./ALT | BKSC |
+ * | F11 | F12 | | | | ENTER | SHIFT | GUI | ./ALT | BSPC |
* | | | | | | | | | |CTRLhold|
* '-----------------------------------------------------------------------------------------'
*/
@@ -191,12 +198,12 @@ enum {
/* Gherkin-Like
* .-----------------------------------------------------------------------------------------------------------.
- * | ESC | Q//ESC | W | E | R | T | Y | U | I | O | P | BACKSP |
+ * | ESC | Q//ESC | W | E | R | T | Y | U | I | O | P | BSPC |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | TAB | A | S | D | F | G | H | J | K | L | SPACE | ' |
* | | | | | | | | | | |SFThold | |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * |SFT/CAPS| Z | X | C | V/NUM | B/ETC | N | M/DIR | ,/GUI | ./ALT | BKSC | ENT/SFT|
+ * |SFT/CAPS| Z | X | C | V/NUM | B/ETC | N | M/DIR | ,/GUI | ./ALT | BSPC | ENT/SFT|
* | |SFThold | | | | | | | | |CTRLhold| |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LCTRL | LGUI | ALT | ONEHAND| NUM | ETC | SPACE | DIR | RGUI | ALT | DEL | CTRL |
@@ -210,7 +217,7 @@ enum {
/* Qwerty
* .-------------------------------------------------------------------------------------.
- * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
+ * | Esc | Q | W | E | R | T | Y | U | I | O | P | BSPC |
* |-------+------+------+------+------+-------------+------+------+------+------+-------|
* | Tab | A | S | D | F | G | H | J | K | L | ; | ' |
* |-------+------+------+------+------+------|------+------+------+------+------+-------|
@@ -246,7 +253,7 @@ enum {
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | | F11 | F12 | | | | | | RGUI | ./ALT | BKSC | |
+ * | | F11 | F12 | | | | | | RGUI | ./ALT | BSPC | |
* | | | | | | | | | | |CTRLhold| |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | | | gherkin| | | | ENTER | SHIFT | | | | |
@@ -259,11 +266,11 @@ enum {
/* Gherkin Numbers
* .-----------------------------------------------------------------------------------------------------------.
- * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | BACKSP |
+ * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | BSPC |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | | F11 | F12 | | | | ENTER | SHIFT | RGUI | ./ALT | BKSC | |
+ * | | F11 | F12 | | | | ENTER | SHIFT | RGUI | ./ALT | BSPC | |
* | | | | | | | | | | |CTRLhold| |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | | | | | | | ENTER | SHIFT | RGUI | | | |
@@ -307,4 +314,20 @@ enum {
#define ______________ETCETERA_Row__2______________ _______, _______________Gherkin_ETC_2_______________, _______
#define ______________ETCETERA_Row__3______________ _______, _______, _______, _______, _______, _______, LALT(LCTL(KC_DEL)), _______, _______, _______, _______, _______
+/* Single 4x4 board only
+ * .-----------------------------------.
+ * | 7 | 8 | 9 | BSPC |
+ * |--------+--------+--------+--------|
+ * | 4 | 5 | 6 | SPACE |
+ * |--------+--------+--------+--------|
+ * | 1 | 2 | 3 | ENTER |
+ * |--------+--------+--------+--------|
+ * | 0 |/ //_GK | . | - |
+ * '-----------------------------------'
+ */
+
+#define _______________NUMPAD_Row__0_______________ KC_KP_7, KC_KP_8, KC_KP_9, KC_BSPC
+#define _______________NUMPAD_Row__1_______________ KC_KP_4, KC_KP_5, KC_KP_6, KC_SPC
+#define _______________NUMPAD_Row__2_______________ KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT
+#define _______________NUMPAD_Row__3_______________ KC_KP_0, TD(LYR_TAP_DANCE), KC_KP_DOT, KC_PMNS
#endif // !USERSPACE