Sfoglia il codice sorgente

Merge marquee into typing led mode

- Start marquee mode when idle in typing led mode
- Quit marquee mode when hit anykey
old_master
Kai Ryu 9 anni fa
parent
commit
13bddedd7f
2 ha cambiato i file con 36 aggiunte e 21 eliminazioni
  1. 35
    20
      keyboard/staryu/backlight.c
  2. 1
    1
      keyboard/staryu/config_lite.h

+ 35
- 20
keyboard/staryu/backlight.c Vedi File

breathing_led_enable_all(); breathing_led_enable_all();
break; break;
case 7: case 7:
fading_led_disable_all();
breathing_led_disable_all(); breathing_led_disable_all();
breathing_led_set_duration(1); breathing_led_set_duration(1);
breathing_led_set_index_all(0);
break;
case 8:
breathing_led_disable_all();
fading_led_set_direction_all(FADING_LED_FADE_OUT); fading_led_set_direction_all(FADING_LED_FADE_OUT);
fading_led_set_duration(3); fading_led_set_duration(3);
fading_led_enable_all(); fading_led_enable_all();
} }
#endif #endif


static uint8_t idle_state = 0;
static uint16_t idle_last = 0;

void action_keyevent(keyevent_t event) void action_keyevent(keyevent_t event)
{ {
if (backlight_config.enable) { if (backlight_config.enable) {
if (backlight_config.level == 8) {
if (backlight_config.level == 7) {
if (event.pressed) { if (event.pressed) {
if (idle_state > 1) {
breathing_led_disable_all();
}
idle_state = 0;
uint8_t key = event.key.col + 1; uint8_t key = event.key.col + 1;
fading_led_set_delay(key, 64); fading_led_set_delay(key, 64);
softpwm_led_increase(key, 32); softpwm_led_increase(key, 32);
void softpwm_led_custom(void) void softpwm_led_custom(void)
{ {
rgb_fading(); rgb_fading();
if (backlight_config.level == 7) {
static uint8_t index = 0;
static uint16_t last = 0;
if (timer_elapsed(last) > 250) {
last = timer_read();
breathing_led_enable_once(index);
index = (index + 1) % 6;
}
}
} }


void fading_led_custom(uint8_t *value) void fading_led_custom(uint8_t *value)
{ {
if (backlight_config.level == 8) {
uint8_t max = value[0];
for (uint8_t i = 1; i < LED_COUNT; i++) {
if (value[i] > max) max = value[i];
static uint8_t index = 0;
static uint16_t last = 0;
if (backlight_config.level == 7) {
if (idle_state == 0) {
uint8_t max = value[0];
for (uint8_t i = 1; i < LED_COUNT; i++) {
if (value[i] > max) max = value[i];
}
rgb_set_brightness(max);
if (max == 0) {
idle_last = timer_read();
idle_state = 1;
}
}
if (idle_state == 1) {
if (timer_elapsed(idle_last) > 3000) {
breathing_led_set_index_all(0);
index = 0;
idle_state = 2;
}
}
if (idle_state == 2) {
if (timer_elapsed(last) > 500) {
last = timer_read();
breathing_led_enable_once(index);
index = (index + 1) % 6;
}
} }
rgb_set_brightness(max);
} }
} }



+ 1
- 1
keyboard/staryu/config_lite.h Vedi File

#define DEBOUNCE 5 #define DEBOUNCE 5


/* number of backlight levels */ /* number of backlight levels */
#define BACKLIGHT_LEVELS 8
#define BACKLIGHT_LEVELS 7


/* number of LEDs */ /* number of LEDs */
#define LED_COUNT 6 #define LED_COUNT 6