Add effect speed support for RGB Matrix *No EEPROM yet* (#2922)
* Added Modular keyboards L,R and NUM Created code modules for the 3 modules of the modular keyboard. Original idea by MechboardsUK. Uses i2c implementation similar to lets split * Remove modular from master This is to fix incorrect branching * Add effect speed support for RGB Matrix *No eeprom yet* Keycodes RGB_SPI and RGB_SPD have been added to increase and decrease effect speed. Speed is not saved in EEPROM yet as per Jack's request. * Update rgb_matrix.c * RGB Matrix speed fix rgblight.h * More fixes for rgb speed. Speed functions declared but not used in rgblight * More travis fixes.. * Another one for travis..
This commit is contained in:
parent
23df5fb89a
commit
afacd42368
8 changed files with 70 additions and 3 deletions
|
@ -27,6 +27,9 @@
|
|||
#define RGBLIGHT_LIMIT_VAL 255
|
||||
#endif
|
||||
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
|
||||
__attribute__ ((weak))
|
||||
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
|
||||
__attribute__ ((weak))
|
||||
|
@ -122,6 +125,7 @@ void eeconfig_update_rgblight_default(void) {
|
|||
rgblight_config.hue = 0;
|
||||
rgblight_config.sat = 255;
|
||||
rgblight_config.val = RGBLIGHT_LIMIT_VAL;
|
||||
rgblight_config.speed = 0;
|
||||
eeconfig_update_rgblight(rgblight_config.raw);
|
||||
}
|
||||
void eeconfig_debug_rgblight(void) {
|
||||
|
@ -131,6 +135,7 @@ void eeconfig_debug_rgblight(void) {
|
|||
dprintf("rgblight_config.hue = %d\n", rgblight_config.hue);
|
||||
dprintf("rgblight_config.sat = %d\n", rgblight_config.sat);
|
||||
dprintf("rgblight_config.val = %d\n", rgblight_config.val);
|
||||
dprintf("rgblight_config.speed = %d\n", rgblight_config.speed);
|
||||
}
|
||||
|
||||
void rgblight_init(void) {
|
||||
|
@ -280,6 +285,18 @@ void rgblight_disable(void) {
|
|||
rgblight_set();
|
||||
}
|
||||
|
||||
// Deals with the messy details of incrementing an integer
|
||||
uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
||||
int16_t new_value = value;
|
||||
new_value += step;
|
||||
return MIN( MAX( new_value, min ), max );
|
||||
}
|
||||
|
||||
uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
||||
int16_t new_value = value;
|
||||
new_value -= step;
|
||||
return MIN( MAX( new_value, min ), max );
|
||||
}
|
||||
|
||||
void rgblight_increase_hue(void) {
|
||||
uint16_t hue;
|
||||
|
@ -331,6 +348,15 @@ void rgblight_decrease_val(void) {
|
|||
}
|
||||
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
|
||||
}
|
||||
void rgblight_increase_speed(void) {
|
||||
rgblight_config.speed = increment( rgblight_config.speed, 1, 0, 3 );
|
||||
eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this
|
||||
}
|
||||
|
||||
void rgblight_decrease_speed(void) {
|
||||
rgblight_config.speed = decrement( rgblight_config.speed, 1, 0, 3 );
|
||||
eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this
|
||||
}
|
||||
|
||||
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||
inmem_config.raw = rgblight_config.raw;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue