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; }
void matrix_scan_user(void) { uint8_t layer = biton32(layer_state); switch (layer) { case _NAV: if (RGB_INIT) {} else { RGB_current_mode = rgblight_config.mode; RGB_INIT = true; } if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false } else { TOG_STATUS = !TOG_STATUS; rgblight_mode(29); } break; case _LOWER: if (RGB_INIT) {} else { RGB_current_mode = rgblight_config.mode; RGB_INIT = true; } if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false } else { TOG_STATUS = !TOG_STATUS; rgblight_mode(29); } break; case _QWERTY: if (RGB_INIT) {} else { RGB_current_mode = rgblight_config.mode; RGB_INIT = true; } rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change TOG_STATUS = false; break; } };
void led_set_user(uint8_t usb_led) { if (usb_led & (1<<USB_LED_CAPS_LOCK)) { rgblight_mode(18); } else { rgblight_mode(14); } }
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
void matrix_init_keymap(void) { #if 0 #ifdef RGB_MATRIX_KEYPRESSES rgblight_mode(RGB_MATRIX_MULTISPLASH); #else rgblight_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON); #endif #endif }
void rgblight_init(void) { debug_enable = 1; // Debug ON! dprintf("rgblight_init called.\n"); rgblight_inited = 1; dprintf("rgblight_init start!\n"); if (!eeconfig_is_enabled()) { dprintf("rgblight_init eeconfig is not enabled.\n"); eeconfig_init(); eeconfig_update_rgblight_default(); } rgblight_config.raw = eeconfig_read_rgblight(); if (!rgblight_config.mode) { dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n"); eeconfig_update_rgblight_default(); rgblight_config.raw = eeconfig_read_rgblight(); } eeconfig_debug_rgblight(); // display current eeprom values #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_init(); // setup the timer #endif if (rgblight_config.enable) { rgblight_mode(rgblight_config.mode); } }
void rgblight_enable(void) { rgblight_config.enable = 1; // No need to update EEPROM here. rgblight_mode() will do that, actually //eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); rgblight_mode(rgblight_config.mode); }
// Call user matrix init, set default RGB colors and then // call the keymap's init function void matrix_init_user(void) { #ifdef RGBLIGHT_ENABLE uint8_t default_layer = eeconfig_read_default_layer(); rgblight_enable(); if (true) { if (default_layer & (1UL << _COLEMAK)) { rgblight_set_magenta; } else if (default_layer & (1UL << _DVORAK)) { rgblight_set_green; } else if (default_layer & (1UL << _WORKMAN)) { rgblight_set_purple; } else { rgblight_set_teal; } } else { rgblight_set_red; rgblight_mode(5); } #endif #ifdef AUDIO_ENABLE // wait_ms(21); // gets rid of tick // stop_all_notes(); // PLAY_SONG(tone_hackstartup); #endif matrix_init_keymap(); }
void rgblight_increase(void) { uint8_t mode = 0; if (rgblight_config.mode < RGBLIGHT_MODES) { mode = rgblight_config.mode + 1; } rgblight_mode(mode); }
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) { #ifdef RGBLIGHT_ENABLE rgblight_mode(1); #endif } return false; break; } return true; }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { #ifdef SSD1306OLED set_keylog(keycode, record); #endif // set_timelog(); } switch (keycode) { case LOWER: if (record->event.pressed) { layer_on(_LOWER); update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); } else { layer_off(_LOWER); update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); } return false; break; case RAISE: if (record->event.pressed) { layer_on(_RAISE); update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); } else { layer_off(_RAISE); update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); } return false; break; case ADJUST: if (record->event.pressed) { layer_on(_ADJUST); } else { layer_off(_ADJUST); } return false; break; case RGB_MOD: #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { rgblight_mode(RGB_current_mode); rgblight_step(); RGB_current_mode = rgblight_config.mode; } #endif return false; break; case RGBRST: #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { eeconfig_update_rgblight_default(); rgblight_enable(); RGB_current_mode = rgblight_config.mode; } #endif break; } return true; }
void matrix_scan_user(void) { if (runonce && timer_elapsed(my_timer) > 1000) { runonce = false; rgblight_sethsv(0x0, 0xff, 0x80); rgblight_mode(9); rgblight_enable(); } }
void rgblight_decrease(void) { uint8_t mode = 0; // Mode will never be < 1. If it ever is, eeprom needs to be initialized. if (rgblight_config.mode > 1) { mode = rgblight_config.mode - 1; } rgblight_mode(mode); }
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 startup_user() { #ifdef RGB_MATRIX_ENABLE rgblight_mode(RGB_MATRIX_CYCLE_ALL); #endif //RGB_matrix wait_ms(20); // gets rid of tick PLAY_NOTE_ARRAY(tone_startup, false, 0); }
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { rgblight_mode(RGB_current_mode); layer_on(layer3); } else { layer_off(layer3); } }
void rgblight_step_reverse(void) { uint8_t mode = 0; mode = rgblight_config.mode - 1; if (mode < 1) { mode = RGBLIGHT_MODES; } rgblight_mode(mode); }
void rgblight_step(void) { uint8_t mode = 0; mode = rgblight_config.mode + 1; if (mode > RGBLIGHT_MODES) { mode = 1; } rgblight_mode(mode); }
void matrix_scan_user(void) { static int scan_count = 0; if( scan_count == 2 ) { rgblight_enable(); rgblight_mode(35); } if( scan_count < 3 ) scan_count ++; iota_gfx_task(); // this is what updates the display continuously }
// 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); } }
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; } }
// 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; } };
// Setting ADJUST layer RGB back to default void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { #ifdef RGBLIGHT_ENABLE rgblight_mode(RGB_current_mode); #endif layer_on(layer3); } else { layer_off(layer3); } }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case ADJUST: if (record->event.pressed) { if (RGB_INIT) {} else { RGB_current_mode = rgblight_config.mode; RGB_INIT = true; } if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false } else { TOG_STATUS = !TOG_STATUS; rgblight_mode(25); } layer_on(_ADJUST); } else { rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change TOG_STATUS = false; layer_off(_ADJUST); } return false; break; case GAMEXTRA: if (record->event.pressed) { layer_on(_GAMEXTRA); } else { layer_off(_GAMEXTRA); } return false; break; case RGB_MOD: //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released if (record->event.pressed) { rgblight_mode(RGB_current_mode); rgblight_step(); RGB_current_mode = rgblight_config.mode; } return false; break; } return true; }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case QWERTY: if (record->event.pressed) { persistent_default_layer_set(1UL<<_QWERTY); } return false; break; case LOWER: if (record->event.pressed) { layer_on(_LOWER); } else { layer_off(_LOWER); } return false; break; case RAISE: if (record->event.pressed) { layer_on(_RAISE); } else { layer_off(_RAISE); } return false; break; case ADJUST: if (record->event.pressed) { layer_on(_ADJUST); } else { layer_off(_ADJUST); } return false; break; case RGB_MOD: #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { rgblight_mode(RGB_current_mode); rgblight_step(); RGB_current_mode = rgblight_config.mode; } #endif return false; break; case RGBRST: #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { eeconfig_update_rgblight_default(); rgblight_enable(); RGB_current_mode = rgblight_config.mode; } #endif break; } return true; }
void rgblight_update_dword(uint32_t dword) { rgblight_config.raw = dword; eeconfig_update_rgblight(rgblight_config.raw); if (rgblight_config.enable) rgblight_mode(rgblight_config.mode); else { #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif rgblight_set(); } }
uint32_t layer_state_set_kb(uint32_t state) { #ifdef RGBLIGHT_ENABLE // Check layer, and apply color if its changed since last check switch (biton32(state)) { case _NAV: rgblight_set_blue; rgblight_mode(1); break; case _MACROS: rgblight_set_orange; is_overwatch ? rgblight_mode(17) : rgblight_mode(18); break; case _DIABLO: rgblight_set_red; rgblight_mode(5); break; case _MEDIA: rgblight_set_green; rgblight_mode(22); break; default: rgblight_set_teal; rgblight_mode(1); break; } #endif return state; }
void dance_cln_reset( qk_tap_dance_state_t* state, void* user_data ) { if ( state->count == 1 ) { unregister_code( KC_LSFT ); }else { uint8_t layer = biton32( layer_state ); if ( layer == _SYMB ) { layer_off( _SYMB ); rgblight_mode( RGB_LAYER0_mode ); } } }
void rgblight_toggle(void) { rgblight_config.enable ^= 1; eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable); if (rgblight_config.enable) { rgblight_mode(rgblight_config.mode); } else { #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif _delay_ms(50); rgblight_set(); } }
void matrix_init_user(void) { // set Numlock LED to output and low DDRF |= (1<<7); PORTF &= ~(1<<7); #ifdef RGBLIGHT_ENABLE rgblight_enable(); rgblight_set_teal; rgblight_mode(1); #endif if (!(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) ){ register_code(KC_NUMLOCK); unregister_code(KC_NUMLOCK); } }