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