Add two new fading backlight effects
- Fade in when press and fade out when release - Fade out when press and fade in when release
This commit is contained in:
parent
c4f21b470c
commit
c68b1fd6c0
@ -53,16 +53,18 @@ void backlight_set(uint8_t level)
|
||||
breathing_led_set_duration(6 - level);
|
||||
break;
|
||||
case 7:
|
||||
fading_led_enable_all();
|
||||
breathing_led_disable_all();
|
||||
fading_led_set_direction(FADING_LED_FADE_IN);
|
||||
fading_led_set_duration(3);
|
||||
break;
|
||||
case 8:
|
||||
fading_led_enable_all();
|
||||
breathing_led_disable_all();
|
||||
fading_led_set_direction(FADING_LED_FADE_OUT);
|
||||
fading_led_set_duration(3);
|
||||
fading_led_set_direction_all(FADING_LED_FADE_IN);
|
||||
fading_led_set_duration(level == 7 ? 3 : 0);
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
fading_led_enable_all();
|
||||
breathing_led_disable_all();
|
||||
fading_led_set_direction_all(FADING_LED_FADE_OUT);
|
||||
fading_led_set_duration(level == 9 ? 3 : 0);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
@ -129,15 +131,35 @@ void softpwm_led_off(uint8_t index)
|
||||
void action_keyevent(keyevent_t event)
|
||||
{
|
||||
if (backlight_config.enable) {
|
||||
if (backlight_config.level == 7) {
|
||||
if (event.pressed) {
|
||||
softpwm_led_decrease(event.key.col, 32);
|
||||
}
|
||||
}
|
||||
if (backlight_config.level == 8) {
|
||||
if (event.pressed) {
|
||||
softpwm_led_increase(event.key.col, 32);
|
||||
}
|
||||
switch (backlight_config.level) {
|
||||
case 7:
|
||||
if (event.pressed) {
|
||||
fading_led_set_delay(event.key.col, 64);
|
||||
softpwm_led_decrease(event.key.col, 32);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if (event.pressed) {
|
||||
fading_led_set_direction(event.key.col, FADING_LED_FADE_OUT);
|
||||
}
|
||||
else {
|
||||
fading_led_set_direction(event.key.col, FADING_LED_FADE_IN);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (event.pressed) {
|
||||
fading_led_set_delay(event.key.col, 64);
|
||||
softpwm_led_increase(event.key.col, 32);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (event.pressed) {
|
||||
fading_led_set_direction(event.key.col, FADING_LED_FADE_IN);
|
||||
}
|
||||
else {
|
||||
fading_led_set_direction(event.key.col, FADING_LED_FADE_OUT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,11 +167,22 @@ void action_keyevent(keyevent_t event)
|
||||
#ifdef CUSTOM_LED_ENABLE
|
||||
void fading_led_custom(uint8_t *value)
|
||||
{
|
||||
uint8_t max = 0;
|
||||
for (uint8_t i = 0; i < LED_COUNT; i++) {
|
||||
if (value[i] > max) max = value[i];
|
||||
uint8_t tmp = value[0];
|
||||
switch (backlight_config.level) {
|
||||
case 7:
|
||||
case 8:
|
||||
for (uint8_t i = 0; i < LED_COUNT; i++) {
|
||||
if (value[i] < tmp) tmp = value[i];
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
for (uint8_t i = 0; i < LED_COUNT; i++) {
|
||||
if (value[i] > tmp) tmp = value[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
rgb_set_brightness(max);
|
||||
rgb_set_brightness(tmp);
|
||||
}
|
||||
|
||||
void breathing_led_custom(uint8_t *value)
|
||||
|
@ -42,7 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* number of backlight levels */
|
||||
#define BACKLIGHT_LEVELS 8
|
||||
#define BACKLIGHT_LEVELS 10
|
||||
|
||||
/* number of LEDs */
|
||||
#define LED_COUNT 5
|
||||
|
Reference in New Issue
Block a user