diff options
| author | Alex Ong <the.onga@gmail.com> | 2019-01-04 19:43:45 +1100 |
|---|---|---|
| committer | Alex Ong <the.onga@gmail.com> | 2019-01-04 19:43:45 +1100 |
| commit | 2bb2977c133646c4e056960e72029270d77cc1eb (patch) | |
| tree | 235d491f992121ac1716c5bf2fafb80983748576 /quantum/rgb_matrix.h | |
| parent | a55c838961c89097ab849ed6cb1f261791e6b9b4 (diff) | |
| parent | 47c91fc7f75ae0a477e55b687aa0fc30da0a283c (diff) | |
| download | qmk_firmware-2bb2977c133646c4e056960e72029270d77cc1eb.tar.gz qmk_firmware-2bb2977c133646c4e056960e72029270d77cc1eb.zip | |
Merge branch 'master' into debounce_refactor
# Conflicts:
# tmk_core/common/keyboard.c
Diffstat (limited to 'quantum/rgb_matrix.h')
| -rw-r--r-- | quantum/rgb_matrix.h | 120 |
1 files changed, 99 insertions, 21 deletions
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index b91c9fba5..e43532d11 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h | |||
| @@ -70,28 +70,64 @@ typedef union { | |||
| 70 | 70 | ||
| 71 | enum rgb_matrix_effects { | 71 | enum rgb_matrix_effects { |
| 72 | RGB_MATRIX_SOLID_COLOR = 1, | 72 | RGB_MATRIX_SOLID_COLOR = 1, |
| 73 | #ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS | ||
| 73 | RGB_MATRIX_ALPHAS_MODS, | 74 | RGB_MATRIX_ALPHAS_MODS, |
| 75 | #endif | ||
| 76 | #ifndef DISABLE_RGB_MATRIX_DUAL_BEACON | ||
| 74 | RGB_MATRIX_DUAL_BEACON, | 77 | RGB_MATRIX_DUAL_BEACON, |
| 78 | #endif | ||
| 79 | #ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN | ||
| 75 | RGB_MATRIX_GRADIENT_UP_DOWN, | 80 | RGB_MATRIX_GRADIENT_UP_DOWN, |
| 81 | #endif | ||
| 82 | #ifndef DISABLE_RGB_MATRIX_RAINDROPS | ||
| 76 | RGB_MATRIX_RAINDROPS, | 83 | RGB_MATRIX_RAINDROPS, |
| 84 | #endif | ||
| 85 | #ifndef DISABLE_RGB_MATRIX_CYCLE_ALL | ||
| 77 | RGB_MATRIX_CYCLE_ALL, | 86 | RGB_MATRIX_CYCLE_ALL, |
| 87 | #endif | ||
| 88 | #ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
| 78 | RGB_MATRIX_CYCLE_LEFT_RIGHT, | 89 | RGB_MATRIX_CYCLE_LEFT_RIGHT, |
| 90 | #endif | ||
| 91 | #ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN | ||
| 79 | RGB_MATRIX_CYCLE_UP_DOWN, | 92 | RGB_MATRIX_CYCLE_UP_DOWN, |
| 93 | #endif | ||
| 94 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON | ||
| 80 | RGB_MATRIX_RAINBOW_BEACON, | 95 | RGB_MATRIX_RAINBOW_BEACON, |
| 96 | #endif | ||
| 97 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS | ||
| 81 | RGB_MATRIX_RAINBOW_PINWHEELS, | 98 | RGB_MATRIX_RAINBOW_PINWHEELS, |
| 99 | #endif | ||
| 100 | #ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | ||
| 82 | RGB_MATRIX_RAINBOW_MOVING_CHEVRON, | 101 | RGB_MATRIX_RAINBOW_MOVING_CHEVRON, |
| 102 | #endif | ||
| 103 | #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | ||
| 83 | RGB_MATRIX_JELLYBEAN_RAINDROPS, | 104 | RGB_MATRIX_JELLYBEAN_RAINDROPS, |
| 105 | #endif | ||
| 106 | #ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN | ||
| 107 | RGB_MATRIX_DIGITAL_RAIN, | ||
| 108 | #endif | ||
| 84 | #ifdef RGB_MATRIX_KEYPRESSES | 109 | #ifdef RGB_MATRIX_KEYPRESSES |
| 85 | RGB_MATRIX_SOLID_REACTIVE, | 110 | #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE |
| 86 | RGB_MATRIX_SPLASH, | 111 | RGB_MATRIX_SOLID_REACTIVE, |
| 87 | RGB_MATRIX_MULTISPLASH, | 112 | #endif |
| 88 | RGB_MATRIX_SOLID_SPLASH, | 113 | #ifndef DISABLE_RGB_MATRIX_SPLASH |
| 89 | RGB_MATRIX_SOLID_MULTISPLASH, | 114 | RGB_MATRIX_SPLASH, |
| 115 | #endif | ||
| 116 | #ifndef DISABLE_RGB_MATRIX_MULTISPLASH | ||
| 117 | RGB_MATRIX_MULTISPLASH, | ||
| 118 | #endif | ||
| 119 | #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH | ||
| 120 | RGB_MATRIX_SOLID_SPLASH, | ||
| 121 | #endif | ||
| 122 | #ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH | ||
| 123 | RGB_MATRIX_SOLID_MULTISPLASH, | ||
| 124 | #endif | ||
| 90 | #endif | 125 | #endif |
| 91 | RGB_MATRIX_EFFECT_MAX | 126 | RGB_MATRIX_EFFECT_MAX |
| 92 | }; | 127 | }; |
| 93 | 128 | ||
| 94 | void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ); | 129 | void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ); |
| 130 | void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); | ||
| 95 | 131 | ||
| 96 | // This runs after another backlight effect and replaces | 132 | // This runs after another backlight effect and replaces |
| 97 | // colors already set | 133 | // colors already set |
| @@ -99,8 +135,6 @@ void rgb_matrix_indicators(void); | |||
| 99 | void rgb_matrix_indicators_kb(void); | 135 | void rgb_matrix_indicators_kb(void); |
| 100 | void rgb_matrix_indicators_user(void); | 136 | void rgb_matrix_indicators_user(void); |
| 101 | 137 | ||
| 102 | void rgb_matrix_single_LED_test(void); | ||
| 103 | |||
| 104 | void rgb_matrix_init(void); | 138 | void rgb_matrix_init(void); |
| 105 | void rgb_matrix_setup_drivers(void); | 139 | void rgb_matrix_setup_drivers(void); |
| 106 | 140 | ||
| @@ -125,21 +159,65 @@ void rgb_matrix_decrease(void); | |||
| 125 | // void backlight_get_key_color( uint8_t led, HSV *hsv ); | 159 | // void backlight_get_key_color( uint8_t led, HSV *hsv ); |
| 126 | // void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ); | 160 | // void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ); |
| 127 | 161 | ||
| 128 | void rgb_matrix_test_led( uint8_t index, bool red, bool green, bool blue ); | ||
| 129 | uint32_t rgb_matrix_get_tick(void); | 162 | uint32_t rgb_matrix_get_tick(void); |
| 130 | 163 | ||
| 131 | void rgblight_toggle(void); | 164 | void rgb_matrix_toggle(void); |
| 132 | void rgblight_step(void); | 165 | void rgb_matrix_enable(void); |
| 133 | void rgblight_step_reverse(void); | 166 | void rgb_matrix_enable_noeeprom(void); |
| 134 | void rgblight_increase_hue(void); | 167 | void rgb_matrix_disable(void); |
| 135 | void rgblight_decrease_hue(void); | 168 | void rgb_matrix_disable_noeeprom(void); |
| 136 | void rgblight_increase_sat(void); | 169 | void rgb_matrix_step(void); |
| 137 | void rgblight_decrease_sat(void); | 170 | void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val); |
| 138 | void rgblight_increase_val(void); | 171 | void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); |
| 139 | void rgblight_decrease_val(void); | 172 | void rgb_matrix_step_reverse(void); |
| 140 | void rgblight_increase_speed(void); | 173 | void rgb_matrix_increase_hue(void); |
| 141 | void rgblight_decrease_speed(void); | 174 | void rgb_matrix_decrease_hue(void); |
| 142 | void rgblight_mode(uint8_t mode); | 175 | void rgb_matrix_increase_sat(void); |
| 143 | uint32_t rgblight_get_mode(void); | 176 | void rgb_matrix_decrease_sat(void); |
| 177 | void rgb_matrix_increase_val(void); | ||
| 178 | void rgb_matrix_decrease_val(void); | ||
| 179 | void rgb_matrix_increase_speed(void); | ||
| 180 | void rgb_matrix_decrease_speed(void); | ||
| 181 | void rgb_matrix_mode(uint8_t mode); | ||
| 182 | void rgb_matrix_mode_noeeprom(uint8_t mode); | ||
| 183 | uint8_t rgb_matrix_get_mode(void); | ||
| 184 | |||
| 185 | #ifndef RGBLIGHT_ENABLE | ||
| 186 | #define rgblight_toggle() rgb_matrix_toggle() | ||
| 187 | #define rgblight_enable() rgb_matrix_enable() | ||
| 188 | #define rgblight_enable_noeeprom() rgb_matrix_enable_noeeprom() | ||
| 189 | #define rgblight_disable() rgb_matrix_disable() | ||
| 190 | #define rgblight_disable_noeeprom() rgb_matrix_disable_noeeprom() | ||
| 191 | #define rgblight_step() rgb_matrix_step() | ||
| 192 | #define rgblight_sethsv(hue, sat, val) rgb_matrix_sethsv(hue, sat, val) | ||
| 193 | #define rgblight_sethsv_noeeprom(hue, sat, val) rgb_matrix_sethsv_noeeprom(hue, sat, val) | ||
| 194 | #define rgblight_step_reverse() rgb_matrix_step_reverse() | ||
| 195 | #define rgblight_increase_hue() rgb_matrix_increase_hue() | ||
| 196 | #define rgblight_decrease_hue() rgb_matrix_decrease_hue() | ||
| 197 | #define rgblight_increase_sat() rgb_matrix_increase_sat() | ||
| 198 | #define rgblight_decrease_sat() rgb_matrix_decrease_sat() | ||
| 199 | #define rgblight_increase_val() rgb_matrix_increase_val() | ||
| 200 | #define rgblight_decrease_val() rgb_matrix_decrease_val() | ||
| 201 | #define rgblight_increase_speed() rgb_matrix_increase_speed() | ||
| 202 | #define rgblight_decrease_speed() rgb_matrix_decrease_speed() | ||
| 203 | #define rgblight_mode(mode) rgb_matrix_mode(mode) | ||
| 204 | #define rgblight_mode_noeeprom(mode) rgb_matrix_mode_noeeprom(mode) | ||
| 205 | #define rgblight_get_mode() rgb_matrix_get_mode() | ||
| 206 | |||
| 207 | #endif | ||
| 208 | |||
| 209 | typedef struct { | ||
| 210 | /* Perform any initialisation required for the other driver functions to work. */ | ||
| 211 | void (*init)(void); | ||
| 212 | |||
| 213 | /* Set the colour of a single LED in the buffer. */ | ||
| 214 | void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b); | ||
| 215 | /* Set the colour of all LEDS on the keyboard in the buffer. */ | ||
| 216 | void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b); | ||
| 217 | /* Flush any buffered changes to the hardware. */ | ||
| 218 | void (*flush)(void); | ||
| 219 | } rgb_matrix_driver_t; | ||
| 220 | |||
| 221 | extern const rgb_matrix_driver_t rgb_matrix_driver; | ||
| 144 | 222 | ||
| 145 | #endif | 223 | #endif |
