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); }
// keyboard initialization void matrix_init_user() { ergodox_led_all_on(); for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) { ergodox_led_all_set(i); wait_ms(5); } wait_ms(1000); for (int i = LED_BRIGHTNESS_LO; i > 0; i--) { ergodox_led_all_set(i); wait_ms(10); } ergodox_led_all_off(); }
// Runs constantly in the background, in a loop. void matrix_scan_user(void) { uint8_t layer = biton32(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); ergodox_right_led_2_off(); ergodox_right_led_3_off(); switch (layer) { case FMU: ergodox_right_led_1_on(); break; case PMQ: ergodox_right_led_2_on(); break; case PMN: ergodox_right_led_3_on(); break; default: if(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { ergodox_led_all_set(LED_BRIGHTNESS_HI); ergodox_right_led_1_on(); } else { ergodox_board_led_off(); } break; } };
void UltramodSetLeds(void) { #ifdef ERGODOX ergodox_led_all_off(); // todo: Consider changing these so that they progress from left to right, or maybe right to left switch (ultramod.machine.state) { case NORMAL_STATE: break; case HELD_STATE: case MOMENTARY_STATE: ergodox_right_led_3_on(); // Blue break; case ONE_SHOT_STATE: ergodox_right_led_2_on(); // Green break; case LOCKED_STATE: ergodox_right_led_1_on(); // Red break; } // Something seems to keep resetting the brightness ergodox_led_all_set(LED_BRIGHTNESS_LO); #endif // ERGODOX }
// Runs constantly in the background, in a loop. void matrix_scan_user(void) { uint8_t layer = biton32(layer_state); // Dim the LEDs as much as possible ergodox_led_all_set(0); // Show the active layer number as binary bits in the LEDs. // Note that LED1 is left-most, so bit1 -> LED3 and bit3 -> LED1 if (layer & 0b001) { ergodox_right_led_3_on(); } else { ergodox_right_led_3_off(); } if (layer & 0b010) { ergodox_right_led_2_on(); } else { ergodox_right_led_2_off(); } // Show caps lock on the left most LED. // (Double-tap left shift to toggle caps lock) if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { ergodox_right_led_1_on(); } else { ergodox_right_led_1_off(); } }
void ergodox_blink_all_leds(void) { ergodox_led_all_off(); ergodox_led_all_set(LED_BRIGHTNESS_HI); ergodox_led_all_on(); _delay_ms(333); ergodox_led_all_off(); }
// Runs constantly in the background, in a loop. void matrix_scan_user(void) { uint8_t layer = biton32(layer_state); ergodox_led_all_off(); ergodox_led_all_set(LED_BRIGHTNESS_LO); switch (layer) { case BASE: current_layer = BASE; break; case KEYPAD: current_layer = KEYPAD; break; default: // none break; } // layer leds if (current_layer == KEYPAD) { ergodox_right_led_3_on(); } // capslock if (host_keyboard_leds() & (3<<USB_LED_CAPS_LOCK)) { ergodox_right_led_1_on(); } // Temporary leds // The function layer takes over other layers and we need to reflect that on the leds. // If the current layer is the BASE, we simply turn on the FN led, but if the current // layer is the KEYPAD, than we must turn it off before turning on the FN led. if (layer == FN && !has_oneshot_layer_timed_out()) { ergodox_right_led_3_off(); ergodox_right_led_2_on(); } // if the shifted is pressed I show the case led in a brighter color. This is nice to // differenciate the shift from the capslock. // Notice that I make sure that we're not using the shift on a chord shortcut (pressing // shift togather with other modifiers). if((keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) && // is shift pressed and there is no other !(keyboard_report->mods & (~MOD_BIT(KC_LSFT) & ~MOD_BIT(KC_RSFT)))) || // modifier being pressed as well (get_oneshot_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) && !has_oneshot_mods_timed_out())) { // or the one shot shift didn't timed out ergodox_right_led_1_set(LED_BRIGHTNESS_HI); ergodox_right_led_1_on(); } };
void ergodox_blink_all_leds(void) { ergodox_led_all_off(); ergodox_led_all_set(LED_BRIGHTNESS_HI); ergodox_right_led_1_on(); _delay_ms(50); ergodox_right_led_2_on(); _delay_ms(50); ergodox_right_led_3_on(); _delay_ms(50); ergodox_right_led_1_off(); _delay_ms(50); ergodox_right_led_2_off(); _delay_ms(50); ergodox_right_led_3_off(); //ergodox_led_all_on(); //_delay_ms(333); ergodox_led_all_off(); }