1 /* Copyright 2017 Jason Williams
2 * Copyright 2017 Jack Humbert
3 * Copyright 2018 Yiancar
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #include "is31fl3731.h"
29 #elif defined (IS31FL3733)
30 #include "is31fl3733.h"
33 typedef struct Point {
36 } __attribute__((packed)) Point;
38 typedef struct rgb_led {
42 uint8_t row:4; // 16 max
43 uint8_t col:4; // 16 max
48 } __attribute__((packed)) rgb_led;
51 extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
67 uint8_t speed :8;//EECONFIG needs to be increased to support this
71 enum rgb_matrix_effects {
72 RGB_MATRIX_SOLID_COLOR = 1,
73 RGB_MATRIX_ALPHAS_MODS,
74 RGB_MATRIX_DUAL_BEACON,
75 RGB_MATRIX_GRADIENT_UP_DOWN,
78 RGB_MATRIX_CYCLE_LEFT_RIGHT,
79 RGB_MATRIX_CYCLE_UP_DOWN,
80 RGB_MATRIX_RAINBOW_BEACON,
81 RGB_MATRIX_RAINBOW_PINWHEELS,
82 RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
83 RGB_MATRIX_JELLYBEAN_RAINDROPS,
84 RGB_MATRIX_DIGITAL_RAIN,
85 #ifdef RGB_MATRIX_KEYPRESSES
86 RGB_MATRIX_SOLID_REACTIVE,
88 RGB_MATRIX_MULTISPLASH,
89 RGB_MATRIX_SOLID_SPLASH,
90 RGB_MATRIX_SOLID_MULTISPLASH,
95 void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
97 // This runs after another backlight effect and replaces
99 void rgb_matrix_indicators(void);
100 void rgb_matrix_indicators_kb(void);
101 void rgb_matrix_indicators_user(void);
103 void rgb_matrix_single_LED_test(void);
105 void rgb_matrix_init(void);
106 void rgb_matrix_setup_drivers(void);
108 void rgb_matrix_set_suspend_state(bool state);
109 void rgb_matrix_set_indicator_state(uint8_t state);
112 void rgb_matrix_task(void);
114 // This should not be called from an interrupt
115 // (eg. from a timer interrupt).
116 // Call this while idle (in between matrix scans).
117 // If the buffer is dirty, it will update the driver with the buffer.
118 void rgb_matrix_update_pwm_buffers(void);
120 bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record);
122 void rgb_matrix_increase(void);
123 void rgb_matrix_decrease(void);
125 // void *backlight_get_key_color_eeprom_address(uint8_t led);
126 // void backlight_get_key_color( uint8_t led, HSV *hsv );
127 // void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv );
129 void rgb_matrix_test_led( uint8_t index, bool red, bool green, bool blue );
130 uint32_t rgb_matrix_get_tick(void);
132 void rgblight_toggle(void);
133 void rgblight_step(void);
134 void rgblight_step_reverse(void);
135 void rgblight_increase_hue(void);
136 void rgblight_decrease_hue(void);
137 void rgblight_increase_sat(void);
138 void rgblight_decrease_sat(void);
139 void rgblight_increase_val(void);
140 void rgblight_decrease_val(void);
141 void rgblight_increase_speed(void);
142 void rgblight_decrease_speed(void);
143 void rgblight_mode(uint8_t mode);
144 uint32_t rgblight_get_mode(void);