From c00337907422174c7ce1c72715b7ff8994d22276 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Mon, 27 Apr 2015 19:12:16 +0900 Subject: [PATCH] Some changes of backlight effects - Change backlight levels from 10 to 8 - Remove fading when press and release mode - Remove typing led (fade out) - Change implementation of breathing led - New marquee mode at level 7 --- keyboard/staryu/backlight.c | 105 +++++++++++++--------------------- keyboard/staryu/config_lite.h | 4 +- 2 files changed, 43 insertions(+), 66 deletions(-) diff --git a/keyboard/staryu/backlight.c b/keyboard/staryu/backlight.c index 748ccf82..2f4b4c73 100644 --- a/keyboard/staryu/backlight.c +++ b/keyboard/staryu/backlight.c @@ -21,6 +21,7 @@ along with this program. If not, see . #include "backlight.h" #include "softpwm_led.h" #include "action.h" +#include "timer.h" #include "rgb.h" #ifdef BACKLIGHT_ENABLE @@ -48,23 +49,22 @@ void backlight_set(uint8_t level) case 4: case 5: case 6: - breathing_led_enable_all(); fading_led_disable_all(); breathing_led_set_duration(6 - level); + breathing_led_set_index_all(0); + breathing_led_enable_all(); break; case 7: - case 8: - fading_led_enable_all(); + fading_led_disable_all(); breathing_led_disable_all(); - fading_led_set_direction_all(FADING_LED_FADE_IN); - fading_led_set_duration(level == 7 ? 3 : 0); + breathing_led_set_duration(1); + breathing_led_set_index_all(0); break; - case 9: - case 10: - fading_led_enable_all(); + case 8: breathing_led_disable_all(); fading_led_set_direction_all(FADING_LED_FADE_OUT); - fading_led_set_duration(level == 9 ? 3 : 0); + fading_led_set_duration(3); + fading_led_enable_all(); break; case 0: default: @@ -88,19 +88,19 @@ void softpwm_led_init(void) void softpwm_led_on(uint8_t index) { switch (index) { - case 0: + case 1: PORTC &= ~(1< 250) { + last = timer_read(); + breathing_led_enable_once(index); + index = (index + 1) % 6; + } + } } void fading_led_custom(uint8_t *value) { - uint8_t tmp = value[0]; - switch (backlight_config.level) { - case 7: - case 8: - for (uint8_t i = 0; i < LED_COUNT; i++) { - if (value[i] < tmp) tmp = value[i]; - } - break; - case 9: - case 10: - for (uint8_t i = 0; i < LED_COUNT; i++) { - if (value[i] > tmp) tmp = value[i]; - } - break; + 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]; + } + rgb_set_brightness(max); } - rgb_set_brightness(tmp); } void breathing_led_custom(uint8_t *value) { - rgb_set_brightness(*value); + rgb_set_brightness(value[0]); } #endif diff --git a/keyboard/staryu/config_lite.h b/keyboard/staryu/config_lite.h index 81fa44ba..db191265 100644 --- a/keyboard/staryu/config_lite.h +++ b/keyboard/staryu/config_lite.h @@ -42,10 +42,10 @@ along with this program. If not, see . #define DEBOUNCE 5 /* number of backlight levels */ -#define BACKLIGHT_LEVELS 10 +#define BACKLIGHT_LEVELS 8 /* number of LEDs */ -#define LED_COUNT 5 +#define LED_COUNT 6 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE