aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgb_matrix.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/rgb_matrix.h')
-rw-r--r--quantum/rgb_matrix.h128
1 files changed, 106 insertions, 22 deletions
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index 576931400..e43532d11 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -1,5 +1,6 @@
1/* Copyright 2017 Jason Williams 1/* Copyright 2017 Jason Williams
2 * Copyright 2017 Jack Humbert 2 * Copyright 2017 Jack Humbert
3 * Copyright 2018 Yiancar
3 * 4 *
4 * This program is free software: you can redistribute it and/or modify 5 * 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 * it under the terms of the GNU General Public License as published by
@@ -21,9 +22,14 @@
21#include <stdint.h> 22#include <stdint.h>
22#include <stdbool.h> 23#include <stdbool.h>
23#include "color.h" 24#include "color.h"
24#include "is31fl3731.h"
25#include "quantum.h" 25#include "quantum.h"
26 26
27#ifdef IS31FL3731
28 #include "is31fl3731.h"
29#elif defined (IS31FL3733)
30 #include "is31fl3733.h"
31#endif
32
27typedef struct Point { 33typedef struct Point {
28 uint8_t x; 34 uint8_t x;
29 uint8_t y; 35 uint8_t y;
@@ -64,28 +70,64 @@ typedef union {
64 70
65enum rgb_matrix_effects { 71enum rgb_matrix_effects {
66 RGB_MATRIX_SOLID_COLOR = 1, 72 RGB_MATRIX_SOLID_COLOR = 1,
73#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
67 RGB_MATRIX_ALPHAS_MODS, 74 RGB_MATRIX_ALPHAS_MODS,
75#endif
76#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
68 RGB_MATRIX_DUAL_BEACON, 77 RGB_MATRIX_DUAL_BEACON,
78#endif
79#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
69 RGB_MATRIX_GRADIENT_UP_DOWN, 80 RGB_MATRIX_GRADIENT_UP_DOWN,
81#endif
82#ifndef DISABLE_RGB_MATRIX_RAINDROPS
70 RGB_MATRIX_RAINDROPS, 83 RGB_MATRIX_RAINDROPS,
84#endif
85#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
71 RGB_MATRIX_CYCLE_ALL, 86 RGB_MATRIX_CYCLE_ALL,
87#endif
88#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
72 RGB_MATRIX_CYCLE_LEFT_RIGHT, 89 RGB_MATRIX_CYCLE_LEFT_RIGHT,
90#endif
91#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
73 RGB_MATRIX_CYCLE_UP_DOWN, 92 RGB_MATRIX_CYCLE_UP_DOWN,
93#endif
94#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
74 RGB_MATRIX_RAINBOW_BEACON, 95 RGB_MATRIX_RAINBOW_BEACON,
96#endif
97#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
75 RGB_MATRIX_RAINBOW_PINWHEELS, 98 RGB_MATRIX_RAINBOW_PINWHEELS,
99#endif
100#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
76 RGB_MATRIX_RAINBOW_MOVING_CHEVRON, 101 RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
102#endif
103#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
77 RGB_MATRIX_JELLYBEAN_RAINDROPS, 104 RGB_MATRIX_JELLYBEAN_RAINDROPS,
105#endif
106#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
107 RGB_MATRIX_DIGITAL_RAIN,
108#endif
78#ifdef RGB_MATRIX_KEYPRESSES 109#ifdef RGB_MATRIX_KEYPRESSES
79 RGB_MATRIX_SOLID_REACTIVE, 110 #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
80 RGB_MATRIX_SPLASH, 111 RGB_MATRIX_SOLID_REACTIVE,
81 RGB_MATRIX_MULTISPLASH, 112 #endif
82 RGB_MATRIX_SOLID_SPLASH, 113 #ifndef DISABLE_RGB_MATRIX_SPLASH
83 RGB_MATRIX_SOLID_MULTISPLASH, 114 RGB_MATRIX_SPLASH,
115 #endif
116 #ifndef DISABLE_RGB_MATRIX_MULTISPLASH
117 RGB_MATRIX_MULTISPLASH,
118 #endif
119 #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
120 RGB_MATRIX_SOLID_SPLASH,
121 #endif
122 #ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
123 RGB_MATRIX_SOLID_MULTISPLASH,
124 #endif
84#endif 125#endif
85 RGB_MATRIX_EFFECT_MAX 126 RGB_MATRIX_EFFECT_MAX
86}; 127};
87 128
88void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ); 129void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
130void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
89 131
90// This runs after another backlight effect and replaces 132// This runs after another backlight effect and replaces
91// colors already set 133// colors already set
@@ -93,8 +135,6 @@ void rgb_matrix_indicators(void);
93void rgb_matrix_indicators_kb(void); 135void rgb_matrix_indicators_kb(void);
94void rgb_matrix_indicators_user(void); 136void rgb_matrix_indicators_user(void);
95 137
96void rgb_matrix_single_LED_test(void);
97
98void rgb_matrix_init(void); 138void rgb_matrix_init(void);
99void rgb_matrix_setup_drivers(void); 139void rgb_matrix_setup_drivers(void);
100 140
@@ -119,21 +159,65 @@ void rgb_matrix_decrease(void);
119// void backlight_get_key_color( uint8_t led, HSV *hsv ); 159// void backlight_get_key_color( uint8_t led, HSV *hsv );
120// void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ); 160// void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv );
121 161
122void rgb_matrix_test_led( uint8_t index, bool red, bool green, bool blue );
123uint32_t rgb_matrix_get_tick(void); 162uint32_t rgb_matrix_get_tick(void);
124 163
125void rgblight_toggle(void); 164void rgb_matrix_toggle(void);
126void rgblight_step(void); 165void rgb_matrix_enable(void);
127void rgblight_step_reverse(void); 166void rgb_matrix_enable_noeeprom(void);
128void rgblight_increase_hue(void); 167void rgb_matrix_disable(void);
129void rgblight_decrease_hue(void); 168void rgb_matrix_disable_noeeprom(void);
130void rgblight_increase_sat(void); 169void rgb_matrix_step(void);
131void rgblight_decrease_sat(void); 170void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
132void rgblight_increase_val(void); 171void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
133void rgblight_decrease_val(void); 172void rgb_matrix_step_reverse(void);
134void rgblight_increase_speed(void); 173void rgb_matrix_increase_hue(void);
135void rgblight_decrease_speed(void); 174void rgb_matrix_decrease_hue(void);
136void rgblight_mode(uint8_t mode); 175void rgb_matrix_increase_sat(void);
137uint32_t rgblight_get_mode(void); 176void rgb_matrix_decrease_sat(void);
177void rgb_matrix_increase_val(void);
178void rgb_matrix_decrease_val(void);
179void rgb_matrix_increase_speed(void);
180void rgb_matrix_decrease_speed(void);
181void rgb_matrix_mode(uint8_t mode);
182void rgb_matrix_mode_noeeprom(uint8_t mode);
183uint8_t rgb_matrix_get_mode(void);
184
185#ifndef RGBLIGHT_ENABLE
186#define rgblight_toggle() rgb_matrix_toggle()
187#define rgblight_enable() rgb_matrix_enable()
188#define rgblight_enable_noeeprom() rgb_matrix_enable_noeeprom()
189#define rgblight_disable() rgb_matrix_disable()
190#define rgblight_disable_noeeprom() rgb_matrix_disable_noeeprom()
191#define rgblight_step() rgb_matrix_step()
192#define rgblight_sethsv(hue, sat, val) rgb_matrix_sethsv(hue, sat, val)
193#define rgblight_sethsv_noeeprom(hue, sat, val) rgb_matrix_sethsv_noeeprom(hue, sat, val)
194#define rgblight_step_reverse() rgb_matrix_step_reverse()
195#define rgblight_increase_hue() rgb_matrix_increase_hue()
196#define rgblight_decrease_hue() rgb_matrix_decrease_hue()
197#define rgblight_increase_sat() rgb_matrix_increase_sat()
198#define rgblight_decrease_sat() rgb_matrix_decrease_sat()
199#define rgblight_increase_val() rgb_matrix_increase_val()
200#define rgblight_decrease_val() rgb_matrix_decrease_val()
201#define rgblight_increase_speed() rgb_matrix_increase_speed()
202#define rgblight_decrease_speed() rgb_matrix_decrease_speed()
203#define rgblight_mode(mode) rgb_matrix_mode(mode)
204#define rgblight_mode_noeeprom(mode) rgb_matrix_mode_noeeprom(mode)
205#define rgblight_get_mode() rgb_matrix_get_mode()
206
207#endif
208
209typedef struct {
210 /* Perform any initialisation required for the other driver functions to work. */
211 void (*init)(void);
212
213 /* Set the colour of a single LED in the buffer. */
214 void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b);
215 /* Set the colour of all LEDS on the keyboard in the buffer. */
216 void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b);
217 /* Flush any buffered changes to the hardware. */
218 void (*flush)(void);
219} rgb_matrix_driver_t;
220
221extern const rgb_matrix_driver_t rgb_matrix_driver;
138 222
139#endif 223#endif