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);
|
breathing_led_disable(BACKLIGHT);
|
||||||
backlight_brightness = pgm_read_byte(&backlight_table[level]);
|
backlight_brightness = pgm_read_byte(&backlight_table[level]);
|
||||||
softpwm_led_set(BACKLIGHT, backlight_brightness);
|
softpwm_led_set(BACKLIGHT, backlight_brightness);
|
||||||
|
rgb_set_brightness(backlight_brightness);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
@ -63,11 +64,13 @@ void backlight_set(uint8_t level)
|
|||||||
breathing_led_disable(BACKLIGHT);
|
breathing_led_disable(BACKLIGHT);
|
||||||
fading_led_set_direction(BACKLIGHT, FADING_LED_FADE_IN);
|
fading_led_set_direction(BACKLIGHT, FADING_LED_FADE_IN);
|
||||||
fading_led_set_duration(3);
|
fading_led_set_duration(3);
|
||||||
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
fading_led_enable(BACKLIGHT);
|
fading_led_enable(BACKLIGHT);
|
||||||
breathing_led_disable(BACKLIGHT);
|
breathing_led_disable(BACKLIGHT);
|
||||||
fading_led_set_direction(BACKLIGHT, FADING_LED_FADE_OUT);
|
fading_led_set_direction(BACKLIGHT, FADING_LED_FADE_OUT);
|
||||||
fading_led_set_duration(3);
|
fading_led_set_duration(3);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
@ -105,7 +108,12 @@ void softpwm_led_init()
|
|||||||
|
|
||||||
void softpwm_led_on(uint8_t index)
|
void softpwm_led_on(uint8_t index)
|
||||||
{
|
{
|
||||||
|
if (index) {
|
||||||
PORTF &= ~((1<<PF7) >> index);
|
PORTF &= ~((1<<PF7) >> index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PORTF |= (1<<PF7);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -126,7 +134,12 @@ void softpwm_led_on(uint8_t index)
|
|||||||
|
|
||||||
void softpwm_led_off(uint8_t index)
|
void softpwm_led_off(uint8_t index)
|
||||||
{
|
{
|
||||||
|
if (index) {
|
||||||
PORTF |= ((1<<PF7) >> index);
|
PORTF |= ((1<<PF7) >> index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PORTF &= ~(1<<PF7);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -150,6 +163,7 @@ void softpwm_led_off(uint8_t index)
|
|||||||
#ifdef FADING_LED_ENABLE
|
#ifdef FADING_LED_ENABLE
|
||||||
void action_keyevent(keyevent_t event)
|
void action_keyevent(keyevent_t event)
|
||||||
{
|
{
|
||||||
|
if (backlight_config.enable) {
|
||||||
if (backlight_config.level == 7) {
|
if (backlight_config.level == 7) {
|
||||||
if (event.pressed) {
|
if (event.pressed) {
|
||||||
fading_led_set_delay(BACKLIGHT, 64);
|
fading_led_set_delay(BACKLIGHT, 64);
|
||||||
@ -162,6 +176,7 @@ void action_keyevent(keyevent_t event)
|
|||||||
softpwm_led_increase(BACKLIGHT, 32);
|
softpwm_led_increase(BACKLIGHT, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ void rgb_step(void)
|
|||||||
|
|
||||||
void rgb_color_increase(uint8_t color)
|
void rgb_color_increase(uint8_t color)
|
||||||
{
|
{
|
||||||
|
if (rgb_config.level == RGB_FIXED) {
|
||||||
uint8_t *c = &rgb_color.raw[color];
|
uint8_t *c = &rgb_color.raw[color];
|
||||||
if (*c >= 240) {
|
if (*c >= 240) {
|
||||||
*c = 255;
|
*c = 255;
|
||||||
@ -146,10 +147,12 @@ void rgb_color_increase(uint8_t color)
|
|||||||
}
|
}
|
||||||
rgb_refresh(&rgb_color);
|
rgb_refresh(&rgb_color);
|
||||||
rgb_write_color();
|
rgb_write_color();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_color_decrease(uint8_t color)
|
void rgb_color_decrease(uint8_t color)
|
||||||
{
|
{
|
||||||
|
if (rgb_config.level == RGB_FIXED) {
|
||||||
uint8_t *c = &rgb_color.raw[color];
|
uint8_t *c = &rgb_color.raw[color];
|
||||||
if (*c > 240) {
|
if (*c > 240) {
|
||||||
*c = 240;
|
*c = 240;
|
||||||
@ -162,6 +165,7 @@ void rgb_color_decrease(uint8_t color)
|
|||||||
}
|
}
|
||||||
rgb_refresh(&rgb_color);
|
rgb_refresh(&rgb_color);
|
||||||
rgb_write_color();
|
rgb_write_color();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_set_level(uint8_t level)
|
void rgb_set_level(uint8_t level)
|
||||||
|
Reference in New Issue
Block a user