diff options
Diffstat (limited to 'quantum/rgblight.h')
| -rw-r--r-- | quantum/rgblight.h | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 17f04ffcf..92130192c 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -1,9 +1,23 @@ | |||
| 1 | /* Copyright 2017 Yang Liu | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 1 | #ifndef RGBLIGHT_H | 16 | #ifndef RGBLIGHT_H |
| 2 | #define RGBLIGHT_H | 17 | #define RGBLIGHT_H |
| 3 | 18 | ||
| 4 | 19 | #ifdef RGBLIGHT_ANIMATIONS | |
| 5 | #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) | 20 | #define RGBLIGHT_MODES 34 |
| 6 | #define RGBLIGHT_MODES 23 | ||
| 7 | #else | 21 | #else |
| 8 | #define RGBLIGHT_MODES 1 | 22 | #define RGBLIGHT_MODES 1 |
| 9 | #endif | 23 | #endif |
| @@ -23,6 +37,14 @@ | |||
| 23 | #define RGBLIGHT_EFFECT_DUALKNIGHT_LENGTH 4 | 37 | #define RGBLIGHT_EFFECT_DUALKNIGHT_LENGTH 4 |
| 24 | #endif | 38 | #endif |
| 25 | 39 | ||
| 40 | #ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL | ||
| 41 | #define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP | ||
| 45 | #define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 | ||
| 46 | #endif | ||
| 47 | |||
| 26 | #ifndef RGBLIGHT_HUE_STEP | 48 | #ifndef RGBLIGHT_HUE_STEP |
| 27 | #define RGBLIGHT_HUE_STEP 10 | 49 | #define RGBLIGHT_HUE_STEP 10 |
| 28 | #endif | 50 | #endif |
| @@ -34,12 +56,15 @@ | |||
| 34 | #endif | 56 | #endif |
| 35 | 57 | ||
| 36 | #define RGBLED_TIMER_TOP F_CPU/(256*64) | 58 | #define RGBLED_TIMER_TOP F_CPU/(256*64) |
| 59 | // #define RGBLED_TIMER_TOP 0xFF10 | ||
| 37 | 60 | ||
| 38 | #include <stdint.h> | 61 | #include <stdint.h> |
| 39 | #include <stdbool.h> | 62 | #include <stdbool.h> |
| 40 | #include "eeconfig.h" | 63 | #include "eeconfig.h" |
| 41 | #include "light_ws2812.h" | 64 | #include "light_ws2812.h" |
| 42 | 65 | ||
| 66 | extern LED_TYPE led[RGBLED_NUM]; | ||
| 67 | |||
| 43 | extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; | 68 | extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; |
| 44 | extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM; | 69 | extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM; |
| 45 | extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; | 70 | extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; |
| @@ -61,9 +86,12 @@ void rgblight_init(void); | |||
| 61 | void rgblight_increase(void); | 86 | void rgblight_increase(void); |
| 62 | void rgblight_decrease(void); | 87 | void rgblight_decrease(void); |
| 63 | void rgblight_toggle(void); | 88 | void rgblight_toggle(void); |
| 89 | void rgblight_enable(void); | ||
| 64 | void rgblight_step(void); | 90 | void rgblight_step(void); |
| 91 | void rgblight_step_reverse(void); | ||
| 65 | void rgblight_mode(uint8_t mode); | 92 | void rgblight_mode(uint8_t mode); |
| 66 | void rgblight_set(void); | 93 | void rgblight_set(void); |
| 94 | void rgblight_update_dword(uint32_t dword); | ||
| 67 | void rgblight_increase_hue(void); | 95 | void rgblight_increase_hue(void); |
| 68 | void rgblight_decrease_hue(void); | 96 | void rgblight_decrease_hue(void); |
| 69 | void rgblight_increase_sat(void); | 97 | void rgblight_increase_sat(void); |
| @@ -78,10 +106,15 @@ void eeconfig_update_rgblight(uint32_t val); | |||
| 78 | void eeconfig_update_rgblight_default(void); | 106 | void eeconfig_update_rgblight_default(void); |
| 79 | void eeconfig_debug_rgblight(void); | 107 | void eeconfig_debug_rgblight(void); |
| 80 | 108 | ||
| 81 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1); | 109 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); |
| 82 | void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1); | 110 | void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); |
| 83 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); | 111 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); |
| 84 | 112 | ||
| 113 | #define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) | ||
| 114 | void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); | ||
| 115 | |||
| 116 | void rgblight_task(void); | ||
| 117 | |||
| 85 | void rgblight_timer_init(void); | 118 | void rgblight_timer_init(void); |
| 86 | void rgblight_timer_enable(void); | 119 | void rgblight_timer_enable(void); |
| 87 | void rgblight_timer_disable(void); | 120 | void rgblight_timer_disable(void); |
| @@ -91,5 +124,6 @@ void rgblight_effect_rainbow_mood(uint8_t interval); | |||
| 91 | void rgblight_effect_rainbow_swirl(uint8_t interval); | 124 | void rgblight_effect_rainbow_swirl(uint8_t interval); |
| 92 | void rgblight_effect_snake(uint8_t interval); | 125 | void rgblight_effect_snake(uint8_t interval); |
| 93 | void rgblight_effect_knight(uint8_t interval); | 126 | void rgblight_effect_knight(uint8_t interval); |
| 127 | void rgblight_effect_christmas(void); | ||
| 94 | 128 | ||
| 95 | #endif | 129 | #endif |
