diff options
| author | Drashna Jaelre <drashna@live.com> | 2020-06-15 03:41:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-15 03:41:28 -0700 |
| commit | 357a888d805c21c9cb4917f55d558195e8b85db5 (patch) | |
| tree | fd1e8c30c3754ff89e8efd7e94ced3a1a8d92035 | |
| parent | 7f5656996ca2f5a62a148ef9165d0681ba806f07 (diff) | |
| download | qmk_firmware-357a888d805c21c9cb4917f55d558195e8b85db5.tar.gz qmk_firmware-357a888d805c21c9cb4917f55d558195e8b85db5.zip | |
[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
| -rw-r--r-- | keyboards/crkbd/keymaps/drashna/keymap.c | 12 | ||||
| -rw-r--r-- | keyboards/kyria/keymaps/drashna/config.h | 1 | ||||
| -rw-r--r-- | keyboards/kyria/keymaps/drashna/keymap.c | 48 | ||||
| -rw-r--r-- | keyboards/kyria/keymaps/drashna/rules.mk | 6 | ||||
| -rw-r--r-- | layouts/community/ergodox/drashna/config.h | 5 | ||||
| -rw-r--r-- | layouts/community/ergodox/drashna/keymap.c | 58 | ||||
| -rw-r--r-- | layouts/community/ergodox/drashna/rules.mk | 14 | ||||
| -rw-r--r-- | layouts/community/ortho_5x12/drashna/rules.mk | 11 | ||||
| -rw-r--r-- | users/drashna/.gitlab-ci.yml | 5 | ||||
| -rw-r--r-- | users/drashna/config.h | 7 | ||||
| -rw-r--r-- | users/drashna/drashna.c | 6 | ||||
| -rw-r--r-- | users/drashna/drashna.h | 3 | ||||
| -rw-r--r-- | users/drashna/oled_stuff.c | 17 | ||||
| -rw-r--r-- | users/drashna/pimoroni_trackball.c | 114 | ||||
| -rw-r--r-- | users/drashna/pimoroni_trackball.h | 18 | ||||
| -rw-r--r-- | users/drashna/process_records.c | 2 | ||||
| -rw-r--r-- | users/drashna/rgb_matrix_stuff.c | 6 | ||||
| -rw-r--r-- | users/drashna/rgb_stuff.c | 177 | ||||
| -rw-r--r-- | users/drashna/rules.mk | 10 |
19 files changed, 332 insertions, 188 deletions
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c index 0769edf3b..d9c1605ce 100644 --- a/keyboards/crkbd/keymaps/drashna/keymap.c +++ b/keyboards/crkbd/keymaps/drashna/keymap.c | |||
| @@ -121,7 +121,17 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | #ifdef OLED_DRIVER_ENABLE | 123 | #ifdef OLED_DRIVER_ENABLE |
| 124 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } | 124 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { |
| 125 | # ifndef SPLIT_KEYBOARD | ||
| 126 | if (is_master) { | ||
| 127 | # endif | ||
| 128 | return OLED_ROTATION_270; | ||
| 129 | # ifndef SPLIT_KEYBOARD | ||
| 130 | } else { | ||
| 131 | return rotation; | ||
| 132 | } | ||
| 133 | # endif | ||
| 134 | } | ||
| 125 | #endif | 135 | #endif |
| 126 | 136 | ||
| 127 | uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { | 137 | uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { |
diff --git a/keyboards/kyria/keymaps/drashna/config.h b/keyboards/kyria/keymaps/drashna/config.h index f93069ac0..5e9d8b010 100644 --- a/keyboards/kyria/keymaps/drashna/config.h +++ b/keyboards/kyria/keymaps/drashna/config.h | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | # define RGBLIGHT_SAT_STEP 8 | 32 | # define RGBLIGHT_SAT_STEP 8 |
| 33 | # define RGBLIGHT_VAL_STEP 8 | 33 | # define RGBLIGHT_VAL_STEP 8 |
| 34 | # define RGBLIGHT_SPLIT | 34 | # define RGBLIGHT_SPLIT |
| 35 | # define RGBLIGHT_LAYERS | ||
| 35 | #endif | 36 | #endif |
| 36 | 37 | ||
| 37 | // If you are using an Elite C rev3 on the slave side, uncomment the lines below: | 38 | // If you are using an Elite C rev3 on the slave side, uncomment the lines below: |
diff --git a/keyboards/kyria/keymaps/drashna/keymap.c b/keyboards/kyria/keymaps/drashna/keymap.c index 5e97ca55a..98afff19f 100644 --- a/keyboards/kyria/keymaps/drashna/keymap.c +++ b/keyboards/kyria/keymaps/drashna/keymap.c | |||
| @@ -23,7 +23,7 @@ uint8_t is_master; | |||
| 23 | LAYOUT_wrapper( \ | 23 | LAYOUT_wrapper( \ |
| 24 | KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ | 24 | KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ |
| 25 | LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ | 25 | LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ |
| 26 | OS_LSFT, CTL_T(K21), K22, K23, K24, K25, KC_NO, MEH(KC_MINS), TG(_DIABLO), KC_NO, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ | 26 | OS_LSFT, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), MEH(KC_MINS), TG(_DIABLO), KC_CAPS, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ |
| 27 | KC_MUTE, OS_LALT, KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI, UC(0x03A8), UC(0x2E2E) \ | 27 | KC_MUTE, OS_LALT, KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI, UC(0x03A8), UC(0x2E2E) \ |
| 28 | ) | 28 | ) |
| 29 | /* Re-pass though to allow templates to be used */ | 29 | /* Re-pass though to allow templates to be used */ |
| @@ -85,6 +85,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 85 | KC_LSFT, ___________________BLANK___________________, _______, _______, _______, _______, ___________________BLANK___________________, KC_RSFT, | 85 | KC_LSFT, ___________________BLANK___________________, _______, _______, _______, _______, ___________________BLANK___________________, KC_RSFT, |
| 86 | _______, _______, KC_LALT, _______, _______, _______, _______, KC_RGUI, _______, _______ | 86 | _______, _______, KC_LALT, _______, _______, _______, _______, KC_RGUI, _______, _______ |
| 87 | ), | 87 | ), |
| 88 | |||
| 89 | [_GAMEPAD] = LAYOUT_wrapper( | ||
| 90 | KC_ESC, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, | ||
| 91 | KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, | ||
| 92 | KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, _______, _______, _______, LALT(KC_PSCR), _______, _______, _______, _______, _______, _______, | ||
| 93 | _______, MAGIC_TOGGLE_NKRO, KC_V, KC_SPC, KC_H, _______, _______, _______, _______, _______ | ||
| 94 | ), | ||
| 95 | |||
| 88 | [_DIABLO] = LAYOUT_wrapper( | 96 | [_DIABLO] = LAYOUT_wrapper( |
| 89 | KC_ESC, KC_S, KC_I, KC_F, KC_M, KC_T, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, | 97 | KC_ESC, KC_S, KC_I, KC_F, KC_M, KC_T, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, |
| 90 | KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_G, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | 98 | KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_G, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, |
| @@ -172,3 +180,41 @@ void encoder_update_user(uint8_t index, bool clockwise) { | |||
| 172 | } | 180 | } |
| 173 | } | 181 | } |
| 174 | #endif | 182 | #endif |
| 183 | |||
| 184 | #ifdef RGBLIGHT_LAYERS | ||
| 185 | const rgblight_segment_t PROGMEM shift_layers[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 186 | { 8, 1, 120, 255, 255}, | ||
| 187 | { 18, 1, 120, 255, 255} | ||
| 188 | ); | ||
| 189 | const rgblight_segment_t PROGMEM control_layers[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 190 | { 6, 1, 0, 255, 255}, | ||
| 191 | { 16, 1, 0, 255, 255} | ||
| 192 | ); | ||
| 193 | const rgblight_segment_t PROGMEM alt_layers[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 194 | { 2, 1, 240, 255, 255}, | ||
| 195 | { 17, 1, 250, 255, 255} | ||
| 196 | ); | ||
| 197 | const rgblight_segment_t PROGMEM gui_layers[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 198 | { 7, 1, 51, 255, 255}, | ||
| 199 | { 12, 1, 51, 255, 255} | ||
| 200 | ); | ||
| 201 | |||
| 202 | const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( | ||
| 203 | shift_layers, | ||
| 204 | control_layers, | ||
| 205 | alt_layers, | ||
| 206 | gui_layers | ||
| 207 | ); | ||
| 208 | |||
| 209 | void keyboard_post_init_keymap(void) { | ||
| 210 | rgblight_layers = my_rgb_layers; | ||
| 211 | } | ||
| 212 | |||
| 213 | void matrix_scan_keymap(void) { | ||
| 214 | uint8_t mods = mod_config(get_mods()|get_oneshot_mods()); | ||
| 215 | rgblight_set_layer_state(0, mods & MOD_MASK_SHIFT); | ||
| 216 | rgblight_set_layer_state(1, mods & MOD_MASK_CTRL); | ||
| 217 | rgblight_set_layer_state(2, mods & MOD_MASK_ALT); | ||
| 218 | rgblight_set_layer_state(3, mods & MOD_MASK_GUI); | ||
| 219 | } | ||
| 220 | #endif | ||
diff --git a/keyboards/kyria/keymaps/drashna/rules.mk b/keyboards/kyria/keymaps/drashna/rules.mk index 2486ecd5d..0604c84bd 100644 --- a/keyboards/kyria/keymaps/drashna/rules.mk +++ b/keyboards/kyria/keymaps/drashna/rules.mk | |||
| @@ -1,17 +1,17 @@ | |||
| 1 | OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays | 1 | OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays |
| 2 | ENCODER_ENABLE = yes # ENables the use of one or more encoders | 2 | ENCODER_ENABLE = yes # ENables the use of one or more encoders |
| 3 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | 3 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow |
| 4 | RGBLIGHT_STARTUP_ANIMATION = no | 4 | RGBLIGHT_STARTUP_ANIMATION = yes |
| 5 | 5 | ||
| 6 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | 6 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration |
| 7 | MOUSEKEY_ENABLE = no # Mouse keys | 7 | MOUSEKEY_ENABLE = no # Mouse keys |
| 8 | EXTRAKEY_ENABLE = yes # Audio control and System control | 8 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 9 | CONSOLE_ENABLE = no # Console for debug | 9 | CONSOLE_ENABLE = no # Console for debug |
| 10 | COMMAND_ENABLE = no # Commands for debug and configuration | 10 | COMMAND_ENABLE = no # Commands for debug and configuration |
| 11 | NKRO_ENABLE = no # USB Nkey Rollover | 11 | NKRO_ENABLE = no # USB Nkey Rollover |
| 12 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default | 12 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default |
| 13 | MIDI_ENABLE = no # MIDI support | 13 | MIDI_ENABLE = no # MIDI support |
| 14 | UNICODE_ENABLE = yes # Unicode | 14 | UNICODE_ENABLE = no # Unicode |
| 15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
| 16 | AUDIO_ENABLE = no # Audio output on port C6 | 16 | AUDIO_ENABLE = no # Audio output on port C6 |
| 17 | FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | 17 | FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches |
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 @@ | |||
| 15 | #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Hybrid Monstrosity | 15 | #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Hybrid Monstrosity |
| 16 | 16 | ||
| 17 | #undef DEBOUNCE | 17 | #undef DEBOUNCE |
| 18 | #define DEBOUNCE 60 | 18 | #define DEBOUNCE 15 |
| 19 | 19 | ||
| 20 | #define TAPPING_TERM_PER_KEY | 20 | #define TAPPING_TERM_PER_KEY |
| 21 | 21 | ||
| @@ -30,3 +30,6 @@ | |||
| 30 | # undef RGBLIGHT_SLEEP | 30 | # undef RGBLIGHT_SLEEP |
| 31 | # endif | 31 | # endif |
| 32 | #endif | 32 | #endif |
| 33 | |||
| 34 | #define PIMORONI_TRACKBALL_INVERT_X | ||
| 35 | #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 @@ | |||
| 10 | extern rgblight_config_t rgblight_config; | 10 | extern rgblight_config_t rgblight_config; |
| 11 | #endif | 11 | #endif |
| 12 | 12 | ||
| 13 | enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE }; | 13 | enum more_custom_keycodes { |
| 14 | KC_SWAP_NUM = NEW_SAFE_RANGE, | ||
| 15 | PM_SCROLL, | ||
| 16 | PM_PRECISION, | ||
| 17 | }; | ||
| 14 | 18 | ||
| 15 | // define layer change stuff for underglow indicator | 19 | // define layer change stuff for underglow indicator |
| 16 | bool skip_leds = false; | 20 | bool skip_leds = false; |
| @@ -33,7 +37,7 @@ bool skip_leds = false; | |||
| 33 | LALT_T(KC_TAB), K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ | 37 | LALT_T(KC_TAB), K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ |
| 34 | KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ | 38 | KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ |
| 35 | KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, RCTL_T(K2A), KC_MRSF, \ | 39 | KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, RCTL_T(K2A), KC_MRSF, \ |
| 36 | KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \ | 40 | KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_BTN1, KC_BTN3, KC_BTN2, PM_SCROLL, PM_PRECISION, \ |
| 37 | OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ | 41 | OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ |
| 38 | KC_APP, KC_MENU, \ | 42 | KC_APP, KC_MENU, \ |
| 39 | KC_SPC, LT(_LOWER, KC_BSPC), OS_LWR, OS_RSE, LT(_RAISE, KC_DEL), KC_ENT \ | 43 | 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] = { | |||
| 281 | 285 | ||
| 282 | [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( | 286 | [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( |
| 283 | KC_MAKE, _______, _______, _______, _______, _______, UC_MOD, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, | 287 | KC_MAKE, _______, _______, _______, _______, _______, UC_MOD, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, |
| 284 | VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EEP_RST, | 288 | VRSN, _________________ADJUST_L1_________________, _______, _______, _________________ADJUST_R1_________________, EEP_RST, |
| 285 | _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, RGB_IDL, | 289 | _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, RGB_IDL, |
| 286 | _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, TG(_MODS), | 290 | _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, TG(_MODS), |
| 287 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 291 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
| @@ -293,6 +297,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 293 | }; | 297 | }; |
| 294 | // clang-format on | 298 | // clang-format on |
| 295 | 299 | ||
| 300 | #ifdef PIMORONI_TRACKBALL_ENABLE | ||
| 301 | void run_trackball_cleanup(void) { | ||
| 302 | if (trackball_is_scrolling()) { | ||
| 303 | trackball_set_rgbw(RGB_CYAN, 0x00); | ||
| 304 | } else if (trackball_get_precision() != 1.0) { | ||
| 305 | trackball_set_rgbw(RGB_GREEN, 0x00); | ||
| 306 | } else { | ||
| 307 | trackball_set_rgbw(RGB_MAGENTA, 0x00); | ||
| 308 | } | ||
| 309 | } | ||
| 310 | |||
| 311 | void keyboard_post_init_keymap(void) { | ||
| 312 | // trackball_set_precision(1.5); | ||
| 313 | trackball_set_rgbw(RGB_MAGENTA, 0x00); | ||
| 314 | } | ||
| 315 | void shutdown_keymap(void) { | ||
| 316 | trackball_set_rgbw(RGB_RED, 0x00); | ||
| 317 | } | ||
| 318 | #endif | ||
| 319 | |||
| 296 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | 320 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { |
| 297 | switch (keycode) { | 321 | switch (keycode) { |
| 298 | case KC_1: | 322 | case KC_1: |
| @@ -321,6 +345,34 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | |||
| 321 | eeconfig_update_user(userspace_config.raw); | 345 | eeconfig_update_user(userspace_config.raw); |
| 322 | } | 346 | } |
| 323 | break; | 347 | break; |
| 348 | #ifdef PIMORONI_TRACKBALL_ENABLE | ||
| 349 | case PM_SCROLL: | ||
| 350 | trackball_set_scrolling(record->event.pressed); | ||
| 351 | run_trackball_cleanup(); | ||
| 352 | break; | ||
| 353 | case PM_PRECISION: | ||
| 354 | if (record->event.pressed) { | ||
| 355 | trackball_set_precision(1.5); | ||
| 356 | } else { | ||
| 357 | trackball_set_precision(1); | ||
| 358 | } | ||
| 359 | run_trackball_cleanup(); | ||
| 360 | break; | ||
| 361 | #if !defined(MOUSEKEY_ENABLE) && defined(POINTING_DEVICE_ENABLE) | ||
| 362 | case KC_BTN1 ... KC_BTN3: | ||
| 363 | { | ||
| 364 | report_mouse_t currentReport = pointing_device_get_report(); | ||
| 365 | if (record->event.pressed) { | ||
| 366 | currentReport.buttons |= (1 << (keycode - KC_BTN1)); // this is defined in report.h | ||
| 367 | } else { | ||
| 368 | currentReport.buttons &= ~(1 << (keycode - KC_BTN1)); | ||
| 369 | } | ||
| 370 | pointing_device_set_report(currentReport); | ||
| 371 | pointing_device_send(); | ||
| 372 | break; | ||
| 373 | } | ||
| 374 | # endif | ||
| 375 | #endif | ||
| 324 | } | 376 | } |
| 325 | // switch (keycode) { | 377 | // switch (keycode) { |
| 326 | // case KC_P00: | 378 | // 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 @@ | |||
| 1 | BOOTMAGIC_ENABLE = lite | 1 | BOOTMAGIC_ENABLE = lite |
| 2 | TAP_DANCE_ENABLE = yes | 2 | TAP_DANCE_ENABLE = yes |
| 3 | COMMAND_ENABLE = no # Commands for debug and configuration | 3 | COMMAND_ENABLE = no # Commands for debug and configuration |
| 4 | CONSOLE_ENABLE = | 4 | CONSOLE_ENABLE = no |
| 5 | SPACE_CADET_ENABLE = no | 5 | SPACE_CADET_ENABLE = no |
| 6 | 6 | ||
| 7 | ifeq ($(strip $(KEYBOARD)), ergodox_ez) | 7 | ifeq ($(strip $(KEYBOARD)), ergodox_ez) |
| 8 | RGBLIGHT_ENABLE = yes | 8 | RGBLIGHT_ENABLE = yes |
| 9 | RGB_MATRIX_ENABLE = yes | 9 | RGB_MATRIX_ENABLE = yes |
| 10 | RGBLIGHT_TWINKLE = no | 10 | RGBLIGHT_TWINKLE = no |
| 11 | INDICATOR_LIGHTS = no | 11 | INDICATOR_LIGHTS = no |
| 12 | RGBLIGHT_STARTUP_ANIMATION = yes | 12 | RGBLIGHT_STARTUP_ANIMATION = yes |
| 13 | PIMORONI_TRACKBALL_ENABLE = yes | ||
| 14 | MOUSEKEY_ENABLE = no | ||
| 13 | endif | 15 | endif |
| 14 | 16 | ||
| 15 | UNICODE_ENABLE = yes | 17 | UNICODE_ENABLE = no |
| 16 | UNICDOEMAP_ENABLE = no | 18 | UNICDOEMAP_ENABLE = no |
| 17 | 19 | ||
| 18 | 20 | ||
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 | |||
| 7 | NKRO_ENABLE = yes | 7 | NKRO_ENABLE = yes |
| 8 | 8 | ||
| 9 | ifeq ($(strip $(KEYBOARD)), fractal) | 9 | ifeq ($(strip $(KEYBOARD)), fractal) |
| 10 | RGB_MATRIX_ENABLE = no | 10 | RGB_MATRIX_ENABLE = no |
| 11 | AUDIO_ENABLE = yes | 11 | AUDIO_ENABLE = yes |
| 12 | RGBLIGHT_ENABLE = yes | 12 | RGBLIGHT_ENABLE = yes |
| 13 | RGBLIGHT_TWINKLE = yes | 13 | RGBLIGHT_TWINKLE = yes |
| 14 | BOOTLOADER = qmk-dfu | 14 | RGBLIGHT_STARTUP_ANIMATION = yes |
| 15 | BOOTLOADER = qmk-dfu | ||
| 15 | endif | 16 | endif |
diff --git a/users/drashna/.gitlab-ci.yml b/users/drashna/.gitlab-ci.yml index 7218a21be..71d216267 100644 --- a/users/drashna/.gitlab-ci.yml +++ b/users/drashna/.gitlab-ci.yml | |||
| @@ -7,16 +7,15 @@ QMK Firmware: | |||
| 7 | GIT_SUBMODULE_STRATEGY: recursive | 7 | GIT_SUBMODULE_STRATEGY: recursive |
| 8 | tags: | 8 | tags: |
| 9 | - linux | 9 | - linux |
| 10 | image: ubuntu:18.10 | 10 | image: qmkfm/base_container |
| 11 | before_script: | 11 | before_script: |
| 12 | - apt-get update -qy | 12 | - apt-get update -qy |
| 13 | - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi git libnewlib-arm-none-eabi gcc-avr python3 unzip wget zip | 13 | - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi git libnewlib-arm-none-eabi gcc-avr python3 unzip wget zip |
| 14 | - avr-gcc --version | 14 | - avr-gcc --version |
| 15 | - uname -a | 15 | - uname -a |
| 16 | script: | 16 | script: |
| 17 | - make test:all | ||
| 18 | - make planck/rev6:default planck/rev5:default | 17 | - make planck/rev6:default planck/rev5:default |
| 19 | - make keebio/iris/rev2:drashna keebio/iris/rev2:drashna_old ergodox_ez:drashna ergodox_ez:drashna_glow keebio/viterbi/rev1:drashna orthodox/rev1:drashna orthodox/rev3:drashna crkbd:drashna planck/light:drashna planck/rev6:drashna fractal:drashna primekb/prime_m:drashna -j2 --output-sync | 18 | - make all:drashna -j2 |
| 20 | artifacts: | 19 | artifacts: |
| 21 | name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" | 20 | name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" |
| 22 | paths: | 21 | paths: |
diff --git a/users/drashna/config.h b/users/drashna/config.h index 64b4b64ab..7d83c7884 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | // Use custom magic number so that when switching branches, EEPROM always gets reset | 3 | // Use custom magic number so that when switching branches, EEPROM always gets reset |
| 4 | #define EECONFIG_MAGIC_NUMBER (uint16_t)0x1338 | 4 | #define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339 |
| 5 | 5 | ||
| 6 | /* Set Polling rate to 1000Hz */ | 6 | /* Set Polling rate to 1000Hz */ |
| 7 | #define USB_POLLING_INTERVAL_MS 1 | 7 | #define USB_POLLING_INTERVAL_MS 1 |
| @@ -98,8 +98,9 @@ | |||
| 98 | # define ONESHOT_TIMEOUT 3000 | 98 | # define ONESHOT_TIMEOUT 3000 |
| 99 | #endif // !ONESHOT_TIMEOUT | 99 | #endif // !ONESHOT_TIMEOUT |
| 100 | 100 | ||
| 101 | #ifndef QMK_KEYS_PER_SCAN | 101 | #ifdef QMK_KEYS_PER_SCAN |
| 102 | # define QMK_KEYS_PER_SCAN 4 | 102 | # undef QMK_KEYS_PER_SCAN |
| 103 | # define QMK_KEYS_PER_SCAN 1 | ||
| 103 | #endif // !QMK_KEYS_PER_SCAN | 104 | #endif // !QMK_KEYS_PER_SCAN |
| 104 | 105 | ||
| 105 | // this makes it possible to do rolling combos (zx) with keys that | 106 | // this makes it possible to do rolling combos (zx) with keys that |
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index ba19d4803..5c0f18027 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -113,13 +113,9 @@ void shutdown_user(void) { | |||
| 113 | rgblight_setrgb_red(); | 113 | rgblight_setrgb_red(); |
| 114 | #endif // RGBLIGHT_ENABLE | 114 | #endif // RGBLIGHT_ENABLE |
| 115 | #ifdef RGB_MATRIX_ENABLE | 115 | #ifdef RGB_MATRIX_ENABLE |
| 116 | # ifdef __AVR__ | ||
| 117 | rgb_matrix_set_color_all(0xFF, 0x00, 0x00); | 116 | rgb_matrix_set_color_all(0xFF, 0x00, 0x00); |
| 118 | rgb_matrix_update_pwm_buffers(); | 117 | rgb_matrix_update_pwm_buffers(); |
| 119 | # else | 118 | |
| 120 | rgb_matrix_sethsv_noeeprom(0, 255, 255); | ||
| 121 | rgb_matrix_mode_noeeprom(1); | ||
| 122 | # endif | ||
| 123 | #endif // RGB_MATRIX_ENABLE | 119 | #endif // RGB_MATRIX_ENABLE |
| 124 | shutdown_keymap(); | 120 | shutdown_keymap(); |
| 125 | } | 121 | } |
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index c10ea5114..dd2b02258 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h | |||
| @@ -34,6 +34,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 34 | #if defined(OLED_DRIVER_ENABLE) | 34 | #if defined(OLED_DRIVER_ENABLE) |
| 35 | # include "oled_stuff.h" | 35 | # include "oled_stuff.h" |
| 36 | #endif | 36 | #endif |
| 37 | #if defined(PIMORONI_TRACKBALL_ENABLE) | ||
| 38 | # include "pimoroni_trackball.h" | ||
| 39 | #endif | ||
| 37 | 40 | ||
| 38 | /* Define layer names */ | 41 | /* Define layer names */ |
| 39 | enum userspace_layers { | 42 | enum userspace_layers { |
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index 7580de1d3..6503b970e 100644 --- a/users/drashna/oled_stuff.c +++ b/users/drashna/oled_stuff.c | |||
| @@ -170,6 +170,13 @@ void render_bootmagic_status(void) { | |||
| 170 | {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, | 170 | {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, |
| 171 | }; | 171 | }; |
| 172 | 172 | ||
| 173 | bool is_bootmagic_on; | ||
| 174 | #ifdef OLED_DISPLAY_128X64 | ||
| 175 | is_bootmagic_on = !keymap_config.swap_lctl_lgui; | ||
| 176 | #else | ||
| 177 | is_bootmagic_on = keymap_config.swap_lctl_lgui; | ||
| 178 | #endif | ||
| 179 | |||
| 173 | oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false); | 180 | oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false); |
| 174 | #ifdef OLED_DISPLAY_128X64 | 181 | #ifdef OLED_DISPLAY_128X64 |
| 175 | if (keymap_config.swap_lctl_lgui) | 182 | if (keymap_config.swap_lctl_lgui) |
| @@ -177,11 +184,11 @@ void render_bootmagic_status(void) { | |||
| 177 | oled_write_P(PSTR(" "), false); | 184 | oled_write_P(PSTR(" "), false); |
| 178 | #endif | 185 | #endif |
| 179 | { | 186 | { |
| 180 | oled_write_P(logo[1][0], false); | 187 | oled_write_P(logo[1][0], is_bootmagic_on); |
| 181 | #ifdef OLED_DISPLAY_128X64 | 188 | #ifdef OLED_DISPLAY_128X64 |
| 182 | } else { | 189 | } else { |
| 183 | #endif | 190 | #endif |
| 184 | oled_write_P(logo[0][0], false); | 191 | oled_write_P(logo[0][0], !is_bootmagic_on); |
| 185 | } | 192 | } |
| 186 | oled_write_P(PSTR(" "), false); | 193 | oled_write_P(PSTR(" "), false); |
| 187 | #ifdef OLED_DISPLAY_128X64 | 194 | #ifdef OLED_DISPLAY_128X64 |
| @@ -192,11 +199,11 @@ void render_bootmagic_status(void) { | |||
| 192 | if (keymap_config.swap_lctl_lgui) | 199 | if (keymap_config.swap_lctl_lgui) |
| 193 | #endif | 200 | #endif |
| 194 | { | 201 | { |
| 195 | oled_write_P(logo[1][1], false); | 202 | oled_write_P(logo[1][1], is_bootmagic_on); |
| 196 | #ifdef OLED_DISPLAY_128X64 | 203 | #ifdef OLED_DISPLAY_128X64 |
| 197 | } else { | 204 | } else { |
| 198 | #endif | 205 | #endif |
| 199 | oled_write_P(logo[0][1], false); | 206 | oled_write_P(logo[0][1], !is_bootmagic_on); |
| 200 | } | 207 | } |
| 201 | oled_write_P(PSTR(" "), false); | 208 | oled_write_P(PSTR(" "), false); |
| 202 | #ifdef OLED_DISPLAY_128X64 | 209 | #ifdef OLED_DISPLAY_128X64 |
| @@ -233,7 +240,7 @@ __attribute__((weak)) void oled_driver_render_logo(void) { | |||
| 233 | } | 240 | } |
| 234 | 241 | ||
| 235 | void render_status_secondary(void) { | 242 | void render_status_secondary(void) { |
| 236 | #if !defined(SPLIT_TRANSPORT_MIRROR) || defined(OLED_DRIVER_128x64) | 243 | #if !defined(SPLIT_TRANSPORT_MIRROR) || defined(OLED_DISPLAY_128X64) |
| 237 | oled_driver_render_logo(); | 244 | oled_driver_render_logo(); |
| 238 | #endif | 245 | #endif |
| 239 | #ifdef SPLIT_TRANSPORT_MIRROR | 246 | #ifdef SPLIT_TRANSPORT_MIRROR |
diff --git a/users/drashna/pimoroni_trackball.c b/users/drashna/pimoroni_trackball.c new file mode 100644 index 000000000..c5bb560b3 --- /dev/null +++ b/users/drashna/pimoroni_trackball.c | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | #include "pimoroni_trackball.h" | ||
| 2 | #include "i2c_master.h" | ||
| 3 | |||
| 4 | static uint8_t scrolling = 0; | ||
| 5 | static int16_t x_offset = 0; | ||
| 6 | static int16_t y_offset = 0; | ||
| 7 | static int16_t h_offset = 0; | ||
| 8 | static int16_t v_offset = 0; | ||
| 9 | static float precisionSpeed = 1; | ||
| 10 | |||
| 11 | #ifndef I2C_TIMEOUT | ||
| 12 | # define I2C_TIMEOUT 100 | ||
| 13 | #endif | ||
| 14 | #ifndef MOUSE_DEBOUNCE | ||
| 15 | # define MOUSE_DEBOUNCE 5 | ||
| 16 | #endif | ||
| 17 | |||
| 18 | void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) { | ||
| 19 | uint8_t data[] = {0x00, red, green, blue, white}; | ||
| 20 | i2c_transmit(TRACKBALL_WRITE, data, sizeof(data), I2C_TIMEOUT); | ||
| 21 | } | ||
| 22 | |||
| 23 | int16_t mouse_offset(uint8_t positive, uint8_t negative, int16_t scale) { | ||
| 24 | int16_t offset = (int16_t)positive - (int16_t)negative; | ||
| 25 | int16_t magnitude = (int16_t)(scale * offset * offset * precisionSpeed); | ||
| 26 | return offset < 0 ? -magnitude : magnitude; | ||
| 27 | } | ||
| 28 | |||
| 29 | void update_member(int8_t* member, int16_t* offset) { | ||
| 30 | if (*offset > 127) { | ||
| 31 | *member = 127; | ||
| 32 | *offset -= 127; | ||
| 33 | } else if (*offset < -127) { | ||
| 34 | *member = -127; | ||
| 35 | *offset += 127; | ||
| 36 | } else { | ||
| 37 | *member = *offset; | ||
| 38 | *offset = 0; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | __attribute__((weak)) void trackball_check_click(bool pressed, report_mouse_t* mouse) { | ||
| 43 | if (pressed) { | ||
| 44 | mouse->buttons |= MOUSE_BTN1; | ||
| 45 | } else { | ||
| 46 | mouse->buttons &= ~MOUSE_BTN1; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | float trackball_get_precision(void) { return precisionSpeed; } | ||
| 51 | void trackball_set_precision(float precision) { precisionSpeed = precision; } | ||
| 52 | bool trackball_is_scrolling(void) { return scrolling; } | ||
| 53 | void trackball_set_scrolling(bool scroll) { scrolling = scroll; } | ||
| 54 | |||
| 55 | __attribute__((weak)) void pointing_device_init(void) { trackball_set_rgbw(0x00,0x00,0x00,0x4F); } | ||
| 56 | |||
| 57 | void pointing_device_task(void) { | ||
| 58 | static bool debounce; | ||
| 59 | static uint16_t debounce_timer; | ||
| 60 | uint8_t state[5] = {}; | ||
| 61 | if (i2c_readReg(TRACKBALL_WRITE, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) { | ||
| 62 | if (!state[4] && !debounce) { | ||
| 63 | if (scrolling) { | ||
| 64 | #ifdef PIMORONI_TRACKBALL_INVERT_X | ||
| 65 | h_offset += mouse_offset(state[2], state[3], 1); | ||
| 66 | #else | ||
| 67 | h_offset -= mouse_offset(state[2], state[3], 1); | ||
| 68 | #endif | ||
| 69 | #ifdef PIMORONI_TRACKBALL_INVERT_Y | ||
| 70 | v_offset += mouse_offset(state[1], state[0], 1); | ||
| 71 | #else | ||
| 72 | v_offset -= mouse_offset(state[1], state[0], 1); | ||
| 73 | #endif | ||
| 74 | } else { | ||
| 75 | #ifdef PIMORONI_TRACKBALL_INVERT_X | ||
| 76 | x_offset -= mouse_offset(state[2], state[3], 5); | ||
| 77 | #else | ||
| 78 | x_offset += mouse_offset(state[2], state[3], 5); | ||
| 79 | #endif | ||
| 80 | #ifdef PIMORONI_TRACKBALL_INVERT_Y | ||
| 81 | y_offset -= mouse_offset(state[1], state[0], 5); | ||
| 82 | #else | ||
| 83 | y_offset += mouse_offset(state[1], state[0], 5); | ||
| 84 | #endif | ||
| 85 | } | ||
| 86 | } else { | ||
| 87 | if (state[4]) { | ||
| 88 | debounce = true; | ||
| 89 | debounce_timer = timer_read(); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 94 | if (timer_elapsed(debounce_timer) > MOUSE_DEBOUNCE) debounce = false; | ||
| 95 | |||
| 96 | report_mouse_t mouse = pointing_device_get_report(); | ||
| 97 | |||
| 98 | trackball_check_click(state[4] & (1 << 7), &mouse); | ||
| 99 | |||
| 100 | |||
| 101 | #ifndef PIMORONI_TRACKBALL_ROTATE | ||
| 102 | update_member(&mouse.x, &x_offset); | ||
| 103 | update_member(&mouse.y, &y_offset); | ||
| 104 | update_member(&mouse.h, &h_offset); | ||
| 105 | update_member(&mouse.v, &v_offset); | ||
| 106 | #else | ||
| 107 | update_member(&mouse.x, &y_offset); | ||
| 108 | update_member(&mouse.y, &x_offset); | ||
| 109 | update_member(&mouse.h, &v_offset); | ||
| 110 | update_member(&mouse.v, &h_offset); | ||
| 111 | #endif | ||
| 112 | pointing_device_set_report(mouse); | ||
| 113 | pointing_device_send(); | ||
| 114 | } | ||
diff --git a/users/drashna/pimoroni_trackball.h b/users/drashna/pimoroni_trackball.h new file mode 100644 index 000000000..7e8a7cc81 --- /dev/null +++ b/users/drashna/pimoroni_trackball.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | #include "pointing_device.h" | ||
| 5 | |||
| 6 | #ifndef TRACKBALL_ADDRESS | ||
| 7 | # define TRACKBALL_ADDRESS 0x0A | ||
| 8 | #endif | ||
| 9 | #define TRACKBALL_WRITE ((TRACKBALL_ADDRESS << 1) | I2C_WRITE) | ||
| 10 | #define TRACKBALL_READ ((TRACKBALL_ADDRESS << 1) | I2C_READ) | ||
| 11 | |||
| 12 | void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); | ||
| 13 | void trackball_check_click(bool pressed, report_mouse_t *mouse); | ||
| 14 | |||
| 15 | float trackball_get_precision(void); | ||
| 16 | void trackball_set_precision(float precision); | ||
| 17 | bool trackball_is_scrolling(void); | ||
| 18 | void trackball_set_scrolling(bool scroll); | ||
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 101b3d95c..8e3d3356e 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c | |||
| @@ -51,7 +51,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 51 | clear_mods(); | 51 | clear_mods(); |
| 52 | clear_oneshot_mods(); | 52 | clear_oneshot_mods(); |
| 53 | #endif | 53 | #endif |
| 54 | send_string_with_delay_P(PSTR("bin/qmk"), TAP_CODE_DELAY); | 54 | send_string_with_delay_P(PSTR("qmk"), TAP_CODE_DELAY); |
| 55 | #ifndef MAKE_BOOTLOADER | 55 | #ifndef MAKE_BOOTLOADER |
| 56 | if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) | 56 | if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) |
| 57 | #endif | 57 | #endif |
diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c index 0914aab14..c9c3224fa 100644 --- a/users/drashna/rgb_matrix_stuff.c +++ b/users/drashna/rgb_matrix_stuff.c | |||
| @@ -12,14 +12,14 @@ static uint32_t hypno_timer; | |||
| 12 | 12 | ||
| 13 | void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) { | 13 | void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) { |
| 14 | HSV hsv = {hue, sat, val}; | 14 | HSV hsv = {hue, sat, val}; |
| 15 | if (hsv.v > rgb_matrix_config.hsv.v) { | 15 | if (hsv.v > rgb_matrix_get_val()) { |
| 16 | hsv.v = rgb_matrix_config.hsv.v; | 16 | hsv.v = rgb_matrix_get_val(); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | switch (mode) { | 19 | switch (mode) { |
| 20 | case 1: // breathing | 20 | case 1: // breathing |
| 21 | { | 21 | { |
| 22 | uint16_t time = scale16by8(g_rgb_counters.tick, speed / 8); | 22 | uint16_t time = scale16by8(g_rgb_timer, speed / 8); |
| 23 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | 23 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
| 24 | RGB rgb = hsv_to_rgb(hsv); | 24 | RGB rgb = hsv_to_rgb(hsv); |
| 25 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { | 25 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { |
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 06b1e3c0c..defee9ac1 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c | |||
| @@ -2,136 +2,13 @@ | |||
| 2 | #include "rgb_stuff.h" | 2 | #include "rgb_stuff.h" |
| 3 | #include "eeprom.h" | 3 | #include "eeprom.h" |
| 4 | 4 | ||
| 5 | extern rgblight_config_t rgblight_config; | 5 | bool has_initialized; |
| 6 | bool has_initialized; | ||
| 7 | 6 | ||
| 8 | void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index); } | 7 | void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index); } |
| 9 | |||
| 10 | /* Custom indicators for modifiers. | ||
| 11 | * This allows for certain lights to be lit up, based on what mods are active, giving some visual feedback. | ||
| 12 | * This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up. | ||
| 13 | */ | ||
| 14 | #ifdef INDICATOR_LIGHTS | ||
| 15 | void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | ||
| 16 | if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) { | ||
| 17 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 18 | # ifdef SHFT_LED1 | ||
| 19 | rgblight_sethsv_at(120, 255, 255, SHFT_LED1); | ||
| 20 | # endif // SHFT_LED1 | ||
| 21 | # ifdef SHFT_LED2 | ||
| 22 | rgblight_sethsv_at(120, 255, 255, SHFT_LED2); | ||
| 23 | # endif // SHFT_LED2 | ||
| 24 | } else { | ||
| 25 | # ifdef SHFT_LED1 | ||
| 26 | rgblight_sethsv_default_helper(SHFT_LED1); | ||
| 27 | # endif // SHFT_LED1 | ||
| 28 | # ifdef SHFT_LED2 | ||
| 29 | rgblight_sethsv_default_helper(SHFT_LED2); | ||
| 30 | # endif // SHFT_LED2 | ||
| 31 | } | ||
| 32 | if ((this_mod | this_osm) & MOD_MASK_CTRL) { | ||
| 33 | # ifdef CTRL_LED1 | ||
| 34 | rgblight_sethsv_at(0, 255, 255, CTRL_LED1); | ||
| 35 | # endif // CTRL_LED1 | ||
| 36 | # ifdef CTRL_LED2 | ||
| 37 | rgblight_sethsv_at(0, 255, 255, CTRL_LED2); | ||
| 38 | # endif // CTRL_LED2 | ||
| 39 | } else { | ||
| 40 | # ifdef CTRL_LED1 | ||
| 41 | rgblight_sethsv_default_helper(CTRL_LED1); | ||
| 42 | # endif // CTRL_LED1 | ||
| 43 | # ifdef CTRL_LED2 | ||
| 44 | rgblight_sethsv_default_helper(CTRL_LED2); | ||
| 45 | # endif // CTRL_LED2 | ||
| 46 | } | ||
| 47 | if ((this_mod | this_osm) & MOD_MASK_GUI) { | ||
| 48 | # ifdef GUI_LED1 | ||
| 49 | rgblight_sethsv_at(51, 255, 255, GUI_LED1); | ||
| 50 | # endif // GUI_LED1 | ||
| 51 | # ifdef GUI_LED2 | ||
| 52 | rgblight_sethsv_at(51, 255, 255, GUI_LED2); | ||
| 53 | # endif // GUI_LED2 | ||
| 54 | } else { | ||
| 55 | # ifdef GUI_LED1 | ||
| 56 | rgblight_sethsv_default_helper(GUI_LED1); | ||
| 57 | # endif // GUI_LED1 | ||
| 58 | # ifdef GUI_LED2 | ||
| 59 | rgblight_sethsv_default_helper(GUI_LED2); | ||
| 60 | # endif // GUI_LED2 | ||
| 61 | } | ||
| 62 | if ((this_mod | this_osm) & MOD_MASK_ALT) { | ||
| 63 | # ifdef ALT_LED1 | ||
| 64 | rgblight_sethsv_at(240, 255, 255, ALT_LED1); | ||
| 65 | # endif // ALT_LED1 | ||
| 66 | # ifdef GUI_LED2 | ||
| 67 | rgblight_sethsv_at(240, 255, 255, ALT_LED2); | ||
| 68 | # endif // GUI_LED2 | ||
| 69 | } else { | ||
| 70 | # ifdef GUI_LED1 | ||
| 71 | rgblight_sethsv_default_helper(ALT_LED1); | ||
| 72 | # endif // GUI_LED1 | ||
| 73 | # ifdef GUI_LED2 | ||
| 74 | rgblight_sethsv_default_helper(ALT_LED2); | ||
| 75 | # endif // GUI_LED2 | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | /* Function for the indicators */ | ||
| 81 | void matrix_scan_indicator(void) { | ||
| 82 | if (has_initialized) { | ||
| 83 | set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); | ||
| 84 | } | ||
| 85 | } | ||
| 86 | #endif // INDICATOR_LIGHTS | ||
| 87 | 8 | ||
| 88 | #ifdef RGBLIGHT_TWINKLE | 9 | #ifdef RGBLIGHT_TWINKLE |
| 89 | static rgblight_fadeout lights[RGBLED_NUM]; | 10 | static rgblight_fadeout lights[RGBLED_NUM]; |
| 90 | 11 | ||
| 91 | __attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; } | ||
| 92 | |||
| 93 | /* This function checks for used LEDs. This way, collisions don't occur and cause weird rendering */ | ||
| 94 | bool rgblight_twinkle_is_led_used(uint8_t index) { | ||
| 95 | switch (index) { | ||
| 96 | # ifdef INDICATOR_LIGHTS | ||
| 97 | # ifdef SHFT_LED1 | ||
| 98 | case SHFT_LED1: | ||
| 99 | return true; | ||
| 100 | # endif // SHFT_LED1 | ||
| 101 | # ifdef SHFT_LED2 | ||
| 102 | case SHFT_LED2: | ||
| 103 | return true; | ||
| 104 | # endif // SHFT_LED2 | ||
| 105 | # ifdef CTRL_LED1 | ||
| 106 | case CTRL_LED1: | ||
| 107 | return true; | ||
| 108 | # endif // CTRL_LED1 | ||
| 109 | # ifdef CTRL_LED2 | ||
| 110 | case CTRL_LED2: | ||
| 111 | return true; | ||
| 112 | # endif // CTRL_LED2 | ||
| 113 | # ifdef GUI_LED1 | ||
| 114 | case GUI_LED1: | ||
| 115 | return true; | ||
| 116 | # endif // GUI_LED1 | ||
| 117 | # ifdef GUI_LED2 | ||
| 118 | case GUI_LED2: | ||
| 119 | return true; | ||
| 120 | # endif // GUI_LED2 | ||
| 121 | # ifdef ALT_LED1 | ||
| 122 | case ALT_LED1: | ||
| 123 | return true; | ||
| 124 | # endif // ALT_LED1 | ||
| 125 | # ifdef ALT_LED2 | ||
| 126 | case ALT_LED2: | ||
| 127 | return true; | ||
| 128 | # endif // ALT_LED2 | ||
| 129 | # endif // INDICATOR_LIGHTS | ||
| 130 | default: | ||
| 131 | return rgblight_twinkle_is_led_used_keymap(index); | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | /* Handler for fading/twinkling effect */ | 12 | /* Handler for fading/twinkling effect */ |
| 136 | void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive | 13 | void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive |
| 137 | bool litup = false; | 14 | bool litup = false; |
| @@ -170,9 +47,6 @@ void start_rgb_light(void) { | |||
| 170 | uint8_t min_life_index = -1; | 47 | uint8_t min_life_index = -1; |
| 171 | 48 | ||
| 172 | for (uint8_t index = 0; index < RGBLED_NUM; ++index) { | 49 | for (uint8_t index = 0; index < RGBLED_NUM; ++index) { |
| 173 | if (rgblight_twinkle_is_led_used(index)) { | ||
| 174 | continue; | ||
| 175 | } | ||
| 176 | if (lights[index].enabled) { | 50 | if (lights[index].enabled) { |
| 177 | if (min_life_index == -1 || lights[index].life < min_life) { | 51 | if (min_life_index == -1 || lights[index].life < min_life) { |
| 178 | min_life = lights[index].life; | 52 | min_life = lights[index].life; |
| @@ -197,7 +71,7 @@ void start_rgb_light(void) { | |||
| 197 | light->timer = timer_read(); | 71 | light->timer = timer_read(); |
| 198 | light->life = 0xC0 + rand() % 0x40; | 72 | light->life = 0xC0 + rand() % 0x40; |
| 199 | 73 | ||
| 200 | light->hue = rgblight_config.hue + (rand() % 0xB4) - 0x54; | 74 | light->hue = rgblight_get_hue() + (rand() % 0xB4) - 0x54; |
| 201 | 75 | ||
| 202 | rgblight_sethsv_at(light->hue, 255, light->life, light_index); | 76 | rgblight_sethsv_at(light->hue, 255, light->life, light_index); |
| 203 | } | 77 | } |
| @@ -227,39 +101,52 @@ bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { | |||
| 227 | return true; | 101 | return true; |
| 228 | } | 102 | } |
| 229 | 103 | ||
| 104 | #if defined(RGBLIGHT_STARTUP_ANIMATION) | ||
| 105 | static bool is_enabled; | ||
| 106 | static bool is_rgblight_startup; | ||
| 107 | static uint8_t old_hue; | ||
| 108 | static uint16_t rgblight_startup_loop_timer; | ||
| 109 | #endif | ||
| 110 | |||
| 230 | void keyboard_post_init_rgb_light(void) { | 111 | void keyboard_post_init_rgb_light(void) { |
| 231 | #if defined(RGBLIGHT_STARTUP_ANIMATION) | 112 | #if defined(RGBLIGHT_STARTUP_ANIMATION) |
| 232 | bool is_enabled = rgblight_config.enable; | 113 | is_enabled = rgblight_is_enabled(); |
| 233 | if (userspace_config.rgb_layer_change) { | 114 | if (userspace_config.rgb_layer_change) { |
| 234 | rgblight_enable_noeeprom(); | 115 | rgblight_enable_noeeprom(); |
| 235 | } | 116 | } |
| 236 | if (rgblight_config.enable) { | 117 | if (rgblight_is_enabled()) { |
| 237 | layer_state_set_rgb_light(layer_state); | 118 | layer_state_set_rgb_light(layer_state); |
| 238 | uint16_t old_hue = rgblight_config.hue; | 119 | old_hue = rgblight_get_hue(); |
| 239 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | 120 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); |
| 240 | for (uint16_t i = 255; i > 0; i--) { | 121 | is_rgblight_startup = true; |
| 241 | rgblight_sethsv_noeeprom((i + old_hue) % 255, 255, 255); | ||
| 242 | matrix_scan(); | ||
| 243 | wait_ms(10); | ||
| 244 | } | ||
| 245 | } | 122 | } |
| 246 | if (!is_enabled) { | ||
| 247 | rgblight_disable_noeeprom(); | ||
| 248 | } | ||
| 249 | |||
| 250 | #endif | 123 | #endif |
| 251 | layer_state_set_rgb_light(layer_state); | 124 | layer_state_set_rgb_light(layer_state); |
| 252 | } | 125 | } |
| 253 | 126 | ||
| 254 | void matrix_scan_rgb_light(void) { | 127 | void matrix_scan_rgb_light(void) { |
| 255 | #ifdef RGBLIGHT_ENABLE | ||
| 256 | # ifdef RGBLIGHT_TWINKLE | 128 | # ifdef RGBLIGHT_TWINKLE |
| 257 | scan_rgblight_fadeout(); | 129 | scan_rgblight_fadeout(); |
| 258 | # endif // RGBLIGHT_ENABLE | 130 | # endif // RGBLIGHT_ENABLE |
| 259 | 131 | ||
| 260 | # ifdef INDICATOR_LIGHTS | 132 | #if defined(RGBLIGHT_STARTUP_ANIMATION) |
| 261 | matrix_scan_indicator(); | 133 | if (is_rgblight_startup && is_keyboard_master()) { |
| 262 | # endif | 134 | if (timer_elapsed(rgblight_startup_loop_timer) > 10) { |
| 135 | static uint8_t counter; | ||
| 136 | counter++; | ||
| 137 | rgblight_sethsv_noeeprom((counter + old_hue) % 255, 255, 255); | ||
| 138 | rgblight_startup_loop_timer = timer_read(); | ||
| 139 | if (counter == 255) { | ||
| 140 | is_rgblight_startup = false; | ||
| 141 | if (!is_enabled) { | ||
| 142 | rgblight_disable_noeeprom(); | ||
| 143 | } | ||
| 144 | if (userspace_config.rgb_layer_change) { | ||
| 145 | layer_state_set_rgb_light(layer_state); | ||
| 146 | } | ||
| 147 | } | ||
| 148 | } | ||
| 149 | } | ||
| 263 | #endif | 150 | #endif |
| 264 | } | 151 | } |
| 265 | 152 | ||
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 051368ff5..b7523a436 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk | |||
| @@ -22,9 +22,6 @@ endif | |||
| 22 | 22 | ||
| 23 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 23 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
| 24 | SRC += rgb_stuff.c | 24 | SRC += rgb_stuff.c |
| 25 | ifeq ($(strip $(INDICATOR_LIGHTS)), yes) | ||
| 26 | OPT_DEFS += -DINDICATOR_LIGHTS | ||
| 27 | endif | ||
| 28 | ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes) | 25 | ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes) |
| 29 | OPT_DEFS += -DRGBLIGHT_TWINKLE | 26 | OPT_DEFS += -DRGBLIGHT_TWINKLE |
| 30 | endif | 27 | endif |
| @@ -62,3 +59,10 @@ endif | |||
| 62 | ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) | 59 | ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) |
| 63 | SRC += oled_stuff.c | 60 | SRC += oled_stuff.c |
| 64 | endif | 61 | endif |
| 62 | |||
| 63 | ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes) | ||
| 64 | POINTING_DEVICE_ENABLE := yes | ||
| 65 | OPT_DEFS += -DPIMORONI_TRACKBALL_ENABLE | ||
| 66 | SRC += pimoroni_trackball.c | ||
| 67 | QUANTUM_LIB_SRC += i2c_master.c | ||
| 68 | endif | ||
