From f1148804a899cdf189eeab7a87be1bf6f41f2b59 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Fri, 4 Nov 2016 12:50:53 +0900 Subject: [PATCH] staryu: Improve experience of backlight --- keyboard/staryu/backlight.c | 10 ++++++++-- keyboard/staryu/config.h | 5 +++-- tmk_core_custom | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/keyboard/staryu/backlight.c b/keyboard/staryu/backlight.c index 3469fd08..8ded25b5 100644 --- a/keyboard/staryu/backlight.c +++ b/keyboard/staryu/backlight.c @@ -20,7 +20,7 @@ along with this program. If not, see . #include #include "backlight.h" #include "softpwm_led.h" -#include "action.h" +#include "hook.h" #include "timer.h" #include "rgb.h" @@ -45,6 +45,7 @@ void backlight_set(uint8_t level) backlight_brightness = pgm_read_byte(&backlight_table[level]); softpwm_led_set_all(backlight_brightness); rgb_set_brightness(backlight_brightness); + softpwm_led_enable_all(); break; case 4: case 5: @@ -53,13 +54,16 @@ void backlight_set(uint8_t level) breathing_led_set_duration(6 - level); breathing_led_set_index_all(0); breathing_led_enable_all(); + softpwm_led_enable_all(); break; case 7: breathing_led_disable_all(); breathing_led_set_duration(1); + softpwm_led_set_all(0); fading_led_set_direction_all(FADING_LED_FADE_OUT); fading_led_set_duration(3); fading_led_enable_all(); + softpwm_led_enable_all(); break; case 0: default: @@ -67,6 +71,7 @@ void backlight_set(uint8_t level) breathing_led_disable_all(); backlight_brightness = 0; softpwm_led_set_all(backlight_brightness); + softpwm_led_disable_all(); break; } } @@ -126,13 +131,14 @@ void softpwm_led_off(uint8_t index) static uint8_t idle_state = 0; static uint16_t idle_last = 0; -void action_keyevent(keyevent_t event) +void hook_matrix_change(keyevent_t event) { if (backlight_config.enable) { if (backlight_config.level == 7) { if (event.pressed) { if (idle_state > 1) { breathing_led_disable_all(); + softpwm_led_set_all(0); } idle_state = 0; uint8_t key = event.key.col + 1; diff --git a/keyboard/staryu/config.h b/keyboard/staryu/config.h index 7d174304..f551d22d 100644 --- a/keyboard/staryu/config.h +++ b/keyboard/staryu/config.h @@ -21,8 +21,8 @@ along with this program. If not, see . /* USB Device descriptor parameter */ #define VENDOR_ID 0x1209 -#define PRODUCT_ID 0x2333 -#define DEVICE_VER 0x0104 +#define PRODUCT_ID 0x2328 +#define DEVICE_VER 0x0205 #define MANUFACTURER K.T.E.C. #define PRODUCT Staryu #define DESCRIPTION t.m.k. keyboard firmware for Staryu @@ -45,6 +45,7 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 7 #define CUSTOM_LED_ENABLE #define RGB_LED_ENABLE +#define SOFTPWM_LED_FREQ 80 /* number of LEDs */ #define LED_COUNT 6 diff --git a/tmk_core_custom b/tmk_core_custom index 85bb7f9d..a9f231ea 160000 --- a/tmk_core_custom +++ b/tmk_core_custom @@ -1 +1 @@ -Subproject commit 85bb7f9de8452c1a4e718ae686f80249a490bc26 +Subproject commit a9f231ea07a9e16816cd98f76f77720634eb725e