1
0
This commit is contained in:
Kai Ryu 2016-11-04 12:54:47 +09:00
commit 2034ffcbb0
2 changed files with 10 additions and 6 deletions

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#else #else
#include "breathing_led.h" #include "breathing_led.h"
#endif #endif
#include "action.h" #include "hook.h"
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
@ -54,7 +54,7 @@ static const uint8_t backlight_table[] PROGMEM = {
void backlight_enable(void) void backlight_enable(void)
{ {
#ifdef SOFTPWM_LED_ENABLE #ifdef SOFTPWM_LED_ENABLE
softpwm_led_enable(); softpwm_led_enable_all();
#else #else
#if defined(GH60_REV_CHN) #if defined(GH60_REV_CHN)
// Turn on PWM // Turn on PWM
@ -80,7 +80,7 @@ void backlight_enable(void)
void backlight_disable(void) void backlight_disable(void)
{ {
#ifdef SOFTPWM_LED_ENABLE #ifdef SOFTPWM_LED_ENABLE
softpwm_led_disable(); softpwm_led_disable_all();
#else #else
#if defined(GH60_REV_CHN) #if defined(GH60_REV_CHN)
// Turn off PWM // Turn off PWM
@ -105,6 +105,7 @@ void backlight_disable(void)
void backlight_set(uint8_t level) void backlight_set(uint8_t level)
{ {
backlight_mode = level; backlight_mode = level;
softpwm_enable();
#ifdef BREATHING_LED_ENABLE #ifdef BREATHING_LED_ENABLE
switch (level) { switch (level) {
case 1: case 1:
@ -225,16 +226,18 @@ void softpwm_led_off(uint8_t index)
#endif #endif
#endif #endif
void action_keyevent(keyevent_t event) void hook_matrix_change(keyevent_t event)
{ {
if (backlight_mode == 7) { if (backlight_mode == 7) {
if (event.pressed) { if (event.pressed) {
softpwm_led_decrease_all(32); fading_led_set_delay_all(32);
softpwm_led_decrease_all(16);
} }
} }
if (backlight_mode == 8) { if (backlight_mode == 8) {
if (event.pressed) { if (event.pressed) {
softpwm_led_increase_all(32); fading_led_set_delay_all(32);
softpwm_led_increase_all(16);
} }
} }
} }

View File

@ -48,6 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#else #else
#define BACKLIGHT_LEVELS 3 #define BACKLIGHT_LEVELS 3
#endif #endif
#define BACKLIGHT_CUSTOM
#ifdef GH60_REV_CNY #ifdef GH60_REV_CNY
#define LED_MATRIX_ROWS 6 #define LED_MATRIX_ROWS 6