diff options
author | Drashna Jaelre <drashna@live.com> | 2021-07-26 17:59:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-26 17:59:49 -0700 |
commit | eb46c954dcf99d842967cc6095827316ffddd291 (patch) | |
tree | 69f0a5ade629b63731c246888c0e067312e0970f /keyboards/handwired/tractyl_manuform/5x6_right | |
parent | 368efb5d2b834d995ba24cd23349327bab02918b (diff) |
[Keymap] Drashna's Defaults cleanup (#13722)
Diffstat (limited to 'keyboards/handwired/tractyl_manuform/5x6_right')
5 files changed, 203 insertions, 76 deletions
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c index 1766312e1b..af9cbda49d 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c @@ -32,4 +32,8 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { {{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}}, {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}}}; + +# ifdef ENCODER_MAP_ENABLE +const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = {1, 0}; +# endif #endif diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h index 9dc46f2e60..915582c07e 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h @@ -30,52 +30,56 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_COLS 6 // wiring of each half -#define MATRIX_COL_PINS { C0, C1, C2, C3, C4, C5 } -#define MATRIX_ROW_PINS { F7, F6, F5, F4, F3, F2 } +#define MATRIX_COL_PINS \ + { C0, C1, C2, C3, C4, C5 } +#define MATRIX_ROW_PINS \ + { F7, F6, F5, F4, F3, F2 } #define DIODE_DIRECTION COL2ROW // WS2812 RGB LED strip input and number of LEDs #define RGB_DI_PIN E7 -#define RGBLED_NUM 58 +#define RGBLED_NUM 20 #define RGBLIGHT_SPLIT -#define RGBLED_SPLIT { 30, 28 } +#define RGBLED_SPLIT \ + { 10, 10 } #define RGBLIGHT_SLEEP // #define RGBW -#define RGBLIGHT_LIMIT_VAL 50 +#define RGBLIGHT_LIMIT_VAL 100 /* define if matrix has ghost */ //#define MATRIX_HAS_GHOST /* number of backlight levels */ // #define BACKLIGHT_LEVELS 3 -#define DEBUG_LED_PIN D6 +#define DEBUG_LED_PIN D6 -#define ROTATIONAL_TRANSFORM_ANGLE -25 +#define ROTATIONAL_TRANSFORM_ANGLE -25 /* Bootmagic Lite key configuration */ -#define BOOTMAGIC_LITE_ROW 0 -#define BOOTMAGIC_LITE_COLUMN 0 -#define BOOTMAGIC_LITE_ROW_RIGHT 6 -#define BOOTMAGIC_LITE_COLUMN_RIGHT 5 +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 +#define BOOTMAGIC_LITE_ROW_RIGHT 6 +#define BOOTMAGIC_LITE_COLUMN_RIGHT 5 -#define AUDIO_PIN C6 -#define AUDIO_PIN_ALT B7 +#define AUDIO_PIN C6 +#define AUDIO_PIN_ALT B7 -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 -#define DYNAMIC_KEYMAP_LAYER_COUNT 16 +#define DYNAMIC_KEYMAP_LAYER_COUNT 16 #define LAYER_STATE_16BIT /* serial.c configuration for split keyboard */ #define SOFT_SERIAL_PIN D2 #define EE_HANDS -#define ENCODERS_PAD_A { D5 } -#define ENCODERS_PAD_B { D6 } -#define ENCODER_RESOLUTION 1 +#define ENCODERS_PAD_A \ + { D5 } +#define ENCODERS_PAD_B \ + { D6 } +#define ENCODER_RESOLUTION 4 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCE 5 /* disable action features */ //#define NO_ACTION_LAYER diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c index 6b6d1ab83c..a57da64d54 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c @@ -28,70 +28,44 @@ SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \ LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ - OS_LGUI, OS_LALT, OS_RGUI, OS_RALT, \ - KC_PSCR, KC_GRV, MEH_T(KC_BTN3), \ + OS_LALT, OS_LGUI, OS_RGUI, OS_RALT, \ + KC_MUTE, KC_GRV, KC_BTN3, \ KC_SPC, OS_LGUI, KC_ENT, \ BK_LWER, TT(_MOUSE), TT(_MOUSE), DL_RAIS \ ) -#define LAYOUT_5x6_right_base_wrapper(...) LAYOUT_5x6_right_base(__VA_ARGS__) - +#define LAYOUT_base_wrapper(...) LAYOUT_5x6_right_base(__VA_ARGS__) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QWERTY] = LAYOUT_5x6_right_base_wrapper( + [_DEFAULT_LAYER_1] = LAYOUT_base_wrapper( _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ ), - [_COLEMAK] = LAYOUT_5x6_right_base_wrapper( + [_DEFAULT_LAYER_2] = LAYOUT_base_wrapper( + ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________, + ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________, + ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________ + ), + [_DEFAULT_LAYER_3] = LAYOUT_base_wrapper( _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ ), - [_DVORAK] = LAYOUT_5x6_right_base_wrapper( + [_DEFAULT_LAYER_4] = LAYOUT_base_wrapper( _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ ), - [_WORKMAN] = LAYOUT_5x6_right_base_wrapper( - _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, - _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, - _________________WORKMAN_L3________________, _________________WORKMAN_R3________________ - ), - - [_NORMAN] = LAYOUT_5x6_right_base_wrapper( - _________________NORMAN_L1_________________, _________________NORMAN_L1_________________, - _________________NORMAN_L2_________________, _________________NORMAN_R2_________________, - _________________NORMAN_L3_________________, _________________NORMAN_R3_________________ - ), - - [_MALTRON] = LAYOUT_5x6_right_base_wrapper( - _________________MALTRON_L1________________, _________________MALTRON_R1________________, - _________________MALTRON_L2________________, _________________MALTRON_R2________________, - _________________MALTRON_L3________________, _________________MALTRON_R3________________ - ), - - [_EUCALYN] = LAYOUT_5x6_right_base_wrapper( - _________________EUCALYN_L1________________, _________________EUCALYN_R1________________, - _________________EUCALYN_L2________________, _________________EUCALYN_R2________________, - _________________EUCALYN_L3________________, _________________EUCALYN_R3________________ - ), - - [_CARPLAX] = LAYOUT_5x6_right_base_wrapper( - _____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________, - _____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________, - _____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________ - ), - [_MOUSE] = LAYOUT_5x6_right( _______, _______, _______, _______, _______, _______, DPI_CONFIG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______, _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, _______, _______, _______, _______, - _______, _______, _______, + _______, _______, KC_BTN3, _______, _______, _______, _______, _______, _______, _______ ), @@ -146,6 +120,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, KC_NUKE, _______ ), }; + +#define BASE_ENCODERS { { KC_VOLD, KC_VOLU }, { KC_WH_D, KC_WH_U } } + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_DEFAULT_LAYER_1] = BASE_ENCODERS, + [_DEFAULT_LAYER_2] = BASE_ENCODERS, + [_DEFAULT_LAYER_3] = BASE_ENCODERS, + [_DEFAULT_LAYER_4] = BASE_ENCODERS, + [_GAMEPAD] = { { _______, _______ }, { _______, _______ } }, + [_DIABLO] = { { _______, _______ }, { _______, _______ } }, + [_MOUSE] = { { _______, _______ }, { KC_WH_D, KC_WH_U } }, + [_MEDIA] = { { _______, _______ }, { _______, _______ } }, + [_RAISE] = { { _______, _______ }, { KC_PGDN, KC_PGUP } }, + [_LOWER] = { { RGB_MOD, RGB_RMOD}, { RGB_HUD, RGB_HUI } }, + [_ADJUST] = { { CK_DOWN, CK_UP }, { _______, _______ } }, +}; +#else +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + tap_code_delay(clockwise ? KC_VOLU : KC_VOLD, 5); + } else if (index == 1) { + tap_code_delay(clockwise ? KC_WH_U : KC_WH_D, 5); + } + return false; +} +#endif // clang-format on #ifdef POINTING_DEVICE_ENABLE @@ -189,26 +190,27 @@ void matrix_scan_keymap(void) { bool process_record_keymap(uint16_t keycode, keyrecord_t* record) { switch (keycode) { - case TT(_MOUSE): { - if (record->event.pressed) { - mouse_keycode_tracker++; - } else { + case TT(_MOUSE): + { + if (record->event.pressed) { + mouse_keycode_tracker++; + } else { # if TAPPING_TOGGLE != 0 - if (record->tap.count == TAPPING_TOGGLE) { - tap_toggling ^= 1; + if (record->tap.count == TAPPING_TOGGLE) { + tap_toggling ^= 1; # if TAPPING_TOGGLE == 1 - if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1; + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1; # else - if (!tap_toggling) mouse_keycode_tracker -= record->tap.count; + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count; # endif - } else { - mouse_keycode_tracker--; - } + } else { + mouse_keycode_tracker--; + } # endif + } + mouse_timer = timer_read(); + break; } - mouse_timer = timer_read(); - break; - } case MO(_MOUSE): case DPI_CONFIG: case KC_MS_UP ... KC_MS_WH_RIGHT: @@ -216,11 +218,12 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t* record) { mouse_timer = timer_read(); break; default: + if (IS_NOEVENT(record->event)) break; if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) { layer_off(_MOUSE); } mouse_keycode_tracker = 0; - mouse_debounce_timer = timer_read(); + mouse_debounce_timer = timer_read(); break; } return true; @@ -228,7 +231,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t* record) { layer_state_t layer_state_set_keymap(layer_state_t state) { if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) { - state |= (1UL << _MOUSE); + state |= ((layer_state_t)1 << _MOUSE); } return state; } @@ -245,6 +248,4 @@ void matrix_init_keymap(void) { #endif } -void keyboard_post_init_keymap(void) { - matrix_init_keymap(); -} +void keyboard_post_init_keymap(void) { matrix_init_keymap(); } diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rgblight_breathe_table.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rgblight_breathe_table.h new file mode 100644 index 0000000000..fb921079bf --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rgblight_breathe_table.h @@ -0,0 +1,117 @@ +#pragma once + +#define RGBLIGHT_EFFECT_BREATHE_TABLE + +// clang-format off + +// Breathing center: 1.85 +// Breathing max: 100 + +const uint8_t PROGMEM rgblight_effect_breathe_table[] = { +#if RGBLIGHT_BREATHE_TABLE_SIZE == 256 + 0x0D, 0x0E, 0x0E, 0x0F, 0x0F, 0x10, 0x10, 0x11, + 0x11, 0x12, 0x13, 0x13, 0x14, 0x14, 0x15, 0x16, + 0x16, 0x17, 0x18, 0x18, 0x19, 0x19, 0x1A, 0x1B, + 0x1B, 0x1C, 0x1D, 0x1E, 0x1E, 0x1F, 0x20, 0x20, + 0x21, 0x22, 0x22, 0x23, 0x24, 0x25, 0x25, 0x26, + 0x27, 0x28, 0x28, 0x29, 0x2A, 0x2B, 0x2B, 0x2C, + 0x2D, 0x2E, 0x2E, 0x2F, 0x30, 0x31, 0x31, 0x32, + 0x33, 0x34, 0x34, 0x35, 0x36, 0x37, 0x38, 0x38, + 0x39, 0x3A, 0x3B, 0x3B, 0x3C, 0x3D, 0x3D, 0x3E, + 0x3F, 0x40, 0x40, 0x41, 0x42, 0x42, 0x43, 0x44, + 0x44, 0x45, 0x46, 0x46, 0x47, 0x48, 0x48, 0x49, + 0x4A, 0x4A, 0x4B, 0x4B, 0x4C, 0x4C, 0x4D, 0x4D, + 0x4E, 0x4E, 0x4F, 0x4F, 0x50, 0x50, 0x51, 0x51, + 0x51, 0x52, 0x52, 0x53, 0x53, 0x53, 0x54, 0x54, + 0x54, 0x54, 0x55, 0x55, 0x55, 0x55, 0x55, 0x56, + 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, + 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, + 0x56, 0x55, 0x55, 0x55, 0x55, 0x55, 0x54, 0x54, + 0x54, 0x54, 0x53, 0x53, 0x53, 0x52, 0x52, 0x51, + 0x51, 0x51, 0x50, 0x50, 0x4F, 0x4F, 0x4E, 0x4E, + 0x4D, 0x4D, 0x4C, 0x4C, 0x4B, 0x4B, 0x4A, 0x4A, + 0x49, 0x48, 0x48, 0x47, 0x46, 0x46, 0x45, 0x44, + 0x44, 0x43, 0x42, 0x42, 0x41, 0x40, 0x40, 0x3F, + 0x3E, 0x3D, 0x3D, 0x3C, 0x3B, 0x3B, 0x3A, 0x39, + 0x38, 0x38, 0x37, 0x36, 0x35, 0x34, 0x34, 0x33, + 0x32, 0x31, 0x31, 0x30, 0x2F, 0x2E, 0x2E, 0x2D, + 0x2C, 0x2B, 0x2B, 0x2A, 0x29, 0x28, 0x28, 0x27, + 0x26, 0x25, 0x25, 0x24, 0x23, 0x22, 0x22, 0x21, + 0x20, 0x20, 0x1F, 0x1E, 0x1E, 0x1D, 0x1C, 0x1B, + 0x1B, 0x1A, 0x19, 0x19, 0x18, 0x18, 0x17, 0x16, + 0x16, 0x15, 0x14, 0x14, 0x13, 0x13, 0x12, 0x11, + 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E, 0x0D +#endif + +#if RGBLIGHT_BREATHE_TABLE_SIZE == 128 + 0x0D, 0x0E, 0x0F, 0x10, + 0x11, 0x13, 0x14, 0x15, + 0x16, 0x18, 0x19, 0x1A, + 0x1B, 0x1D, 0x1E, 0x20, + 0x21, 0x22, 0x24, 0x25, + 0x27, 0x28, 0x2A, 0x2B, + 0x2D, 0x2E, 0x30, 0x31, + 0x33, 0x34, 0x36, 0x38, + 0x39, 0x3B, 0x3C, 0x3D, + 0x3F, 0x40, 0x42, 0x43, + 0x44, 0x46, 0x47, 0x48, + 0x4A, 0x4B, 0x4C, 0x4D, + 0x4E, 0x4F, 0x50, 0x51, + 0x51, 0x52, 0x53, 0x54, + 0x54, 0x55, 0x55, 0x55, + 0x56, 0x56, 0x56, 0x56, + 0x56, 0x56, 0x56, 0x56, + 0x56, 0x55, 0x55, 0x54, + 0x54, 0x53, 0x53, 0x52, + 0x51, 0x50, 0x4F, 0x4E, + 0x4D, 0x4C, 0x4B, 0x4A, + 0x49, 0x48, 0x46, 0x45, + 0x44, 0x42, 0x41, 0x40, + 0x3E, 0x3D, 0x3B, 0x3A, + 0x38, 0x37, 0x35, 0x34, + 0x32, 0x31, 0x2F, 0x2E, + 0x2C, 0x2B, 0x29, 0x28, + 0x26, 0x25, 0x23, 0x22, + 0x20, 0x1F, 0x1E, 0x1C, + 0x1B, 0x19, 0x18, 0x17, + 0x16, 0x14, 0x13, 0x12, + 0x11, 0x10, 0x0F, 0x0E +#endif + +#if RGBLIGHT_BREATHE_TABLE_SIZE == 64 + 0x0D, 0x0F, + 0x11, 0x14, + 0x16, 0x19, + 0x1B, 0x1E, + 0x21, 0x24, + 0x27, 0x2A, + 0x2D, 0x30, + 0x33, 0x36, + 0x39, 0x3C, + 0x3F, 0x42, + 0x44, 0x47, + 0x4A, 0x4C, + 0x4E, 0x50, + 0x51, 0x53, + 0x54, 0x55, + 0x56, 0x56, + 0x56, 0x56, + 0x56, 0x55, + 0x54, 0x53, + 0x51, 0x4F, + 0x4D, 0x4B, + 0x49, 0x46, + 0x44, 0x41, + 0x3E, 0x3B, + 0x38, 0x35, + 0x32, 0x2F, + 0x2C, 0x29, + 0x26, 0x23, + 0x20, 0x1E, + 0x1B, 0x18, + 0x16, 0x13, + 0x11, 0x0F +#endif +}; + +static const int table_scale = 256 / sizeof(rgblight_effect_breathe_table); diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk index 7e0eee8bdc..b95b166d8d 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk @@ -8,4 +8,5 @@ UNICODE_ENABLE = yes OLED_DRIVER_ENABLE = yes WPM_ENABLE = yes ENCODER_ENABLE = yes +ENCODER_MAP_ENABLE = yes # DEBOUNCE_TYPE = sym_eager_pk |