diff options
| author | Takeshi ISHII <2170248+mtei@users.noreply.github.com> | 2021-07-17 12:13:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-17 12:13:16 +0900 |
| commit | d26537acc127e034c99509e90921c8307c4d0735 (patch) | |
| tree | 380d5aa299c9416d58894a69759483745ff441a6 | |
| parent | 932a67ced2c68363b07627ef4c095785f4ec5eee (diff) | |
| download | qmk_firmware-d26537acc127e034c99509e90921c8307c4d0735.tar.gz qmk_firmware-d26537acc127e034c99509e90921c8307c4d0735.zip | |
remove `RGBLIGHT_H_DUMMY_DEFINE` macro from rgblight.h (#13569)
| -rw-r--r-- | quantum/rgblight.h | 196 |
1 files changed, 96 insertions, 100 deletions
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index bec2c6695..58250a088 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -115,73 +115,71 @@ enum RGBLIGHT_EFFECT_MODE { | |||
| 115 | RGBLIGHT_MODE_last | 115 | RGBLIGHT_MODE_last |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | #ifndef RGBLIGHT_H_DUMMY_DEFINE | 118 | #define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1) |
| 119 | |||
| 120 | # define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1) | ||
| 121 | 119 | ||
| 122 | // sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 | 120 | // sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 |
| 123 | 121 | ||
| 124 | # ifndef RGBLIGHT_EFFECT_BREATHE_MAX | 122 | #ifndef RGBLIGHT_EFFECT_BREATHE_MAX |
| 125 | # define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 | 123 | # define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 |
| 126 | # endif | 124 | #endif |
| 127 | 125 | ||
| 128 | # ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH | 126 | #ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH |
| 129 | # define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 | 127 | # define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 |
| 130 | # endif | 128 | #endif |
| 131 | 129 | ||
| 132 | # ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH | 130 | #ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH |
| 133 | # define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 | 131 | # define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 |
| 134 | # endif | 132 | #endif |
| 135 | 133 | ||
| 136 | # ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET | 134 | #ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET |
| 137 | # define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 | 135 | # define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 |
| 138 | # endif | 136 | #endif |
| 139 | 137 | ||
| 140 | # ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM | 138 | #ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM |
| 141 | # define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (rgblight_ranges.effect_num_leds) | 139 | # define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (rgblight_ranges.effect_num_leds) |
| 142 | # endif | 140 | #endif |
| 143 | 141 | ||
| 144 | # ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL | 142 | #ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL |
| 145 | # define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 40 | 143 | # define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 40 |
| 146 | # endif | 144 | #endif |
| 147 | 145 | ||
| 148 | # ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP | 146 | #ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP |
| 149 | # define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 | 147 | # define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 |
| 150 | # endif | 148 | #endif |
| 151 | 149 | ||
| 152 | # ifndef RGBLIGHT_EFFECT_TWINKLE_LIFE | 150 | #ifndef RGBLIGHT_EFFECT_TWINKLE_LIFE |
| 153 | # define RGBLIGHT_EFFECT_TWINKLE_LIFE 200 | 151 | # define RGBLIGHT_EFFECT_TWINKLE_LIFE 200 |
| 154 | # endif | 152 | #endif |
| 155 | 153 | ||
| 156 | # ifndef RGBLIGHT_EFFECT_TWINKLE_PROBABILITY | 154 | #ifndef RGBLIGHT_EFFECT_TWINKLE_PROBABILITY |
| 157 | # define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 127 | 155 | # define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 127 |
| 158 | # endif | 156 | #endif |
| 159 | 157 | ||
| 160 | # ifndef RGBLIGHT_HUE_STEP | 158 | #ifndef RGBLIGHT_HUE_STEP |
| 161 | # define RGBLIGHT_HUE_STEP 8 | 159 | # define RGBLIGHT_HUE_STEP 8 |
| 162 | # endif | 160 | #endif |
| 163 | # ifndef RGBLIGHT_SAT_STEP | 161 | #ifndef RGBLIGHT_SAT_STEP |
| 164 | # define RGBLIGHT_SAT_STEP 17 | 162 | # define RGBLIGHT_SAT_STEP 17 |
| 165 | # endif | 163 | #endif |
| 166 | # ifndef RGBLIGHT_VAL_STEP | 164 | #ifndef RGBLIGHT_VAL_STEP |
| 167 | # define RGBLIGHT_VAL_STEP 17 | 165 | # define RGBLIGHT_VAL_STEP 17 |
| 168 | # endif | 166 | #endif |
| 169 | # ifndef RGBLIGHT_LIMIT_VAL | 167 | #ifndef RGBLIGHT_LIMIT_VAL |
| 170 | # define RGBLIGHT_LIMIT_VAL 255 | 168 | # define RGBLIGHT_LIMIT_VAL 255 |
| 171 | # endif | 169 | #endif |
| 172 | 170 | ||
| 173 | # include <stdint.h> | 171 | #include <stdint.h> |
| 174 | # include <stdbool.h> | 172 | #include <stdbool.h> |
| 175 | # include "eeconfig.h" | 173 | #include "eeconfig.h" |
| 176 | # include "ws2812.h" | 174 | #include "ws2812.h" |
| 177 | # include "color.h" | 175 | #include "color.h" |
| 178 | # include "rgblight_list.h" | 176 | #include "rgblight_list.h" |
| 179 | 177 | ||
| 180 | # if defined(__AVR__) | 178 | #if defined(__AVR__) |
| 181 | # include <avr/pgmspace.h> | 179 | # include <avr/pgmspace.h> |
| 182 | # endif | 180 | #endif |
| 183 | 181 | ||
| 184 | # ifdef RGBLIGHT_LAYERS | 182 | #ifdef RGBLIGHT_LAYERS |
| 185 | typedef struct { | 183 | typedef struct { |
| 186 | uint8_t index; // The first LED to light | 184 | uint8_t index; // The first LED to light |
| 187 | uint8_t count; // The number of LEDs to light | 185 | uint8_t count; // The number of LEDs to light |
| @@ -190,27 +188,27 @@ typedef struct { | |||
| 190 | uint8_t val; | 188 | uint8_t val; |
| 191 | } rgblight_segment_t; | 189 | } rgblight_segment_t; |
| 192 | 190 | ||
| 193 | # define RGBLIGHT_END_SEGMENT_INDEX (255) | 191 | # define RGBLIGHT_END_SEGMENT_INDEX (255) |
| 194 | # define RGBLIGHT_END_SEGMENTS \ | 192 | # define RGBLIGHT_END_SEGMENTS \ |
| 195 | { RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0 } | 193 | { RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0 } |
| 196 | # ifndef RGBLIGHT_MAX_LAYERS | 194 | # ifndef RGBLIGHT_MAX_LAYERS |
| 197 | # define RGBLIGHT_MAX_LAYERS 8 | 195 | # define RGBLIGHT_MAX_LAYERS 8 |
| 198 | # endif | 196 | # endif |
| 199 | # if RGBLIGHT_MAX_LAYERS <= 0 | 197 | # if RGBLIGHT_MAX_LAYERS <= 0 |
| 200 | # error invalid RGBLIGHT_MAX_LAYERS value (must be >= 1) | 198 | # error invalid RGBLIGHT_MAX_LAYERS value (must be >= 1) |
| 201 | # elif RGBLIGHT_MAX_LAYERS <= 8 | 199 | # elif RGBLIGHT_MAX_LAYERS <= 8 |
| 202 | typedef uint8_t rgblight_layer_mask_t; | 200 | typedef uint8_t rgblight_layer_mask_t; |
| 203 | # elif RGBLIGHT_MAX_LAYERS <= 16 | 201 | # elif RGBLIGHT_MAX_LAYERS <= 16 |
| 204 | typedef uint16_t rgblight_layer_mask_t; | 202 | typedef uint16_t rgblight_layer_mask_t; |
| 205 | # elif RGBLIGHT_MAX_LAYERS <= 32 | 203 | # elif RGBLIGHT_MAX_LAYERS <= 32 |
| 206 | typedef uint32_t rgblight_layer_mask_t; | 204 | typedef uint32_t rgblight_layer_mask_t; |
| 207 | # else | 205 | # else |
| 208 | # error invalid RGBLIGHT_MAX_LAYERS value (must be <= 32) | 206 | # error invalid RGBLIGHT_MAX_LAYERS value (must be <= 32) |
| 209 | # endif | 207 | # endif |
| 210 | # define RGBLIGHT_LAYER_SEGMENTS(...) \ | 208 | # define RGBLIGHT_LAYER_SEGMENTS(...) \ |
| 211 | { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } | 209 | { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } |
| 212 | # define RGBLIGHT_LAYERS_LIST(...) \ | 210 | # define RGBLIGHT_LAYERS_LIST(...) \ |
| 213 | { __VA_ARGS__, NULL } | 211 | { __VA_ARGS__, NULL } |
| 214 | 212 | ||
| 215 | // Get/set enabled rgblight layers | 213 | // Get/set enabled rgblight layers |
| 216 | void rgblight_set_layer_state(uint8_t layer, bool enabled); | 214 | void rgblight_set_layer_state(uint8_t layer, bool enabled); |
| @@ -219,14 +217,14 @@ bool rgblight_get_layer_state(uint8_t layer); | |||
| 219 | // Point this to an array of rgblight_segment_t arrays in keyboard_post_init_user to use rgblight layers | 217 | // Point this to an array of rgblight_segment_t arrays in keyboard_post_init_user to use rgblight layers |
| 220 | extern const rgblight_segment_t *const *rgblight_layers; | 218 | extern const rgblight_segment_t *const *rgblight_layers; |
| 221 | 219 | ||
| 222 | # ifdef RGBLIGHT_LAYER_BLINK | 220 | # ifdef RGBLIGHT_LAYER_BLINK |
| 223 | # define RGBLIGHT_USE_TIMER | 221 | # define RGBLIGHT_USE_TIMER |
| 224 | void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms); | 222 | void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms); |
| 225 | void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t times); | 223 | void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t times); |
| 226 | # endif | ||
| 227 | |||
| 228 | # endif | 224 | # endif |
| 229 | 225 | ||
| 226 | #endif | ||
| 227 | |||
| 230 | extern LED_TYPE led[RGBLED_NUM]; | 228 | extern LED_TYPE led[RGBLED_NUM]; |
| 231 | 229 | ||
| 232 | extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; | 230 | extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; |
| @@ -254,12 +252,12 @@ typedef union { | |||
| 254 | typedef struct _rgblight_status_t { | 252 | typedef struct _rgblight_status_t { |
| 255 | uint8_t base_mode; | 253 | uint8_t base_mode; |
| 256 | bool timer_enabled; | 254 | bool timer_enabled; |
| 257 | # ifdef RGBLIGHT_SPLIT | 255 | #ifdef RGBLIGHT_SPLIT |
| 258 | uint8_t change_flags; | 256 | uint8_t change_flags; |
| 259 | # endif | 257 | #endif |
| 260 | # ifdef RGBLIGHT_LAYERS | 258 | #ifdef RGBLIGHT_LAYERS |
| 261 | rgblight_layer_mask_t enabled_layer_mask; | 259 | rgblight_layer_mask_t enabled_layer_mask; |
| 262 | # endif | 260 | #endif |
| 263 | } rgblight_status_t; | 261 | } rgblight_status_t; |
| 264 | 262 | ||
| 265 | /* | 263 | /* |
| @@ -295,12 +293,12 @@ void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8 | |||
| 295 | void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end); | 293 | void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end); |
| 296 | void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); | 294 | void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); |
| 297 | 295 | ||
| 298 | # ifndef RGBLIGHT_SPLIT | 296 | #ifndef RGBLIGHT_SPLIT |
| 299 | void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); | 297 | void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); |
| 300 | void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); | 298 | void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); |
| 301 | void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val); | 299 | void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val); |
| 302 | void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val); | 300 | void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val); |
| 303 | # endif | 301 | #endif |
| 304 | 302 | ||
| 305 | /* effect mode change */ | 303 | /* effect mode change */ |
| 306 | void rgblight_mode(uint8_t mode); | 304 | void rgblight_mode(uint8_t mode); |
| @@ -374,29 +372,29 @@ void rgb_matrix_decrease(void); | |||
| 374 | void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); | 372 | void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); |
| 375 | void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); | 373 | void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); |
| 376 | 374 | ||
| 377 | # define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) | 375 | #define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) |
| 378 | void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); | 376 | void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); |
| 379 | 377 | ||
| 380 | # ifdef RGBLIGHT_USE_TIMER | 378 | #ifdef RGBLIGHT_USE_TIMER |
| 381 | void rgblight_task(void); | 379 | void rgblight_task(void); |
| 382 | void rgblight_timer_init(void); | 380 | void rgblight_timer_init(void); |
| 383 | void rgblight_timer_enable(void); | 381 | void rgblight_timer_enable(void); |
| 384 | void rgblight_timer_disable(void); | 382 | void rgblight_timer_disable(void); |
| 385 | void rgblight_timer_toggle(void); | 383 | void rgblight_timer_toggle(void); |
| 386 | # else | 384 | #else |
| 387 | # define rgblight_task() | 385 | # define rgblight_task() |
| 388 | # define rgblight_timer_init() | 386 | # define rgblight_timer_init() |
| 389 | # define rgblight_timer_enable() | 387 | # define rgblight_timer_enable() |
| 390 | # define rgblight_timer_disable() | 388 | # define rgblight_timer_disable() |
| 391 | # define rgblight_timer_toggle() | 389 | # define rgblight_timer_toggle() |
| 392 | # endif | 390 | #endif |
| 393 | 391 | ||
| 394 | # ifdef RGBLIGHT_SPLIT | 392 | #ifdef RGBLIGHT_SPLIT |
| 395 | # define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) | 393 | # define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) |
| 396 | # define RGBLIGHT_STATUS_CHANGE_HSVS (1 << 1) | 394 | # define RGBLIGHT_STATUS_CHANGE_HSVS (1 << 1) |
| 397 | # define RGBLIGHT_STATUS_CHANGE_TIMER (1 << 2) | 395 | # define RGBLIGHT_STATUS_CHANGE_TIMER (1 << 2) |
| 398 | # define RGBLIGHT_STATUS_ANIMATION_TICK (1 << 3) | 396 | # define RGBLIGHT_STATUS_ANIMATION_TICK (1 << 3) |
| 399 | # define RGBLIGHT_STATUS_CHANGE_LAYERS (1 << 4) | 397 | # define RGBLIGHT_STATUS_CHANGE_LAYERS (1 << 4) |
| 400 | 398 | ||
| 401 | typedef struct _rgblight_syncinfo_t { | 399 | typedef struct _rgblight_syncinfo_t { |
| 402 | rgblight_config_t config; | 400 | rgblight_config_t config; |
| @@ -409,9 +407,9 @@ void rgblight_clear_change_flags(void); | |||
| 409 | void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); | 407 | void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); |
| 410 | /* for split keyboard slave side */ | 408 | /* for split keyboard slave side */ |
| 411 | void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); | 409 | void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); |
| 412 | # endif | 410 | #endif |
| 413 | 411 | ||
| 414 | # ifdef RGBLIGHT_USE_TIMER | 412 | #ifdef RGBLIGHT_USE_TIMER |
| 415 | 413 | ||
| 416 | typedef struct _animation_status_t { | 414 | typedef struct _animation_status_t { |
| 417 | uint16_t last_timer; | 415 | uint16_t last_timer; |
| @@ -437,6 +435,4 @@ void rgblight_effect_rgbtest(animation_status_t *anim); | |||
| 437 | void rgblight_effect_alternating(animation_status_t *anim); | 435 | void rgblight_effect_alternating(animation_status_t *anim); |
| 438 | void rgblight_effect_twinkle(animation_status_t *anim); | 436 | void rgblight_effect_twinkle(animation_status_t *anim); |
| 439 | 437 | ||
| 440 | # endif | 438 | #endif |
| 441 | |||
| 442 | #endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE | ||
