diff options
Diffstat (limited to 'quantum/rgblight.h')
| -rw-r--r-- | quantum/rgblight.h | 123 |
1 files changed, 71 insertions, 52 deletions
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 35d7942ca..064522a2b 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -99,7 +99,7 @@ enum RGBLIGHT_EFFECT_MODE { | |||
| 99 | #endif | 99 | #endif |
| 100 | 100 | ||
| 101 | #ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM | 101 | #ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM |
| 102 | #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM | 102 | #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (effect_num_leds) |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | #ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL | 105 | #ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL |
| @@ -170,61 +170,79 @@ typedef struct _rgblight_status_t { | |||
| 170 | #endif | 170 | #endif |
| 171 | } rgblight_status_t; | 171 | } rgblight_status_t; |
| 172 | 172 | ||
| 173 | #ifdef RGBLIGHT_SPLIT | 173 | /* === Utility Functions ===*/ |
| 174 | #define RGBLIGHT_STATUS_CHANGE_MODE (1<<0) | 174 | void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); |
| 175 | #define RGBLIGHT_STATUS_CHANGE_HSVS (1<<1) | 175 | void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check |
| 176 | #define RGBLIGHT_STATUS_CHANGE_TIMER (1<<2) | 176 | void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); |
| 177 | #define RGBLIGHT_STATUS_ANIMATION_TICK (1<<3) | ||
| 178 | 177 | ||
| 179 | typedef struct _rgblight_syncinfo_t { | 178 | /* === Low level Functions === */ |
| 180 | rgblight_config_t config; | 179 | void rgblight_set(void); |
| 181 | rgblight_status_t status; | 180 | void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds); |
| 182 | } rgblight_syncinfo_t; | ||
| 183 | 181 | ||
| 184 | /* for split keyboard master side */ | 182 | /* === Effects and Animations Functions === */ |
| 185 | uint8_t rgblight_get_change_flags(void); | 183 | /* effect range setting */ |
| 186 | void rgblight_clear_change_flags(void); | 184 | void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds); |
| 187 | void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); | 185 | |
| 188 | /* for split keyboard slave side */ | 186 | /* direct operation */ |
| 189 | void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); | 187 | void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index); |
| 188 | void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index); | ||
| 189 | void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end); | ||
| 190 | void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end); | ||
| 191 | void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); | ||
| 192 | |||
| 193 | #ifndef RGBLIGHT_SPLIT | ||
| 194 | void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); | ||
| 195 | void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); | ||
| 196 | void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val); | ||
| 197 | void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val); | ||
| 190 | #endif | 198 | #endif |
| 191 | 199 | ||
| 192 | void rgblight_init(void); | 200 | /* effect mode change */ |
| 201 | void rgblight_mode(uint8_t mode); | ||
| 202 | void rgblight_mode_noeeprom(uint8_t mode); | ||
| 193 | void rgblight_increase(void); | 203 | void rgblight_increase(void); |
| 194 | void rgblight_decrease(void); | 204 | void rgblight_decrease(void); |
| 205 | void rgblight_step(void); | ||
| 206 | void rgblight_step_noeeprom(void); | ||
| 207 | void rgblight_step_reverse(void); | ||
| 208 | void rgblight_step_reverse_noeeprom(void); | ||
| 209 | |||
| 210 | /* effects mode disable/enable */ | ||
| 195 | void rgblight_toggle(void); | 211 | void rgblight_toggle(void); |
| 212 | void rgblight_toggle_noeeprom(void); | ||
| 196 | void rgblight_enable(void); | 213 | void rgblight_enable(void); |
| 214 | void rgblight_enable_noeeprom(void); | ||
| 197 | void rgblight_disable(void); | 215 | void rgblight_disable(void); |
| 198 | void rgblight_step(void); | 216 | void rgblight_disable_noeeprom(void); |
| 199 | void rgblight_step_reverse(void); | 217 | |
| 200 | uint8_t rgblight_get_mode(void); | 218 | /* hue, sat, val change */ |
| 201 | void rgblight_mode(uint8_t mode); | ||
| 202 | void rgblight_set(void); | ||
| 203 | uint32_t rgblight_read_dword(void); | ||
| 204 | void rgblight_update_dword(uint32_t dword); | ||
| 205 | void rgblight_increase_hue(void); | 219 | void rgblight_increase_hue(void); |
| 220 | void rgblight_increase_hue_noeeprom(void); | ||
| 206 | void rgblight_decrease_hue(void); | 221 | void rgblight_decrease_hue(void); |
| 222 | void rgblight_decrease_hue_noeeprom(void); | ||
| 207 | void rgblight_increase_sat(void); | 223 | void rgblight_increase_sat(void); |
| 224 | void rgblight_increase_sat_noeeprom(void); | ||
| 208 | void rgblight_decrease_sat(void); | 225 | void rgblight_decrease_sat(void); |
| 226 | void rgblight_decrease_sat_noeeprom(void); | ||
| 209 | void rgblight_increase_val(void); | 227 | void rgblight_increase_val(void); |
| 228 | void rgblight_increase_val_noeeprom(void); | ||
| 210 | void rgblight_decrease_val(void); | 229 | void rgblight_decrease_val(void); |
| 230 | void rgblight_decrease_val_noeeprom(void); | ||
| 211 | void rgblight_increase_speed(void); | 231 | void rgblight_increase_speed(void); |
| 212 | void rgblight_decrease_speed(void); | 232 | void rgblight_decrease_speed(void); |
| 213 | void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val); | 233 | void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val); |
| 234 | void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val); | ||
| 235 | |||
| 236 | /* query */ | ||
| 237 | uint8_t rgblight_get_mode(void); | ||
| 214 | uint8_t rgblight_get_hue(void); | 238 | uint8_t rgblight_get_hue(void); |
| 215 | uint8_t rgblight_get_sat(void); | 239 | uint8_t rgblight_get_sat(void); |
| 216 | uint8_t rgblight_get_val(void); | 240 | uint8_t rgblight_get_val(void); |
| 217 | void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); | ||
| 218 | void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index); | ||
| 219 | void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index); | ||
| 220 | void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end); | ||
| 221 | void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end); | ||
| 222 | void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); | ||
| 223 | void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); | ||
| 224 | void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val); | ||
| 225 | void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val); | ||
| 226 | void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds); | ||
| 227 | 241 | ||
| 242 | /* === qmk_firmware (core)internal Functions === */ | ||
| 243 | void rgblight_init(void); | ||
| 244 | uint32_t rgblight_read_dword(void); | ||
| 245 | void rgblight_update_dword(uint32_t dword); | ||
| 228 | uint32_t eeconfig_read_rgblight(void); | 246 | uint32_t eeconfig_read_rgblight(void); |
| 229 | void eeconfig_update_rgblight(uint32_t val); | 247 | void eeconfig_update_rgblight(uint32_t val); |
| 230 | void eeconfig_update_rgblight_default(void); | 248 | void eeconfig_update_rgblight_default(void); |
| @@ -233,27 +251,9 @@ void eeconfig_debug_rgblight(void); | |||
| 233 | void rgb_matrix_increase(void); | 251 | void rgb_matrix_increase(void); |
| 234 | void rgb_matrix_decrease(void); | 252 | void rgb_matrix_decrease(void); |
| 235 | 253 | ||
| 236 | void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); | ||
| 237 | void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); | ||
| 238 | |||
| 239 | void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val); | ||
| 240 | void rgblight_mode_noeeprom(uint8_t mode); | ||
| 241 | void rgblight_toggle_noeeprom(void); | ||
| 242 | void rgblight_enable_noeeprom(void); | ||
| 243 | void rgblight_disable_noeeprom(void); | ||
| 244 | void rgblight_step_noeeprom(void); | ||
| 245 | void rgblight_step_reverse_noeeprom(void); | ||
| 246 | void rgblight_increase_hue_noeeprom(void); | ||
| 247 | void rgblight_decrease_hue_noeeprom(void); | ||
| 248 | void rgblight_increase_sat_noeeprom(void); | ||
| 249 | void rgblight_decrease_sat_noeeprom(void); | ||
| 250 | void rgblight_increase_val_noeeprom(void); | ||
| 251 | void rgblight_decrease_val_noeeprom(void); | ||
| 252 | |||
| 253 | void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); | 254 | void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); |
| 254 | void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); | 255 | void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); |
| 255 | 256 | ||
| 256 | |||
| 257 | #define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) | 257 | #define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) |
| 258 | void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); | 258 | void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); |
| 259 | 259 | ||
| @@ -264,6 +264,25 @@ void rgblight_timer_enable(void); | |||
| 264 | void rgblight_timer_disable(void); | 264 | void rgblight_timer_disable(void); |
| 265 | void rgblight_timer_toggle(void); | 265 | void rgblight_timer_toggle(void); |
| 266 | 266 | ||
| 267 | #ifdef RGBLIGHT_SPLIT | ||
| 268 | #define RGBLIGHT_STATUS_CHANGE_MODE (1<<0) | ||
| 269 | #define RGBLIGHT_STATUS_CHANGE_HSVS (1<<1) | ||
| 270 | #define RGBLIGHT_STATUS_CHANGE_TIMER (1<<2) | ||
| 271 | #define RGBLIGHT_STATUS_ANIMATION_TICK (1<<3) | ||
| 272 | |||
| 273 | typedef struct _rgblight_syncinfo_t { | ||
| 274 | rgblight_config_t config; | ||
| 275 | rgblight_status_t status; | ||
| 276 | } rgblight_syncinfo_t; | ||
| 277 | |||
| 278 | /* for split keyboard master side */ | ||
| 279 | uint8_t rgblight_get_change_flags(void); | ||
| 280 | void rgblight_clear_change_flags(void); | ||
| 281 | void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); | ||
| 282 | /* for split keyboard slave side */ | ||
| 283 | void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); | ||
| 284 | #endif | ||
| 285 | |||
| 267 | #ifdef RGBLIGHT_USE_TIMER | 286 | #ifdef RGBLIGHT_USE_TIMER |
| 268 | 287 | ||
| 269 | typedef struct _animation_status_t { | 288 | typedef struct _animation_status_t { |
