fantastic60: Fix bugs regarding backlight and RGB LED
- Bug fixes - Change driving of backlight led to active high - Handle typing led only when backlight is on - Handle rgb increase/decrease only in rgb fixed mode - Add setting rgb brightness when swiching backlight level
This commit is contained in:
parent
2dce1236b7
commit
712510350c
@ -47,6 +47,7 @@ void backlight_set(uint8_t level)
|
||||
breathing_led_disable(BACKLIGHT);
|
||||
backlight_brightness = pgm_read_byte(&backlight_table[level]);
|
||||
softpwm_led_set(BACKLIGHT, backlight_brightness);
|
||||
rgb_set_brightness(backlight_brightness);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
@ -63,11 +64,13 @@ void backlight_set(uint8_t level)
|
||||
breathing_led_disable(BACKLIGHT);
|
||||
fading_led_set_direction(BACKLIGHT, FADING_LED_FADE_IN);
|
||||
fading_led_set_duration(3);
|
||||
break;
|
||||
case 8:
|
||||
fading_led_enable(BACKLIGHT);
|
||||
breathing_led_disable(BACKLIGHT);
|
||||
fading_led_set_direction(BACKLIGHT, FADING_LED_FADE_OUT);
|
||||
fading_led_set_duration(3);
|
||||
break;
|
||||
#endif
|
||||
case 0:
|
||||
default:
|
||||
@ -105,7 +108,12 @@ void softpwm_led_init()
|
||||
|
||||
void softpwm_led_on(uint8_t index)
|
||||
{
|
||||
if (index) {
|
||||
PORTF &= ~((1<<PF7) >> index);
|
||||
}
|
||||
else {
|
||||
PORTF |= (1<<PF7);
|
||||
}
|
||||
/*
|
||||
switch (index) {
|
||||
case 0:
|
||||
@ -126,7 +134,12 @@ void softpwm_led_on(uint8_t index)
|
||||
|
||||
void softpwm_led_off(uint8_t index)
|
||||
{
|
||||
if (index) {
|
||||
PORTF |= ((1<<PF7) >> index);
|
||||
}
|
||||
else {
|
||||
PORTF &= ~(1<<PF7);
|
||||
}
|
||||
/*
|
||||
switch (index) {
|
||||
case 0:
|
||||
@ -150,6 +163,7 @@ void softpwm_led_off(uint8_t index)
|
||||
#ifdef FADING_LED_ENABLE
|
||||
void action_keyevent(keyevent_t event)
|
||||
{
|
||||
if (backlight_config.enable) {
|
||||
if (backlight_config.level == 7) {
|
||||
if (event.pressed) {
|
||||
fading_led_set_delay(BACKLIGHT, 64);
|
||||
@ -163,6 +177,7 @@ void action_keyevent(keyevent_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_LED_ENABLE
|
||||
|
@ -137,6 +137,7 @@ void rgb_step(void)
|
||||
|
||||
void rgb_color_increase(uint8_t color)
|
||||
{
|
||||
if (rgb_config.level == RGB_FIXED) {
|
||||
uint8_t *c = &rgb_color.raw[color];
|
||||
if (*c >= 240) {
|
||||
*c = 255;
|
||||
@ -147,9 +148,11 @@ void rgb_color_increase(uint8_t color)
|
||||
rgb_refresh(&rgb_color);
|
||||
rgb_write_color();
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_color_decrease(uint8_t color)
|
||||
{
|
||||
if (rgb_config.level == RGB_FIXED) {
|
||||
uint8_t *c = &rgb_color.raw[color];
|
||||
if (*c > 240) {
|
||||
*c = 240;
|
||||
@ -163,6 +166,7 @@ void rgb_color_decrease(uint8_t color)
|
||||
rgb_refresh(&rgb_color);
|
||||
rgb_write_color();
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_set_level(uint8_t level)
|
||||
{
|
||||
|
Reference in New Issue
Block a user