From 08d721de8ad7f5dfba78afdae08447d959bd6d02 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Mon, 24 Oct 2016 13:18:33 +0900 Subject: [PATCH] gh60: Update backlight to match new APIs --- keyboard/gh60/backlight.c | 15 +++++++++------ keyboard/gh60/config.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/keyboard/gh60/backlight.c b/keyboard/gh60/backlight.c index 7b200ef9..39c54c4b 100644 --- a/keyboard/gh60/backlight.c +++ b/keyboard/gh60/backlight.c @@ -24,7 +24,7 @@ along with this program. If not, see . #else #include "breathing_led.h" #endif -#include "action.h" +#include "hook.h" #ifdef BACKLIGHT_ENABLE @@ -54,7 +54,7 @@ static const uint8_t backlight_table[] PROGMEM = { void backlight_enable(void) { #ifdef SOFTPWM_LED_ENABLE - softpwm_led_enable(); + softpwm_led_enable_all(); #else #if defined(GH60_REV_CHN) // Turn on PWM @@ -80,7 +80,7 @@ void backlight_enable(void) void backlight_disable(void) { #ifdef SOFTPWM_LED_ENABLE - softpwm_led_disable(); + softpwm_led_disable_all(); #else #if defined(GH60_REV_CHN) // Turn off PWM @@ -105,6 +105,7 @@ void backlight_disable(void) void backlight_set(uint8_t level) { backlight_mode = level; + softpwm_enable(); #ifdef BREATHING_LED_ENABLE switch (level) { case 1: @@ -225,16 +226,18 @@ void softpwm_led_off(uint8_t index) #endif #endif -void action_keyevent(keyevent_t event) +void hook_matrix_change(keyevent_t event) { if (backlight_mode == 7) { if (event.pressed) { - softpwm_led_decrease_all(32); + fading_led_set_delay_all(32); + softpwm_led_decrease_all(16); } } if (backlight_mode == 8) { if (event.pressed) { - softpwm_led_increase_all(32); + fading_led_set_delay_all(32); + softpwm_led_increase_all(16); } } } diff --git a/keyboard/gh60/config.h b/keyboard/gh60/config.h index 4a59f270..fc2e3520 100644 --- a/keyboard/gh60/config.h +++ b/keyboard/gh60/config.h @@ -48,6 +48,7 @@ along with this program. If not, see . #else #define BACKLIGHT_LEVELS 3 #endif +#define BACKLIGHT_CUSTOM #ifdef GH60_REV_CNY #define LED_MATRIX_ROWS 6