aboutsummaryrefslogtreecommitdiff
path: root/keyboards/hub16
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/hub16')
-rwxr-xr-xkeyboards/hub16/config.h3
-rwxr-xr-xkeyboards/hub16/keymaps/default/keymap.c32
-rwxr-xr-xkeyboards/hub16/readme.md4
3 files changed, 26 insertions, 13 deletions
diff --git a/keyboards/hub16/config.h b/keyboards/hub16/config.h
index c7dec995e..ed14178d6 100755
--- a/keyboards/hub16/config.h
+++ b/keyboards/hub16/config.h
@@ -81,8 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
81#define DEBOUNCE 20 81#define DEBOUNCE 20
82 82
83/* ENCODER THINGS */ 83/* ENCODER THINGS */
84 84// #define ENCODER_DIRECTION_FLIP
85// #define NUMBER_OF_ENCODERS 2
86#define ENCODERS_PAD_A \ 85#define ENCODERS_PAD_A \
87 { F6, B4 } 86 { F6, B4 }
88#define ENCODERS_PAD_B \ 87#define ENCODERS_PAD_B \
diff --git a/keyboards/hub16/keymaps/default/keymap.c b/keyboards/hub16/keymaps/default/keymap.c
index 2d12dba0d..d3cad67ae 100755
--- a/keyboards/hub16/keymaps/default/keymap.c
+++ b/keyboards/hub16/keymaps/default/keymap.c
@@ -21,16 +21,18 @@
21// Keyboard Layers 21// Keyboard Layers
22enum keyboard_layers{ 22enum keyboard_layers{
23 _BASE = 0, 23 _BASE = 0,
24 _CONTROL 24 _CTRL
25}; 25};
26 26
27// Tap Dance Declarations 27// Tap Dance Declarations
28enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 }; 28void td_ctrl (qk_tap_dance_state_t *state, void *user_data);
29
30enum tap_dance { CTRL = 0, BASE = 1 };
29 31
30qk_tap_dance_action_t tap_dance_actions[] = { 32qk_tap_dance_action_t tap_dance_actions[] = {
31 // Tap once for standard key, twice to toggle to control layer 33 // Tap once for standard key on base layer, twice to toggle to control layer
32 [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL), 34 [CTRL] = ACTION_TAP_DANCE_FN(td_ctrl),
33 [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)}; 35 [BASE] = ACTION_TAP_DANCE_LAYER_MOVE(_______, _BASE)};
34 36
35const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 37const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
36 [_BASE] = LAYOUT( /* Base */ 38 [_BASE] = LAYOUT( /* Base */
@@ -38,19 +40,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 KC_A, KC_B, KC_C, KC_D, 40 KC_A, KC_B, KC_C, KC_D,
39 KC_E, KC_F, KC_G, KC_H, 41 KC_E, KC_F, KC_G, KC_H,
40 KC_I, KC_J, KC_K, KC_L, 42 KC_I, KC_J, KC_K, KC_L,
41 KC_M, KC_N, KC_O, TD(TD_TO_LED) 43 KC_M, KC_N, KC_O, TD(CTRL)
42 ), 44 ),
43 45
44 [_CONTROL] = LAYOUT( /* LED Control */ 46 [_CTRL] = LAYOUT( /* Control */
45 KC_NO, KC_NO, 47 KC_NO, KC_NO,
46 _______, RGB_MOD, RGB_RMOD, RGB_TOG, 48 _______, RGB_MOD, RGB_RMOD, RGB_TOG,
47 RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, 49 RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI,
48 RGB_SAD, RGB_SAI, _______, _______, 50 RGB_SAD, RGB_SAI, _______, _______,
49 _______, _______, RESET, TD(TD_TO_DEFAULT) 51 _______, _______, RESET, TD(BASE)
50 ), 52 ),
51}; 53};
52 54
53// Keyboard is setup to 'warp' the pressed key with F24, 55// Keyboard is setup to 'wrap' the pressed key with an unused Fxx key,
54// allowing for easy differentiation from a real keyboard. 56// allowing for easy differentiation from a real keyboard.
55void encoder_update_user(uint8_t index, bool clockwise) { 57void encoder_update_user(uint8_t index, bool clockwise) {
56 if (index == 0) { /* Left Encoder */ 58 if (index == 0) { /* Left Encoder */
@@ -99,3 +101,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
99 } 101 }
100 return true; 102 return true;
101} 103}
104
105// Below works around TD() not running key press through process_record_user.
106// Fixes bug of CTRL layer move key not being wrapped in by modifier on single tap
107void td_ctrl (qk_tap_dance_state_t *state, void *user_data) {
108 if (state->count == 1) {
109 register_code(KC_WRAP);
110 tap_code(KC_P);
111 unregister_code(KC_WRAP);
112 } else if (state->count == 2) {
113 layer_move(_CTRL);
114 }
115} \ No newline at end of file
diff --git a/keyboards/hub16/readme.md b/keyboards/hub16/readme.md
index 996fa4463..1409af5bb 100755
--- a/keyboards/hub16/readme.md
+++ b/keyboards/hub16/readme.md
@@ -1,8 +1,8 @@
1# Hub16 1# Hub16
2 2
3Hub16 is a 16 Key Macro Pad with inbuilt USB 2.0 hub and dual rotary encoders. 3Hub16 is a 16 Key Macro Pad with an inbuilt USB 2.0 hub and dual rotary encoders.
4 4
5For more information regarding the keyboard, please visit the [Hub16 Webpage](https://www.joshajohnson.com/hub16-keyboard/) or [GitHub Repo](https://github.com/joshajohnson/Hub16). 5For more information regarding the keyboard, please visit the [Hub16 Website](https://www.joshajohnson.com/hub16-keyboard/) or [GitHub Repo](https://github.com/joshajohnson/Hub16).
6 6
7* Keyboard Maintainer: [Josh Johnson](https://github.com/joshajohnson) 7* Keyboard Maintainer: [Josh Johnson](https://github.com/joshajohnson)
8* Hardware Supported: Hub16 PCB (atmega32u4) 8* Hardware Supported: Hub16 PCB (atmega32u4)