From 357a888d805c21c9cb4917f55d558195e8b85db5 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 15 Jun 2020 03:41:28 -0700 Subject: [Keymap] Drashna's Keymap Update - Display Edition (#9282) OLED Display fixes Add support for RGBLIGHT Layers Add gaming layer to corn and kyria RGBLight Startup Animation fixes and improvements (uses matrix_scan now!) Pimoroni Trackball support added (IT'S RGB!!!) Fix issues due to code changes --- layouts/community/ergodox/drashna/config.h | 5 ++- layouts/community/ergodox/drashna/keymap.c | 58 +++++++++++++++++++++++++-- layouts/community/ergodox/drashna/rules.mk | 14 ++++--- layouts/community/ortho_5x12/drashna/rules.mk | 11 ++--- 4 files changed, 73 insertions(+), 15 deletions(-) (limited to 'layouts') diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index 8f1c9f6a2..8ad589f93 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -15,7 +15,7 @@ #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Hybrid Monstrosity #undef DEBOUNCE -#define DEBOUNCE 60 +#define DEBOUNCE 15 #define TAPPING_TERM_PER_KEY @@ -30,3 +30,6 @@ # undef RGBLIGHT_SLEEP # endif #endif + +#define PIMORONI_TRACKBALL_INVERT_X +#define PIMORONI_TRACKBALL_INVERT_Y diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index cb256e5e5..8f5aaf6cd 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -10,7 +10,11 @@ extern rgblight_config_t rgblight_config; #endif -enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE }; +enum more_custom_keycodes { + KC_SWAP_NUM = NEW_SAFE_RANGE, + PM_SCROLL, + PM_PRECISION, +}; // define layer change stuff for underglow indicator bool skip_leds = false; @@ -33,7 +37,7 @@ bool skip_leds = false; LALT_T(KC_TAB), K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, RCTL_T(K2A), KC_MRSF, \ - KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \ + KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_BTN1, KC_BTN3, KC_BTN2, PM_SCROLL, PM_PRECISION, \ OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ KC_APP, KC_MENU, \ KC_SPC, LT(_LOWER, KC_BSPC), OS_LWR, OS_RSE, LT(_RAISE, KC_DEL), KC_ENT \ @@ -281,7 +285,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( KC_MAKE, _______, _______, _______, _______, _______, UC_MOD, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, - VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EEP_RST, + VRSN, _________________ADJUST_L1_________________, _______, _______, _________________ADJUST_R1_________________, EEP_RST, _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, RGB_IDL, _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, TG(_MODS), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -293,6 +297,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; // clang-format on +#ifdef PIMORONI_TRACKBALL_ENABLE +void run_trackball_cleanup(void) { + if (trackball_is_scrolling()) { + trackball_set_rgbw(RGB_CYAN, 0x00); + } else if (trackball_get_precision() != 1.0) { + trackball_set_rgbw(RGB_GREEN, 0x00); + } else { + trackball_set_rgbw(RGB_MAGENTA, 0x00); + } +} + +void keyboard_post_init_keymap(void) { + // trackball_set_precision(1.5); + trackball_set_rgbw(RGB_MAGENTA, 0x00); +} +void shutdown_keymap(void) { + trackball_set_rgbw(RGB_RED, 0x00); +} +#endif + bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_1: @@ -321,6 +345,34 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { eeconfig_update_user(userspace_config.raw); } break; +#ifdef PIMORONI_TRACKBALL_ENABLE + case PM_SCROLL: + trackball_set_scrolling(record->event.pressed); + run_trackball_cleanup(); + break; + case PM_PRECISION: + if (record->event.pressed) { + trackball_set_precision(1.5); + } else { + trackball_set_precision(1); + } + run_trackball_cleanup(); + break; +#if !defined(MOUSEKEY_ENABLE) && defined(POINTING_DEVICE_ENABLE) + case KC_BTN1 ... KC_BTN3: + { + report_mouse_t currentReport = pointing_device_get_report(); + if (record->event.pressed) { + currentReport.buttons |= (1 << (keycode - KC_BTN1)); // this is defined in report.h + } else { + currentReport.buttons &= ~(1 << (keycode - KC_BTN1)); + } + pointing_device_set_report(currentReport); + pointing_device_send(); + break; + } +# endif +#endif } // switch (keycode) { // case KC_P00: diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk index 387bd20f6..51b4c9a60 100644 --- a/layouts/community/ergodox/drashna/rules.mk +++ b/layouts/community/ergodox/drashna/rules.mk @@ -1,18 +1,20 @@ BOOTMAGIC_ENABLE = lite TAP_DANCE_ENABLE = yes COMMAND_ENABLE = no # Commands for debug and configuration -CONSOLE_ENABLE = +CONSOLE_ENABLE = no SPACE_CADET_ENABLE = no ifeq ($(strip $(KEYBOARD)), ergodox_ez) - RGBLIGHT_ENABLE = yes - RGB_MATRIX_ENABLE = yes - RGBLIGHT_TWINKLE = no - INDICATOR_LIGHTS = no + RGBLIGHT_ENABLE = yes + RGB_MATRIX_ENABLE = yes + RGBLIGHT_TWINKLE = no + INDICATOR_LIGHTS = no RGBLIGHT_STARTUP_ANIMATION = yes + PIMORONI_TRACKBALL_ENABLE = yes + MOUSEKEY_ENABLE = no endif -UNICODE_ENABLE = yes +UNICODE_ENABLE = no UNICDOEMAP_ENABLE = no diff --git a/layouts/community/ortho_5x12/drashna/rules.mk b/layouts/community/ortho_5x12/drashna/rules.mk index b5d55a681..2c59c614f 100644 --- a/layouts/community/ortho_5x12/drashna/rules.mk +++ b/layouts/community/ortho_5x12/drashna/rules.mk @@ -7,9 +7,10 @@ TAP_DANCE_ENABLE = no NKRO_ENABLE = yes ifeq ($(strip $(KEYBOARD)), fractal) - RGB_MATRIX_ENABLE = no - AUDIO_ENABLE = yes - RGBLIGHT_ENABLE = yes - RGBLIGHT_TWINKLE = yes - BOOTLOADER = qmk-dfu + RGB_MATRIX_ENABLE = no + AUDIO_ENABLE = yes + RGBLIGHT_ENABLE = yes + RGBLIGHT_TWINKLE = yes + RGBLIGHT_STARTUP_ANIMATION = yes + BOOTLOADER = qmk-dfu endif -- cgit v1.2.3