void matrix_scan_user(void) { #ifdef RGBLIGHT_ENABLE static uint8_t old_layer = 255; uint8_t new_layer = biton32(layer_state); // Color of the Icons. if (old_layer != new_layer) { switch (new_layer) { case _PS: // #31C5F0 rgblight_setrgb(49, 197, 240); break; case _AI: // #FF8011 rgblight_setrgb(255, 128, 17); break; case _PR: // #E788FF rgblight_setrgb(231, 136, 255); break; case _XD: // #FF2BC2 rgblight_setrgb(255, 43, 194); break; } old_layer = new_layer; } #endif }
void matrix_init_user(void) { ergodox_led_all_on(); rgblight_init(); rgblight_enable(); rgblight_setrgb(255, 0, 0); for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) { ergodox_led_all_set(i); wait_ms(5); } rgblight_setrgb(255, 255, 0); wait_ms(1000); for (int i = LED_BRIGHTNESS_LO; i > 0; i--) { ergodox_led_all_set(i); wait_ms(10); } rgblight_setrgb(0, 255, 255); ergodox_led_all_off(); wait_ms(1000); rgblight_effect_knight(50); }
void led_set_user( uint8_t usb_led ) { static uint8_t old_usb_led = 0; wait_ms( 10 ); /* gets rid of tick */ if ( (usb_led & (1 << USB_LED_CAPS_LOCK) ) && !(old_usb_led & (1 << USB_LED_CAPS_LOCK) ) ) { /* CAPS on */ caps= true; rgblight_setrgb( 0,0,0 ); rgblight_setrgb_at(RGB_Caps_Color,12); // caps key #ifdef AUDIO_ENABLE PLAY_SONG( tone_caps ); #endif }else if ( !(usb_led & (1 << USB_LED_CAPS_LOCK) ) && (old_usb_led & (1 << USB_LED_CAPS_LOCK) ) ) { /* CAPS off */ caps= false; if (RGB_TAP_STATE==false){ rgblight_mode( RGB_LAYER0_mode ); }else{ rgblight_mode(1); rgblight_setrgb( 0,0,0 ); } #ifdef AUDIO_ENABLE PLAY_SONG( tone_caps ); #endif } old_usb_led = usb_led; } // End of led_set_user
uint32_t layer_state_set_user(uint32_t state) { if (state == 0 && edit == true) { mode = rgblight_get_mode(); hue = rgblight_get_hue(); sat = rgblight_get_sat(); val = rgblight_get_val(); edit = false; } switch (biton32(state)) { case 1: rgblight_mode(1); rgblight_setrgb(0xD3, 0x7F, 0xED); break; case 2: rgblight_mode(1); rgblight_setrgb(0xFF, 0x00, 0x00); edit = true; break; default: rgblight_mode(mode); rgblight_sethsv(hue, sat, val); break; } return state; }
// The Macros const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { if (record->event.pressed) { switch(id) { case 0: return MACRO(D(LGUI), D(LSFT), T(3), U(LSFT), U(LGUI), END); // Mac print screen case 1: return MACRO(D(LGUI), D(LSFT), T(4), U(LSFT), U(LGUI), END); // Mac print area case 2: return MACRO(D(LCTL), D(LSFT), D(LGUI), T(3), D(LCTL), D(LSFT), D(LGUI), END); // Mac print screen to clipboard case 3: return MACRO(D(LCTL), D(LSFT), D(LGUI), T(4), D(LCTL), D(LSFT), D(LGUI), END); // Mac print area to clipboard case 4: return MACRO(D(LCTL), T(UP), U(LCTL), END); // Mac mission control case 5: return MACRO(D(LCTL), T(DOWN), U(LCTL), END); // Mac app windows case 6: return MACRO(D(LGUI), T(SPC), U(LGUI), END); // Mac spotlight search case 7: return MACRO(D(LCTL), T(LEFT), U(LCTL), END); // Mac mission left case 8: return MACRO(D(LCTL), T(RGHT), U(LCTL), END); // Mac mission right case 9: rgblight_setrgb(0xff, 0xff, 0xff); // White rgb shortcut break; } } return MACRO_NONE; };
void rgblight_effect_rgbtest(void) { static uint8_t pos = 0; static uint16_t last_timer = 0; static uint8_t maxval = 0; uint8_t g; uint8_t r; uint8_t b; if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0])) { return; } if( maxval == 0 ) { LED_TYPE tmp_led; sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); maxval = tmp_led.r; } last_timer = timer_read(); g = r = b = 0; switch( pos ) { case 0: r = maxval; break; case 1: g = maxval; break; case 2: b = maxval; break; } rgblight_setrgb(r, g, b); pos = (pos + 1) % 3; }
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { if (rgblight_config.enable) { if (rgblight_config.mode == RGBLIGHT_MODE_STATIC_LIGHT) { // same static color LED_TYPE tmp_led; sethsv(hue, sat, val, &tmp_led); rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); } else { // all LEDs in same color if ( 1 == 0 ) { //dummy } #ifdef RGBLIGHT_EFFECT_BREATHING else if (rgblight_config.mode >= RGBLIGHT_MODE_BREATHING && rgblight_config.mode <= RGBLIGHT_MODE_BREATHING_end) { // breathing mode, ignore the change of val, use in memory value instead val = rgblight_config.val; } #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_MOOD && rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_MOOD_end) { // rainbow mood, ignore the change of hue hue = rgblight_config.hue; } #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL else if (rgblight_config.mode >= RGBLIGHT_MODE_RAINBOW_SWIRL && rgblight_config.mode <= RGBLIGHT_MODE_RAINBOW_SWIRL_end) { // rainbow swirl, ignore the change of hue hue = rgblight_config.hue; } #endif #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT else if (rgblight_config.mode >= RGBLIGHT_MODE_STATIC_GRADIENT && rgblight_config.mode <= RGBLIGHT_MODE_STATIC_GRADIENT_end) { // static gradient uint16_t _hue; int8_t direction = ((rgblight_config.mode - RGBLIGHT_MODE_STATIC_GRADIENT) % 2) ? -1 : 1; uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[(rgblight_config.mode - RGBLIGHT_MODE_STATIC_GRADIENT) / 2]); for (uint8_t i = 0; i < RGBLED_NUM; i++) { _hue = (range / RGBLED_NUM * i * direction + hue + 360) % 360; dprintf("rgblight rainbow set hsv: %u,%u,%d,%u\n", i, _hue, direction, range); sethsv(_hue, sat, val, (LED_TYPE *)&led[i]); } rgblight_set(); } #endif } rgblight_config.hue = hue; rgblight_config.sat = sat; rgblight_config.val = val; if (write_to_eeprom) { eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } else { xprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } } }
void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) { if (rgblight_config.enable) { LED_TYPE tmp_led; sethsv(hue, sat, val, &tmp_led); // dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val); rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); } }
// on the fourth tap, set the keyboard on flash state // and set the underglow to red, because red == bad void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) { if (state->count >= 4) { rgblight_enable(); rgblight_mode(1); rgblight_setrgb(0xff,0x00,0x00); reset_keyboard(); reset_tap_dance(state); } }
// Loop void matrix_scan_user(void) { static uint8_t old_layer = 255; uint8_t new_layer = biton32(layer_state); if (old_layer != new_layer) { switch (new_layer) { case 0: rgblight_mode(1); rgblight_setrgb(0xFF, 0xFF, 0xFF); break; case 1: rgblight_mode(18); rgblight_setrgb(0x00, 0xFF, 0xFF); break; } old_layer = new_layer; } };
void matrix_init_user(void) { if (!initialized){ dprintf("Initializing in matrix_scan_user"); rgblight_enable(); rgblight_mode(7); rgblight_sethsv(0,255,255); rgblight_setrgb(0x00, 0x00, 0xFF); initialized = 1; } }
uint32_t layer_state_set_keymap(uint32_t state) { switch (biton32(state)) { case _EDVORAKJ1: case _EDVORAKJ2: // _EDVORAKJ1 & J2 are same colored rgblight_setrgb (0xFF, 0xFF, 0xFF); break; case _LOWER: rgblight_setrgb (0xFF, 0x00, 0x00); break; case _RAISE: rgblight_setrgb (0x00, 0x00, 0xFF); break; case _ADJUST: rgblight_setrgb (0x00, 0xFF, 0x00); break; default: // for any other layers, or the default layer rgblight_mode(28); break; } return state; }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef RGBLIGHT_ENABLE static uint32_t savedRgbMode; static uint16_t savedHue; static uint8_t savedSat; static uint8_t savedVal; if (keycode == KC_ESC) { if (record->event.pressed) { savedRgbMode = rgblight_get_mode(); savedHue = rgblight_get_hue(); savedSat = rgblight_get_sat(); savedVal = rgblight_get_val(); rgblight_mode(1); rgblight_setrgb(255, 0, 0); } else { rgblight_mode(savedRgbMode); rgblight_sethsv(savedHue, savedSat, savedVal); } } #endif // If console is enabled, it will print the matrix position and status of each key pressed #ifdef CONSOLE_ENABLE xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.row, record->event.key.col, record->event.pressed); #endif //CONSOLE_ENABLE switch (keycode) { case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader if (!record->event.pressed) { SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP #if defined(BOOTLOADER_HALFKAY) ":teensy" #elif defined(BOOTLOADER_CATERINA) ":avrdude" #else ":dfu" #endif SS_TAP(X_ENTER)); } return false; break; } return process_record_keymap(keycode, record); }
void rgblight_effect_rgbtest(animation_status_t *anim) { static uint8_t maxval = 0; uint8_t g; uint8_t r; uint8_t b; if( maxval == 0 ) { LED_TYPE tmp_led; sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); maxval = tmp_led.r; } g = r = b = 0; switch( anim->pos ) { case 0: r = maxval; break; case 1: g = maxval; break; case 2: b = maxval; break; } rgblight_setrgb(r, g, b); anim->pos = (anim->pos + 1) % 3; }
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { if (rgblight_config.enable) { if (rgblight_config.mode == 1) { // same static color LED_TYPE tmp_led; sethsv(hue, sat, val, &tmp_led); fled_hs[0].hue = fled_hs[1].hue = hue; fled_hs[0].sat = fled_hs[1].sat = sat; rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); } else { // all LEDs in same color if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { // breathing mode, ignore the change of val, use in memory value instead val = rgblight_config.val; } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 14) { // rainbow mood and rainbow swirl, ignore the change of hue hue = rgblight_config.hue; } else if (rgblight_config.mode >= 25 && rgblight_config.mode <= 34) { // static gradient uint16_t _hue; int8_t direction = ((rgblight_config.mode - 25) % 2) ? -1 : 1; uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[(rgblight_config.mode - 25) / 2]); for (uint8_t i = 0; i < RGBLED_NUM; i++) { _hue = (range / RGBLED_NUM * i * direction + hue + 360) % 360; dprintf("rgblight rainbow set hsv: %u,%u,%d,%u\n", i, _hue, direction, range); sethsv(_hue, sat, val, (LED_TYPE *)&led[i]); } rgblight_set(); } } rgblight_config.hue = hue; rgblight_config.sat = sat; rgblight_config.val = val; if (write_to_eeprom) { eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } else { xprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } } }
void matrix_scan_user(void) { uint8_t layer = biton32(layer_state); switch (layer) { case 0: rgblight_setrgb(0,240, 255); break; case 1: rgblight_setrgb(0,255, 100); break; case 2: rgblight_setrgb(10,255, 0); break; case 3: rgblight_setrgb(255,0, 85); break; case 4: rgblight_setrgb(240,255, 0); break; default: // none break; } if ( SHIFTDOWN) { rgblight_setrgb(255,255, 255); } if ( CTRLDOWN) { rgblight_setrgb(240,255, 0); } if ( WINDOWN) { rgblight_setrgb(255,255, 255); } };
bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { // dynamically generate these. case EPRM: if (record->event.pressed) { eeconfig_init(); } return false; break; case VRSN: if (record->event.pressed) { SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); } return false; break; case RGB_SLD: if (record->event.pressed) { rgblight_mode(1); } return false; break; case RGB_0000FF: if (record->event.pressed) { #ifdef RGBLIGHT_ENABLE rgblight_enable(); rgblight_mode(1); rgblight_setrgb(0x00,0x00,0xff); #endif } return false; break; case RGB_008000: if (record->event.pressed) { #ifdef RGBLIGHT_ENABLE rgblight_enable(); rgblight_mode(1); rgblight_setrgb(0x00,0x80,0x00); #endif } return false; break; case RGB_FF0000: if (record->event.pressed) { #ifdef RGBLIGHT_ENABLE rgblight_enable(); rgblight_mode(1); rgblight_setrgb(0xff,0x00,0x00); #endif } return false; break; case RGB_800080: if (record->event.pressed) { #ifdef RGBLIGHT_ENABLE rgblight_enable(); rgblight_mode(1); rgblight_setrgb(0x80,0x00,0x80); #endif } return false; break; case RGB_00FF90: if (record->event.pressed) { #ifdef RGBLIGHT_ENABLE rgblight_enable(); rgblight_mode(1); rgblight_setrgb(0x00,0xff,0x90); #endif } return false; break; case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them if (record->event.pressed) { uint8_t dtime; for (dtime = 0; dtime < 4; dtime++) { diablo_key_time[dtime] = diablo_times[0]; } } return false; break; case KC_QWERTY: if (record->event.pressed) { persistent_default_layer_set(1UL << QWERTY); } return false; break; case KC_COLEMAK: if (record->event.pressed) { persistent_default_layer_set(1UL << COLEMAK); } return false; break; case KC_DVORAK: if (record->event.pressed) { persistent_default_layer_set(1UL << DVORAK); } return false; break; case KC_WORKMAN: if (record->event.pressed) { persistent_default_layer_set(1UL << WORKMAN); } return false; break; case KC_MAKEQMK: if (record->event.pressed) { SEND_STRING("make ergodox_ez:drashna-custom:teensy"SS_TAP(X_ENTER)); } return false; break; } return true; }
void matrix_scan_user(void) { uint8_t new_layer = biton32(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); ergodox_right_led_2_off(); ergodox_right_led_3_off(); #ifdef LAYER_UNDERGLOW_LIGHTING static uint8_t old_layer = 0; uint8_t modifiders = get_mods(); if ( modifiders & MODS_SHIFT_MASK) { ergodox_right_led_1_on(); } if ( modifiders & MODS_CTRL_MASK) { ergodox_right_led_2_on(); } if ( modifiders & MODS_ALT_MASK) { ergodox_right_led_3_on(); } if (old_layer != new_layer) { has_layer_changed = true; old_layer = new_layer; } if (has_layer_changed) { switch (new_layer) { case 1: rgblight_set_red; break; case 2: rgblight_set_blue; break; case 3: rgblight_set_green; break; case 4: rgblight_set_yellow; break; case 5: rgblight_setrgb(0xFF, 0xFF, 0x00); break; case 6: rgblight_setrgb(0xFF, 0xFF, 0x00); break; case 7: rgblight_setrgb(0xFF, 0xFF, 0xFF); break; default: rgblight_set_teal; break; } has_layer_changed = false; } #else switch (new_layer) { case 1: ergodox_right_led_1_on(); break; case 2: ergodox_right_led_2_on(); break; case 3: ergodox_right_led_3_on(); break; case 4: ergodox_right_led_1_on(); ergodox_right_led_2_on(); break; case 5: ergodox_right_led_1_on(); ergodox_right_led_3_on(); break; case 6: ergodox_right_led_2_on(); ergodox_right_led_3_on(); break; case 7: ergodox_right_led_1_on(); ergodox_right_led_2_on(); ergodox_right_led_3_on(); break; default: break; } #endif };
// Runs whenever there is a layer state change. uint32_t layer_state_set_user(uint32_t state) { ergodox_board_led_off(); ergodox_right_led_1_off(); ergodox_right_led_2_off(); ergodox_right_led_3_off(); uint8_t layer = biton32(state); switch (layer) { case 0: #ifdef RGBLIGHT_COLOR_LAYER_0 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); #else #ifdef RGBLIGHT_ENABLE rgblight_init(); #endif #endif break; case 1: ergodox_right_led_1_on(); #ifdef RGBLIGHT_COLOR_LAYER_1 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); #endif break; case 2: ergodox_right_led_2_on(); #ifdef RGBLIGHT_COLOR_LAYER_2 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); #endif break; case 3: ergodox_right_led_3_on(); #ifdef RGBLIGHT_COLOR_LAYER_3 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); #endif break; case 4: ergodox_right_led_1_on(); ergodox_right_led_2_on(); #ifdef RGBLIGHT_COLOR_LAYER_4 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); #endif break; case 5: ergodox_right_led_1_on(); ergodox_right_led_3_on(); #ifdef RGBLIGHT_COLOR_LAYER_5 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); #endif break; case 6: ergodox_right_led_2_on(); ergodox_right_led_3_on(); #ifdef RGBLIGHT_COLOR_LAYER_6 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); #endif break; case 7: ergodox_right_led_1_on(); ergodox_right_led_2_on(); ergodox_right_led_3_on(); #ifdef RGBLIGHT_COLOR_LAYER_7 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); #endif break; default: break; } return state; };
void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { rgblight_enable(); rgblight_mode(1); rgblight_setrgb(r, g, b); }
void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { rgblight_enable(); rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); rgblight_setrgb(r, g, b); }
// Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's recod handier if not processed here bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef CONSOLE_ENABLE xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); #endif #ifdef AUDIO_ENABLE if (faux_click_enabled) { if (record->event.pressed) { PLAY_SONG(fauxclicky_pressed); } else { stop_note(NOTE_A6); PLAY_SONG(fauxclicky_released); } } #endif switch (keycode) { case KC_QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE PLAY_SONG(tone_qwerty); #endif persistent_default_layer_set(1UL << _QWERTY); } return false; break; case KC_COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE PLAY_SONG(tone_colemak); #endif persistent_default_layer_set(1UL << _COLEMAK); } return false; break; case KC_DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE PLAY_SONG(tone_dvorak); #endif persistent_default_layer_set(1UL << _DVORAK); } return false; break; case KC_WORKMAN: if (record->event.pressed) { #ifdef AUDIO_ENABLE PLAY_SONG(tone_workman); #endif persistent_default_layer_set(1UL << _WORKMAN); } return false; break; case LOWER: if (record->event.pressed) { layer_on(_LOWER); update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { layer_off(_LOWER); update_tri_layer(_LOWER, _RAISE, _ADJUST); } return false; break; case RAISE: if (record->event.pressed) { layer_on(_RAISE); update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { layer_off(_RAISE); update_tri_layer(_LOWER, _RAISE, _ADJUST); } return false; break; case ADJUST: if (record->event.pressed) { layer_on(_ADJUST); } else { layer_off(_ADJUST); } return false; break; #if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) case KC_OVERWATCH: if (record->event.pressed) { is_overwatch = !is_overwatch; } #ifdef RGBLIGHT_ENABLE is_overwatch ? rgblight_mode(17) : rgblight_mode(18); #endif return false; break; case KC_SALT: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("Salt, salt, salt..."); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_MORESALT: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("Please sir, can I have some more salt?!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_SALTHARD: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("Your salt only makes me harder, and even more aggressive!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_GOODGAME: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("Good game, everyone!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_GLHF: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("Good luck, have fun!!!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_SYMM: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("Left click to win!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_JUSTGAME: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games."); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_TORB: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("That was positively riveting!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_AIM: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER)); wait_ms(3000); register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); SEND_STRING("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER)); } return false; break; case KC_C9: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("OMG!!! C9!!!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; case KC_GGEZ: if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); SEND_STRING("That was a fantastic game, though it was a bit easy. Try harder next time!"); register_code(KC_ENTER); unregister_code(KC_ENTER); } return false; break; #endif #ifdef TAP_DANCE_ENABLE case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them if (record->event.pressed) { uint8_t dtime; for (dtime = 0; dtime < 4; dtime++) { diablo_key_time[dtime] = diablo_times[0]; } } return false; break; #endif case KC_MAKE: if (!record->event.pressed) { SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) ":dfu" #elif defined(BOOTLOADER_HALFKAY) ":teensy" //#elif defined(BOOTLOADER_CATERINA) // ":avrdude" #endif SS_TAP(X_ENTER)); } return false; break; case KC_RESET: if (!record->event.pressed) { #ifdef RGBLIGHT_ENABLE rgblight_enable(); rgblight_mode(1); rgblight_setrgb(0xff, 0x00, 0x00); #endif reset_keyboard(); } return false; break; case EPRM: if (record->event.pressed) { eeconfig_init(); } return false; break; case VRSN: if (record->event.pressed) { SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); } return false; break; case KC_SECRET_1 ... KC_SECRET_5: if (!record->event.pressed) { send_string_P(secret[keycode - KC_SECRET_1]); } return false; break; case KC_FXCL: if (!record->event.pressed) { faux_click_enabled = !faux_click_enabled; } return false; break; case KC_RGB_T: // Because I want the option to go back to normal RGB mode rather than always layer indication #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { rgb_layer_change = !rgb_layer_change; } #endif return false; break; #ifdef RGBLIGHT_ENABLE case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions if (record->event.pressed) { //This disrables layer indication, as it's assumed that if you're changing this ... you want that disabled rgb_layer_change = false; } return true; break; #endif } return process_record_keymap(keycode, record); }
void matrix_scan_user( void ) { /* Layer */ uint8_t layer = biton32( layer_state ); /* Encoder */ encoder_state <<= 2; encoder_state |= (PIND & 0x3); encoder_value += encoder_LUT[encoder_state & 0xF]; /* Encoder state RGB display */ if (RGB_encoder_bool){ if (timer_elapsed(RGB_encoder_timer) > 2500) { RGB_encoder_bool=false; if (RGB_TAP_STATE) { rgblight_mode( 1 ); rgblight_setrgb( RGB_TAP_Base_Color ); }else{ rgblight_mode( RGB_LAYER0_mode ); } } } /* Display the Caps state */ if (caps==true){ rgblight_setrgb_at(RGB_Caps_Color,12); } /* Start of Encoder clockwise */ if ( encoder_value >= 4 ) { /* Start of Encoder state RGB_display */ if (!RGB_encoder_bool){ RGB_encoder_timer=timer_read(); RGB_encoder_bool=true; RGB_encoder_count=5; rgblight_mode(1); rgblight_setrgb( 0,0,0 ); }else if (RGB_encoder_bool && timer_elapsed(RGB_encoder_timer) < 800) { RGB_encoder_timer=timer_read(); RGB_encoder_count-=1; if (RGB_encoder_count>5 || RGB_encoder_count<1){ RGB_encoder_count=5; rgblight_setrgb(0, 0, 0); } } rgblight_setrgb_at(0,255,0,5); if (RGB_encoder_count<1) {RGB_encoder_count=1;} switch (RGB_encoder_count) { case 5: rgblight_setrgb_at(0, 255, 0,4); break; case 4: rgblight_setrgb_at(0, 255, 0,3); break; case 3: rgblight_setrgb_at(0, 255, 0,2); break; case 2: rgblight_setrgb_at(0, 255, 0,1); break; case 1: rgblight_setrgb_at(0, 255, 0,0); break; } /* End of Encoder state RGB_display */ /* Start of Set Encoder Keycode */ switch ( layer ) { case 0: tap_code( KC_VOLD ); break; case _CODE: tap_code( KC_LEFT ); break; case _RGB: rgblight_decrease_val(); break; case _NUMB: tap_code( KC_LEFT ); break; case _MARO: tap_code( KC_UP ); break; default: tap_code( KC_VOLD ); } /* End of Set Encoder Keycode */ } /* End of Encoder clockwise */ /* Start of Encoder anti-clockwise */ if ( encoder_value <= -4 ) { /* Start of Encoder state RGB_display */ if (!RGB_encoder_bool){ RGB_encoder_timer=timer_read(); RGB_encoder_bool=true; RGB_encoder_count=6; rgblight_mode(1); rgblight_setrgb( 0,0,0 ); }else if (RGB_encoder_bool && timer_elapsed(RGB_encoder_timer) < 800) { RGB_encoder_timer=timer_read(); RGB_encoder_count+=1; if (RGB_encoder_count<6 || RGB_encoder_count> 10){ RGB_encoder_count=6; rgblight_setrgb(0, 0, 0); } } rgblight_setrgb_at(0, 0,255,6); if (RGB_encoder_count>11) { RGB_encoder_count=11; } switch (RGB_encoder_count) { case 6: rgblight_setrgb_at(0, 0,255,7); break; case 7: rgblight_setrgb_at(0, 0,255,8); break; case 8: rgblight_setrgb_at(0, 0,255,9); break; case 9: rgblight_setrgb_at(0, 0,255,10); break; case 10: rgblight_setrgb_at(0, 0,128,11); break; } /* End of Encoder state RGB_display */ /* Start of Set Encoder Keycode */ switch ( layer ) { case 0: tap_code( KC_VOLU ); break; case _CODE: tap_code( KC_RGHT ); break; case _RGB: rgblight_increase_val(); break; case _NUMB: tap_code( KC_RGHT ); break; case _MARO: tap_code( KC_DOWN ); break; default: tap_code( KC_VOLU ); } /* End of Set Encoder Keycode */ } /* End of Encoder anti-clockwise */ encoder_value %= 4; /* Start of RGB with Layer change */ /* Save the Layer0 RGB state */ if ( save_rgbmode == true ) { if (RGB_TAP_STATE==false) { RGB_LAYER0_mode = rgblight_config.mode; } } save_rgbmode = false; /* When the layer is changed */ if ( layer != current_layer && caps == false) { has_layer_changed = true; current_layer = layer; /* update layer information */ } /* Check for layer change, and apply color if its changed since last check */ if ( has_layer_changed ) { /* change backlight based on layer. These should be numbers or whatever you defined the layers as */ switch ( layer ) { case 0: /* if the key tap RGB effect is enable */ if (RGB_TAP_STATE==true){ rgblight_mode(1); rgblight_setrgb( RGB_TAP_Base_Color ); } else{ rgblight_mode( RGB_LAYER0_mode ); } break; case _CODE: //1 /* Save Layer0 RGB state */ RGB_LAYER0_mode = rgblight_config.mode; /* set all the RGB color under the switch */ rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_1_Base_Color); /* set each of the RGB led color under the switch */ rgblight_setrgb_at(64, 64, 64,1); // Q rgblight_setrgb_at(64, 64, 64,2); // W rgblight_setrgb_at(64, 64, 64,3); // E rgblight_setrgb_at(64, 64, 64,4); // R rgblight_setrgb_at(64, 64, 64,5); // T rgblight_setrgb_at(64, 64, 64,6); // Y rgblight_setrgb_at(64, 64, 64,7); // U rgblight_setrgb_at(64, 64, 64,8); // I rgblight_setrgb_at(64, 64, 64,9); // O rgblight_setrgb_at(64, 64, 64,10); // P rgblight_setrgb_at(64, 0, 0,40); // - rgblight_setrgb_at(64, 0, 0,42); // = break; case _NAVI: //2 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_2_Base_Color); rgblight_setrgb_at(64, 0, 64,3); rgblight_setrgb_at(64, 0, 64,14); rgblight_setrgb_at(64, 0, 64,15); rgblight_setrgb_at(64, 0, 64,16); rgblight_setrgb_at(64, 64, 0,8); rgblight_setrgb_at(64, 64, 0,10); rgblight_setrgb_at(64, 64, 0,21); rgblight_setrgb_at(64, 64, 0,29); rgblight_setrgb_at(64, 0, 0,11); rgblight_setrgb_at(0, 0, 64,34); rgblight_setrgb_at(0, 0, 64,44); rgblight_setrgb_at(0, 0, 64,45); rgblight_setrgb_at(0, 0, 64,46); break; case _FUNC: //3 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_3_Base_Color); rgblight_setrgb_at(0, 0, 64,1); rgblight_setrgb_at(0, 0, 64,2); rgblight_setrgb_at(0, 0, 64,3); rgblight_setrgb_at(0, 0, 64,4); rgblight_setrgb_at(0, 0, 64,5); rgblight_setrgb_at(0, 0, 64,6); rgblight_setrgb_at(0, 0, 64,7); rgblight_setrgb_at(0, 0, 64,8); rgblight_setrgb_at(0, 0, 64,9); rgblight_setrgb_at(0, 0, 64,10); rgblight_setrgb_at(0, 0, 64,13); rgblight_setrgb_at(0, 0, 64,14); break; case _SYMB: //4 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_4_Base_Color); rgblight_setrgb_at(0, 64, 64,1); rgblight_setrgb_at(0, 64, 64,2); rgblight_setrgb_at(0, 64, 64,3); rgblight_setrgb_at(0, 64, 64,4); rgblight_setrgb_at(0, 64, 64,5); rgblight_setrgb_at(0, 64, 64,6); rgblight_setrgb_at(0, 64, 64,7); rgblight_setrgb_at(0, 64, 64,8); rgblight_setrgb_at(0, 64, 64,9); rgblight_setrgb_at(0, 64, 64,10); rgblight_setrgb_at(0, 64, 64,12); rgblight_setrgb_at(0, 64, 64,22); rgblight_setrgb_at(0, 64, 64,23); rgblight_setrgb_at(0, 64, 64,32); rgblight_setrgb_at(0, 64, 64,33); rgblight_setrgb_at(0, 64, 64,34); rgblight_setrgb_at(0, 64, 64,39); rgblight_setrgb_at(0, 64, 64,40); rgblight_setrgb_at(0, 64, 64,42); rgblight_setrgb_at(0, 64, 64,43); break; case _NUMB: //5 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_5_Base_Color); rgblight_setrgb_at(0,64,0,1); rgblight_setrgb_at(0,64,0,2); rgblight_setrgb_at(0,64,0,13); rgblight_setrgb_at(0,64,0,14); rgblight_setrgb_at(0,64,64,15); rgblight_setrgb_at(64,64,64,7); rgblight_setrgb_at(64,64,64,8); rgblight_setrgb_at(64,64,64,9); rgblight_setrgb_at(64,64,64,19); rgblight_setrgb_at(64,64,64,20); rgblight_setrgb_at(64,64,64,21); rgblight_setrgb_at(64,64,64,31); rgblight_setrgb_at(64,64,64,32); rgblight_setrgb_at(64,64,64,33); rgblight_setrgb_at(64,64,64,42); rgblight_setrgb_at(64,64,64,43); rgblight_setrgb_at(0,128,0,44); break; case _MARO: //6 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_6_Base_Color); break; case _RGB: //7 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_7_Base_Color); rgblight_setrgb_at(1,143,225,0); rgblight_setrgb_at(39,21,107,1); rgblight_setrgb_at(208,0,0,2); rgblight_setrgb_at(64,64,64,21); break; case _ADJUST: //8 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_8_Base_Color); rgblight_setrgb_at(0,64,0,10); rgblight_setrgb_at(64,0,0,11); rgblight_setrgb_at(0,64,0,17); rgblight_setrgb_at(0,64,0,30); rgblight_setrgb_at(6,50,50,12); break; case _GAME: //9 RGB_LAYER0_mode = rgblight_config.mode; rgblight_mode( 1 ); rgblight_setrgb(RGB_Layer_9_Base_Color); rgblight_setrgb_at(0,0,64,15); rgblight_setrgb_at(0,0,64,26); rgblight_setrgb_at(0,0,64,27); rgblight_setrgb_at(0,0,64,28); rgblight_setrgb_at(64,0,0,35); break; default: rgblight_mode( RGB_LAYER0_mode ); } has_layer_changed = false; } /* End of RGB with Layer change */ } // End of matrix_scan_user
bool process_record_user( uint16_t keycode, keyrecord_t *record ){ /* Start of key tap RGB effect */ if ( RGB_TAP_STATE ==true ) { key_index=(record->event.key.col)+(record->event.key.row)*12; /* Change the Hue of the RGB color with the type speed */ if (timer_elapsed(TAP_RGB_timer) >10000){ TAP_RGB_timer=timer_read(); Type_Hue=270; }else if (timer_elapsed(TAP_RGB_timer) >1000){ Type_Hue+=30; if (Type_Hue>270) { Type_Hue=270;} }else{ TAP_RGB_timer=timer_read(); Type_Hue-=10; if (Type_Hue<10) { Type_Hue=10;} } if (key_index>42){ //fix the RGB index of the MIT layout position key_index=key_index-1; } if ( record->event.pressed ) { rgblight_sethsv_at(Type_Hue,255,255,key_index); } else { rgblight_setrgb_at(RGB_TAP_Base_Color,key_index); } } /* End of key tap RGB effect */ switch ( keycode ) { /* save the RGB state when set the new */ case RGB_M_R: save_rgbmode = true; break; case RGB_M_SW: save_rgbmode = true; break; case RGB_M_X: save_rgbmode = true; break; case RGB_M_G: save_rgbmode = true; break; case RGB_MODE_KNIGHT: save_rgbmode = true; break; /* Define a New Keycode: double zero */ case KC_00: if (record->event.pressed) { // Do something when pressed } else { tap_code( KC_0 ); // send 0 tap_code( KC_0 ); // send 0 twice without macro } return false; // Skip all further processing of this key /* when the REST key is pressed the 'R' key will RED,the "Bottom Left"(esc of qmk-dfu) will be GREEN */ case RESET: rgblight_mode( 1 ); rgblight_setrgb( 0, 0, 0 ); rgblight_setrgb_at(128, 0, 0,4); // R rgblight_setrgb_at(6, 128, 24,36); // Bottom Left key break; /* Define a New Keycode: key tap RGB effect toggle */ case RGB_TAP: if ( !(record->event.pressed)) { /* If enable,the 'On' key will be green */ if (RGB_TAP_STATE) { RGB_TAP_STATE=false; rgblight_mode( 1 ); rgblight_setrgb( RGB_TAP_Base_Color ); rgblight_setrgb_at(RGB_TAP_Off_Color,16); // O - on }else{ /* If disenable,the 'oFf' key will be red */ RGB_TAP_STATE=true; rgblight_mode( 1 ); rgblight_setrgb( RGB_TAP_Base_Color ); rgblight_setrgb_at(RGB_TAP_On_Color,9); // F - off } } break; /* special shift keys */ case KC_ENT: s_keycode = KC_QUOT; k_shifted = &ques_shifted; break; case KC_UP: s_keycode = KC_SLSH; k_shifted = &ques_shifted; break; case KC_DOWN: s_keycode = KC_BSLS; k_shifted = &ques_shifted; break; default: return(true); } shifted = get_mods() & (MOD_BIT( KC_LSHIFT ) | MOD_BIT( KC_RSHIFT ) ); /* Keydown. If shift is currently pressed, register its alternate keycode. */ if ( record->event.pressed && shifted ) { *k_shifted = true; register_code( s_keycode ); return(false); /* * Keyup. If shift was pressed back when the key was pressed, unregister * its alternate keycode. */ } else if ( !(record->event.pressed) && *k_shifted ) { *k_shifted = false; unregister_code( s_keycode ); return(false); /* Otherwise, behave as normal. */ } else { return(true); } } // End ofprocess_record_user
// Runs just one time when the keyboard initializes. void matrix_init_user(void) { #ifdef RGBLIGHT_COLOR_LAYER_0 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); #endif };
void matrix_init_user(void) { rgblight_setrgb(0,255,0); }