|
|
@ -332,18 +332,28 @@ int zmk_rgb_underglow_off() { |
|
|
|
return zmk_rgb_underglow_save_state(); |
|
|
|
return zmk_rgb_underglow_save_state(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int zmk_rgb_underglow_cycle_effect(int direction) { |
|
|
|
int zmk_rgb_underglow_calc_effect(int direction) { |
|
|
|
|
|
|
|
return (state.current_effect + UNDERGLOW_EFFECT_NUMBER + direction) % UNDERGLOW_EFFECT_NUMBER; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int zmk_rgb_underglow_select_effect(int effect) { |
|
|
|
if (!led_strip) |
|
|
|
if (!led_strip) |
|
|
|
return -ENODEV; |
|
|
|
return -ENODEV; |
|
|
|
|
|
|
|
|
|
|
|
state.current_effect += UNDERGLOW_EFFECT_NUMBER + direction; |
|
|
|
if (effect < 0 || effect >= UNDERGLOW_EFFECT_NUMBER) { |
|
|
|
state.current_effect %= UNDERGLOW_EFFECT_NUMBER; |
|
|
|
return -EINVAL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state.current_effect = effect; |
|
|
|
state.animation_step = 0; |
|
|
|
state.animation_step = 0; |
|
|
|
|
|
|
|
|
|
|
|
return zmk_rgb_underglow_save_state(); |
|
|
|
return zmk_rgb_underglow_save_state(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int zmk_rgb_underglow_cycle_effect(int direction) { |
|
|
|
|
|
|
|
return zmk_rgb_underglow_select_effect(zmk_rgb_underglow_calc_effect(direction)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int zmk_rgb_underglow_toggle() { |
|
|
|
int zmk_rgb_underglow_toggle() { |
|
|
|
return state.on ? zmk_rgb_underglow_off() : zmk_rgb_underglow_on(); |
|
|
|
return state.on ? zmk_rgb_underglow_off() : zmk_rgb_underglow_on(); |
|
|
|
} |
|
|
|
} |
|
|
|