diff options
| author | Josh Johnson <josh@joshajohnson.com> | 2020-02-25 01:14:09 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-24 14:14:09 +0000 |
| commit | a2c0c1479cbe527cfa223b4957d230bf1e8a431f (patch) | |
| tree | cf7cbbe4794a9045136aab24e321b48211dac8a5 /keyboards/hub16 | |
| parent | 20e1c8c571ba1d197421ff14555bf2ab873a080f (diff) | |
| download | qmk_firmware-a2c0c1479cbe527cfa223b4957d230bf1e8a431f.tar.gz qmk_firmware-a2c0c1479cbe527cfa223b4957d230bf1e8a431f.zip | |
Hub16 - Bug removal + clean up code (#8227)
* bugfixes + cleaned up code
* typo
* Update keyboards/hub16/keymaps/no_mod/keymap.c
Co-Authored-By: Ryan <fauxpark@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/hub16')
| -rwxr-xr-x | keyboards/hub16/keymaps/default/keymap.c | 19 | ||||
| -rwxr-xr-x | keyboards/hub16/keymaps/no_mod/keymap.c | 37 |
2 files changed, 38 insertions, 18 deletions
diff --git a/keyboards/hub16/keymaps/default/keymap.c b/keyboards/hub16/keymaps/default/keymap.c index a77c8bc78..2d12dba0d 100755 --- a/keyboards/hub16/keymaps/default/keymap.c +++ b/keyboards/hub16/keymaps/default/keymap.c | |||
| @@ -18,16 +18,22 @@ | |||
| 18 | // Function key we are 'wrapping' usual key presses in | 18 | // Function key we are 'wrapping' usual key presses in |
| 19 | #define KC_WRAP KC_F24 | 19 | #define KC_WRAP KC_F24 |
| 20 | 20 | ||
| 21 | // Keyboard Layers | ||
| 22 | enum keyboard_layers{ | ||
| 23 | _BASE = 0, | ||
| 24 | _CONTROL | ||
| 25 | }; | ||
| 26 | |||
| 21 | // Tap Dance Declarations | 27 | // Tap Dance Declarations |
| 22 | enum { TD_TO_LED = 0, TD_TO_DEFAULT = 1 }; | 28 | enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 }; |
| 23 | 29 | ||
| 24 | qk_tap_dance_action_t tap_dance_actions[] = { | 30 | qk_tap_dance_action_t tap_dance_actions[] = { |
| 25 | // Tap once for HID, twice to toggle layer 1 | 31 | // Tap once for standard key, twice to toggle to control layer |
| 26 | [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 1), | 32 | [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL), |
| 27 | [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 0)}; | 33 | [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)}; |
| 28 | 34 | ||
| 29 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 30 | [0] = LAYOUT( /* Base */ | 36 | [_BASE] = LAYOUT( /* Base */ |
| 31 | KC_S, KC_V, | 37 | KC_S, KC_V, |
| 32 | KC_A, KC_B, KC_C, KC_D, | 38 | KC_A, KC_B, KC_C, KC_D, |
| 33 | KC_E, KC_F, KC_G, KC_H, | 39 | KC_E, KC_F, KC_G, KC_H, |
| @@ -35,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 35 | KC_M, KC_N, KC_O, TD(TD_TO_LED) | 41 | KC_M, KC_N, KC_O, TD(TD_TO_LED) |
| 36 | ), | 42 | ), |
| 37 | 43 | ||
| 38 | [1] = LAYOUT( /* LED Control */ | 44 | [_CONTROL] = LAYOUT( /* LED Control */ |
| 39 | KC_NO, KC_NO, | 45 | KC_NO, KC_NO, |
| 40 | _______, RGB_MOD, RGB_RMOD, RGB_TOG, | 46 | _______, RGB_MOD, RGB_RMOD, RGB_TOG, |
| 41 | RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, | 47 | RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, |
| @@ -72,7 +78,6 @@ void encoder_update_user(uint8_t index, bool clockwise) { | |||
| 72 | 78 | ||
| 73 | // Below stolen from TaranVH (https://github.com/TaranVH/2nd-keyboard/blob/master/HASU_USB/F24/keymap.c) | 79 | // Below stolen from TaranVH (https://github.com/TaranVH/2nd-keyboard/blob/master/HASU_USB/F24/keymap.c) |
| 74 | // Shoutout to drashna on the QMK discord for basically writing this for me.... :P | 80 | // Shoutout to drashna on the QMK discord for basically writing this for me.... :P |
| 75 | |||
| 76 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 81 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 77 | static uint8_t f24_tracker; | 82 | static uint8_t f24_tracker; |
| 78 | switch (keycode) { | 83 | switch (keycode) { |
diff --git a/keyboards/hub16/keymaps/no_mod/keymap.c b/keyboards/hub16/keymaps/no_mod/keymap.c index c86ffcc16..7c57ffbfe 100755 --- a/keyboards/hub16/keymaps/no_mod/keymap.c +++ b/keyboards/hub16/keymaps/no_mod/keymap.c | |||
| @@ -15,19 +15,22 @@ | |||
| 15 | */ | 15 | */ |
| 16 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
| 17 | 17 | ||
| 18 | // Function key we are 'wrapping' usual key presses in | 18 | // Keyboard Layers |
| 19 | #define KC_WRAP KC_F24 | 19 | enum keyboard_layers{ |
| 20 | _BASE = 0, | ||
| 21 | _CONTROL | ||
| 22 | }; | ||
| 20 | 23 | ||
| 21 | // Tap Dance Declarations | 24 | // Tap Dance Declarations |
| 22 | enum { TD_TO_LED = 0, TD_TO_DEFAULT = 1 }; | 25 | enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 }; |
| 23 | 26 | ||
| 24 | qk_tap_dance_action_t tap_dance_actions[] = { | 27 | qk_tap_dance_action_t tap_dance_actions[] = { |
| 25 | // Tap once for HID, twice to toggle layer 1 | 28 | // Tap once for standard key, twice to toggle to control layer |
| 26 | [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 1), | 29 | [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL), |
| 27 | [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(_______, 0)}; | 30 | [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)}; |
| 28 | 31 | ||
| 29 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 32 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 30 | [0] = LAYOUT( /* Base */ | 33 | [_BASE] = LAYOUT( /* Base */ |
| 31 | KC_S, KC_V, | 34 | KC_S, KC_V, |
| 32 | KC_A, KC_B, KC_C, KC_D, | 35 | KC_A, KC_B, KC_C, KC_D, |
| 33 | KC_E, KC_F, KC_G, KC_H, | 36 | KC_E, KC_F, KC_G, KC_H, |
| @@ -35,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 35 | KC_M, KC_N, KC_O, TD(TD_TO_LED) | 38 | KC_M, KC_N, KC_O, TD(TD_TO_LED) |
| 36 | ), | 39 | ), |
| 37 | 40 | ||
| 38 | [1] = LAYOUT( /* LED Control */ | 41 | [_CONTROL] = LAYOUT( /* LED Control */ |
| 39 | KC_NO, KC_NO, | 42 | KC_NO, KC_NO, |
| 40 | _______, RGB_MOD, RGB_RMOD, RGB_TOG, | 43 | _______, RGB_MOD, RGB_RMOD, RGB_TOG, |
| 41 | RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, | 44 | RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, |
| @@ -44,8 +47,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 44 | ), | 47 | ), |
| 45 | }; | 48 | }; |
| 46 | 49 | ||
| 47 | // Keyboard is setup to 'warp' the pressed key with F24, | ||
| 48 | // allowing for easy differentiation from a real keyboard. | ||
| 49 | void encoder_update_user(uint8_t index, bool clockwise) { | 50 | void encoder_update_user(uint8_t index, bool clockwise) { |
| 50 | if (index == 0) { /* Left Encoder */ | 51 | if (index == 0) { /* Left Encoder */ |
| 51 | if (clockwise) { | 52 | if (clockwise) { |
| @@ -60,4 +61,18 @@ void encoder_update_user(uint8_t index, bool clockwise) { | |||
| 60 | tap_code(KC_T); | 61 | tap_code(KC_T); |
| 61 | } | 62 | } |
| 62 | } | 63 | } |
| 63 | } \ No newline at end of file | 64 | } |
| 65 | |||
| 66 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 67 | switch (keycode) { | ||
| 68 | // Example of "pressing" CONTROL+SHIFT+V instead of "A" on keyboard | ||
| 69 | // More info: https://docs.qmk.fm/#/feature_macros | ||
| 70 | // case KC_A: | ||
| 71 | // if (record->event.pressed) { | ||
| 72 | // SEND_STRING(SS_LCTL(SS_LSFT("v"))); | ||
| 73 | // } else { | ||
| 74 | // } | ||
| 75 | // break; | ||
| 76 | } | ||
| 77 | return true; | ||
| 78 | }; | ||
