diff options
Diffstat (limited to 'layouts/community/ergodox/drashna/keymap.c')
| -rw-r--r-- | layouts/community/ergodox/drashna/keymap.c | 120 |
1 files changed, 112 insertions, 8 deletions
diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 360a2d9c6..df9be62b7 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c | |||
| @@ -20,8 +20,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | #ifdef UNICODEMAP_ENABLE | 20 | #ifdef UNICODEMAP_ENABLE |
| 21 | #include "drashna_unicode.h" | 21 | #include "drashna_unicode.h" |
| 22 | #endif // UNICODEMAP_ENABLE | 22 | #endif // UNICODEMAP_ENABLE |
| 23 | extern uint8_t input_mode; | ||
| 23 | 24 | ||
| 24 | 25 | #ifdef RGB_MATRIX_ENABLE | |
| 26 | extern bool g_suspend_state; | ||
| 27 | extern rgb_config_t rgb_matrix_config; | ||
| 28 | #endif | ||
| 29 | extern userspace_config_t userspace_config; | ||
| 25 | 30 | ||
| 26 | //enum more_custom_keycodes { | 31 | //enum more_custom_keycodes { |
| 27 | // KC_P00 = NEW_SAFE_RANGE | 32 | // KC_P00 = NEW_SAFE_RANGE |
| @@ -40,7 +45,7 @@ bool skip_leds = false; | |||
| 40 | KC_TAB, K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ | 45 | KC_TAB, K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ |
| 41 | KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \ | 46 | KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \ |
| 42 | KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, CTL_T(K2A), KC_MRSF, \ | 47 | KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, CTL_T(K2A), KC_MRSF, \ |
| 43 | KC_GRV, OSM(MOD_MEH),OSM(MOD_LGUI),KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC_SHRG, \ | 48 | KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \ |
| 44 | OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ | 49 | OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \ |
| 45 | KC_HOME, KC_PGUP, \ | 50 | KC_HOME, KC_PGUP, \ |
| 46 | LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) \ | 51 | LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) \ |
| @@ -198,7 +203,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 198 | */ | 203 | */ |
| 199 | [_GAMEPAD] = LAYOUT_ergodox_pretty_wrapper( | 204 | [_GAMEPAD] = LAYOUT_ergodox_pretty_wrapper( |
| 200 | KC_ESC, KC_NO, KC_1, KC_2, KC_3, HYPR(KC_Q), HYPR(KC_GRV), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, | 205 | KC_ESC, KC_NO, KC_1, KC_2, KC_3, HYPR(KC_Q), HYPR(KC_GRV), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, |
| 201 | KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | 206 | KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, |
| 202 | KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_I, KC_O, KC_NO, KC_NO, KC_NO, KC_NO, | 207 | KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_I, KC_O, KC_NO, KC_NO, KC_NO, KC_NO, |
| 203 | KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, TG(_GAMEPAD), KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, | 208 | KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, TG(_GAMEPAD), KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, |
| 204 | KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, | 209 | KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, |
| @@ -263,7 +268,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 263 | 268 | ||
| 264 | [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( | 269 | [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( |
| 265 | KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, | 270 | KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, |
| 266 | VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EPRM, | 271 | VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EEP_RST, |
| 267 | _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG(_MODS), | 272 | _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG(_MODS), |
| 268 | _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, KC_MPLY, | 273 | _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, KC_MPLY, |
| 269 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 274 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
| @@ -290,10 +295,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | |||
| 290 | return true; | 295 | return true; |
| 291 | } | 296 | } |
| 292 | 297 | ||
| 293 | void matrix_init_keymap(void) { // Runs boot tasks for keyboard | ||
| 294 | }; | ||
| 295 | |||
| 296 | |||
| 297 | void matrix_scan_keymap(void) { // runs frequently to update info | 298 | void matrix_scan_keymap(void) { // runs frequently to update info |
| 298 | uint8_t modifiers = get_mods(); | 299 | uint8_t modifiers = get_mods(); |
| 299 | uint8_t led_usb_state = host_keyboard_leds(); | 300 | uint8_t led_usb_state = host_keyboard_leds(); |
| @@ -335,3 +336,106 @@ bool indicator_is_this_led_used_keyboard(uint8_t index) { | |||
| 335 | return false; | 336 | return false; |
| 336 | } | 337 | } |
| 337 | } | 338 | } |
| 339 | |||
| 340 | |||
| 341 | #ifdef RGB_MATRIX_ENABLE | ||
| 342 | |||
| 343 | void suspend_power_down_keymap(void) { | ||
| 344 | rgb_matrix_set_suspend_state(true); | ||
| 345 | rgb_matrix_config.enable = false; | ||
| 346 | } | ||
| 347 | |||
| 348 | void suspend_wakeup_init_keymap(void) { | ||
| 349 | rgb_matrix_config.enable = true; | ||
| 350 | rgb_matrix_set_suspend_state(false); | ||
| 351 | } | ||
| 352 | |||
| 353 | void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) { | ||
| 354 | rgb_led led; | ||
| 355 | for (int i = 0; i < DRIVER_LED_TOTAL; i++) { | ||
| 356 | led = g_rgb_leds[i]; | ||
| 357 | if (led.matrix_co.raw < 0xFF) { | ||
| 358 | if (led.modifier) { | ||
| 359 | rgb_matrix_set_color( i, red, green, blue ); | ||
| 360 | } | ||
| 361 | } | ||
| 362 | } | ||
| 363 | } | ||
| 364 | |||
| 365 | void rgb_matrix_indicators_user(void) { | ||
| 366 | if (g_suspend_state || !rgb_matrix_config.enable || !userspace_config.rgb_layer_change) return; | ||
| 367 | |||
| 368 | switch (biton32(layer_state)) { | ||
| 369 | case _MODS: | ||
| 370 | rgb_matrix_layer_helper(0xFF, 0xFF, 0x00); break; | ||
| 371 | case _GAMEPAD: | ||
| 372 | rgb_matrix_layer_helper(0xFF, 0x80, 0x00); | ||
| 373 | rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q | ||
| 374 | rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W | ||
| 375 | rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E | ||
| 376 | rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R | ||
| 377 | rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A | ||
| 378 | rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S | ||
| 379 | rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D | ||
| 380 | rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F | ||
| 381 | |||
| 382 | rgb_matrix_set_color(27, 0xFF, 0xFF, 0xFF); // 1 | ||
| 383 | rgb_matrix_set_color(26, 0x00, 0xFF, 0x00); // 2 | ||
| 384 | rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3 | ||
| 385 | |||
| 386 | break; | ||
| 387 | case _DIABLO: | ||
| 388 | rgb_matrix_layer_helper(0xFF, 0x00, 0x00); break; | ||
| 389 | case _RAISE: | ||
| 390 | rgb_matrix_layer_helper(0xFF, 0xFF, 0x00); break; | ||
| 391 | case _LOWER: | ||
| 392 | rgb_matrix_layer_helper(0x00, 0xFF, 0x00); break; | ||
| 393 | case _ADJUST: | ||
| 394 | rgb_matrix_layer_helper(0xFF, 0x00, 0x00); break; | ||
| 395 | default: | ||
| 396 | switch (biton32(default_layer_state)) { | ||
| 397 | case _QWERTY: | ||
| 398 | rgb_matrix_layer_helper(0x00, 0xFF, 0xFF); break; | ||
| 399 | case _COLEMAK: | ||
| 400 | rgb_matrix_layer_helper(0xFF, 0x00, 0xFF); break; | ||
| 401 | case _DVORAK: | ||
| 402 | rgb_matrix_layer_helper(0x00, 0xFF, 0x00); break; | ||
| 403 | case _WORKMAN: | ||
| 404 | rgb_matrix_layer_helper(0xD9, 0xA5, 0x21); break; | ||
| 405 | } | ||
| 406 | } | ||
| 407 | #if 0 | ||
| 408 | if (this_mod & MODS_SHIFT_MASK || this_led & (1<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) { | ||
| 409 | rgb_matrix_set_color(24, 0x00, 0xFF, 0x00); | ||
| 410 | rgb_matrix_set_color(36, 0x00, 0xFF, 0x00); | ||
| 411 | } | ||
| 412 | if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) { | ||
| 413 | rgb_matrix_set_color(25, 0xFF, 0x00, 0x00); | ||
| 414 | rgb_matrix_set_color(34, 0xFF, 0x00, 0x00); | ||
| 415 | rgb_matrix_set_color(37, 0xFF, 0x00, 0x00); | ||
| 416 | |||
| 417 | } | ||
| 418 | if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) { | ||
| 419 | rgb_matrix_set_color(39, 0xFF, 0xD9, 0x00); | ||
| 420 | } | ||
| 421 | if (this_mod & MODS_ALT_MASK || this_osm & MODS_ALT_MASK) { | ||
| 422 | rgb_matrix_set_color(38, 0x00, 0x00, 0xFF); | ||
| 423 | } | ||
| 424 | #endif | ||
| 425 | } | ||
| 426 | |||
| 427 | void matrix_init_keymap(void) { | ||
| 428 | #ifdef RGB_MATRIX_KEYPRESSES | ||
| 429 | rgblight_mode(RGB_MATRIX_MULTISPLASH); | ||
| 430 | #else | ||
| 431 | rgblight_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON); | ||
| 432 | #endif | ||
| 433 | |||
| 434 | input_mode = 2; | ||
| 435 | } | ||
| 436 | |||
| 437 | #else | ||
| 438 | void matrix_init_keymap(void) { | ||
| 439 | input_mode = 2; | ||
| 440 | } | ||
| 441 | #endif //RGB_MATRIX_INIT | ||
