summaryrefslogtreecommitdiff
path: root/keyboards/hub16/keymaps/default/keymap.c
diff options
context:
space:
mode:
authorJosh Johnson <josh@joshajohnson.com>2020-06-15 19:17:30 +1000
committerGitHub <noreply@github.com>2020-06-15 02:17:30 -0700
commitda76734fe0aba64140d4d127161cc4390776ffd7 (patch)
tree3e05a8c528af167180cc02d1b4c9e7870c88b423 /keyboards/hub16/keymaps/default/keymap.c
parentc029c5b187508755b2030354906a55d1c5349a9e (diff)
downloadqmk_firmware-da76734fe0aba64140d4d127161cc4390776ffd7.tar.gz
qmk_firmware-da76734fe0aba64140d4d127161cc4390776ffd7.zip
[Keyboard] Hub16 keymap bugfix (#9345)
Diffstat (limited to 'keyboards/hub16/keymaps/default/keymap.c')
-rwxr-xr-xkeyboards/hub16/keymaps/default/keymap.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/keyboards/hub16/keymaps/default/keymap.c b/keyboards/hub16/keymaps/default/keymap.c
index 2d12dba0d4..d3cad67ae1 100755
--- a/keyboards/hub16/keymaps/default/keymap.c
+++ b/keyboards/hub16/keymaps/default/keymap.c
@@ -21,16 +21,18 @@
// Keyboard Layers
enum keyboard_layers{
_BASE = 0,
- _CONTROL
+ _CTRL
};
// Tap Dance Declarations
-enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 };
+void td_ctrl (qk_tap_dance_state_t *state, void *user_data);
+
+enum tap_dance { CTRL = 0, BASE = 1 };
qk_tap_dance_action_t tap_dance_actions[] = {
- // Tap once for standard key, twice to toggle to control layer
- [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL),
- [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)};
+ // Tap once for standard key on base layer, twice to toggle to control layer
+ [CTRL] = ACTION_TAP_DANCE_FN(td_ctrl),
+ [BASE] = ACTION_TAP_DANCE_LAYER_MOVE(_______, _BASE)};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT( /* Base */
@@ -38,19 +40,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_A, KC_B, KC_C, KC_D,
KC_E, KC_F, KC_G, KC_H,
KC_I, KC_J, KC_K, KC_L,
- KC_M, KC_N, KC_O, TD(TD_TO_LED)
+ KC_M, KC_N, KC_O, TD(CTRL)
),
- [_CONTROL] = LAYOUT( /* LED Control */
+ [_CTRL] = LAYOUT( /* Control */
KC_NO, KC_NO,
_______, RGB_MOD, RGB_RMOD, RGB_TOG,
RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI,
RGB_SAD, RGB_SAI, _______, _______,
- _______, _______, RESET, TD(TD_TO_DEFAULT)
+ _______, _______, RESET, TD(BASE)
),
};
-// Keyboard is setup to 'warp' the pressed key with F24,
+// Keyboard is setup to 'wrap' the pressed key with an unused Fxx key,
// allowing for easy differentiation from a real keyboard.
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* Left Encoder */
@@ -99,3 +101,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
+
+// Below works around TD() not running key press through process_record_user.
+// Fixes bug of CTRL layer move key not being wrapped in by modifier on single tap
+void td_ctrl (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ register_code(KC_WRAP);
+ tap_code(KC_P);
+ unregister_code(KC_WRAP);
+ } else if (state->count == 2) {
+ layer_move(_CTRL);
+ }
+} \ No newline at end of file