summaryrefslogtreecommitdiff
path: root/quantum/rgb_matrix
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-12-08 16:54:47 +1100
committerGitHub <noreply@github.com>2023-12-08 16:54:47 +1100
commit24511d31b6fbf92d182d84d97193f65cbbdfeaa4 (patch)
treec6f4de1b6836a711377d1e04cfc623f9133193b4 /quantum/rgb_matrix
parent2d3f2e92d82187d3509f4f9be716bb0b31771eb9 (diff)
LED/RGB Matrix: add header for drivers (#22628)
Diffstat (limited to 'quantum/rgb_matrix')
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h36
-rw-r--r--quantum/rgb_matrix/rgb_matrix_drivers.c6
-rw-r--r--quantum/rgb_matrix/rgb_matrix_drivers.h41
3 files changed, 47 insertions, 36 deletions
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 9a3ffb8ea3..b1bf839bf6 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -21,31 +21,10 @@
#include <stdint.h>
#include <stdbool.h>
#include "rgb_matrix_types.h"
+#include "rgb_matrix_drivers.h"
#include "color.h"
#include "keyboard.h"
-#if defined(RGB_MATRIX_IS31FL3218)
-# include "is31fl3218.h"
-#elif defined(RGB_MATRIX_IS31FL3731)
-# include "is31fl3731.h"
-#elif defined(RGB_MATRIX_IS31FL3733)
-# include "is31fl3733.h"
-#elif defined(RGB_MATRIX_IS31FL3736)
-# include "is31fl3736.h"
-#elif defined(RGB_MATRIX_IS31FL3737)
-# include "is31fl3737.h"
-#elif defined(RGB_MATRIX_IS31FL3741)
-# include "is31fl3741.h"
-#elif defined(IS31FLCOMMON)
-# include "is31flcommon.h"
-#elif defined(RGB_MATRIX_SNLED27351)
-# include "snled27351.h"
-#elif defined(RGB_MATRIX_AW20216S)
-# include "aw20216s.h"
-#elif defined(RGB_MATRIX_WS2812)
-# include "ws2812.h"
-#endif
-
#ifndef RGB_MATRIX_TIMEOUT
# define RGB_MATRIX_TIMEOUT 0
#endif
@@ -272,17 +251,6 @@ void rgb_matrix_set_flags_noeeprom(led_flags_t flags);
# define rgblight_decrease_speed_noeeprom rgb_matrix_decrease_speed_noeeprom
#endif
-typedef struct {
- /* Perform any initialisation required for the other driver functions to work. */
- void (*init)(void);
- /* Set the colour of a single LED in the buffer. */
- void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b);
- /* Set the colour of all LEDS on the keyboard in the buffer. */
- void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b);
- /* Flush any buffered changes to the hardware. */
- void (*flush)(void);
-} rgb_matrix_driver_t;
-
static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) {
#if defined(RGB_MATRIX_SPLIT)
if (is_keyboard_left()) {
@@ -295,8 +263,6 @@ static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) {
#endif
}
-extern const rgb_matrix_driver_t rgb_matrix_driver;
-
extern rgb_config_t rgb_matrix_config;
extern uint32_t g_rgb_timer;
diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c
index 0f979cb233..e7bed0bf72 100644
--- a/quantum/rgb_matrix/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.c
@@ -14,7 +14,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "rgb_matrix.h"
+#include "rgb_matrix_drivers.h"
+
+#include <stdbool.h>
+#include "keyboard.h"
+#include "color.h"
#include "util.h"
/* Each driver needs to define the struct
diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.h b/quantum/rgb_matrix/rgb_matrix_drivers.h
new file mode 100644
index 0000000000..991344f087
--- /dev/null
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.h
@@ -0,0 +1,41 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+
+#if defined(RGB_MATRIX_AW20216S)
+# include "aw20216s.h"
+#elif defined(RGB_MATRIX_IS31FL3218)
+# include "is31fl3218.h"
+#elif defined(RGB_MATRIX_IS31FL3731)
+# include "is31fl3731.h"
+#elif defined(RGB_MATRIX_IS31FL3733)
+# include "is31fl3733.h"
+#elif defined(RGB_MATRIX_IS31FL3736)
+# include "is31fl3736.h"
+#elif defined(RGB_MATRIX_IS31FL3737)
+# include "is31fl3737.h"
+#elif defined(RGB_MATRIX_IS31FL3741)
+# include "is31fl3741.h"
+#elif defined(IS31FLCOMMON)
+# include "is31flcommon.h"
+#elif defined(RGB_MATRIX_SNLED27351)
+# include "snled27351.h"
+#elif defined(RGB_MATRIX_WS2812)
+# include "ws2812.h"
+#endif
+
+typedef struct {
+ /* Perform any initialisation required for the other driver functions to work. */
+ void (*init)(void);
+ /* Set the colour of a single LED in the buffer. */
+ void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b);
+ /* Set the colour of all LEDS on the keyboard in the buffer. */
+ void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b);
+ /* Flush any buffered changes to the hardware. */
+ void (*flush)(void);
+} rgb_matrix_driver_t;
+
+extern const rgb_matrix_driver_t rgb_matrix_driver;