summaryrefslogtreecommitdiff
path: root/quantum/led_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/led_matrix
parent2d3f2e92d82187d3509f4f9be716bb0b31771eb9 (diff)
LED/RGB Matrix: add header for drivers (#22628)
Diffstat (limited to 'quantum/led_matrix')
-rw-r--r--quantum/led_matrix/led_matrix.h39
-rw-r--r--quantum/led_matrix/led_matrix_drivers.c2
-rw-r--r--quantum/led_matrix/led_matrix_drivers.h38
3 files changed, 40 insertions, 39 deletions
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index c903a230f4..153abf2975 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -23,32 +23,9 @@
#include <stdint.h>
#include <stdbool.h>
#include "led_matrix_types.h"
+#include "led_matrix_drivers.h"
#include "keyboard.h"
-#if defined(LED_MATRIX_IS31FL3218)
-# include "is31fl3218-simple.h"
-#elif defined(LED_MATRIX_IS31FL3731)
-# include "is31fl3731-simple.h"
-#endif
-#ifdef LED_MATRIX_IS31FL3733
-# include "is31fl3733-simple.h"
-#endif
-#ifdef LED_MATRIX_IS31FL3736
-# include "is31fl3736-simple.h"
-#endif
-#ifdef LED_MATRIX_IS31FL3737
-# include "is31fl3737-simple.h"
-#endif
-#ifdef LED_MATRIX_IS31FL3741
-# include "is31fl3741-simple.h"
-#endif
-#if defined(IS31FLCOMMON)
-# include "is31flcommon.h"
-#endif
-#ifdef LED_MATRIX_SNLED27351
-# include "snled27351-simple.h"
-#endif
-
#ifndef LED_MATRIX_TIMEOUT
# define LED_MATRIX_TIMEOUT 0
#endif
@@ -193,18 +170,6 @@ led_flags_t led_matrix_get_flags(void);
void led_matrix_set_flags(led_flags_t flags);
void led_matrix_set_flags_noeeprom(led_flags_t flags);
-typedef struct {
- /* Perform any initialisation required for the other driver functions to work. */
- void (*init)(void);
-
- /* Set the brightness of a single LED in the buffer. */
- void (*set_value)(int index, uint8_t value);
- /* Set the brightness of all LEDS on the keyboard in the buffer. */
- void (*set_value_all)(uint8_t value);
- /* Flush any buffered changes to the hardware. */
- void (*flush)(void);
-} led_matrix_driver_t;
-
static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {
#if defined(LED_MATRIX_SPLIT)
if (is_keyboard_left()) {
@@ -217,8 +182,6 @@ static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {
#endif
}
-extern const led_matrix_driver_t led_matrix_driver;
-
extern led_eeconfig_t led_matrix_eeconfig;
extern uint32_t g_led_timer;
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c
index 117bed9851..672238a260 100644
--- a/quantum/led_matrix/led_matrix_drivers.c
+++ b/quantum/led_matrix/led_matrix_drivers.c
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "led_matrix.h"
+#include "led_matrix_drivers.h"
/* Each driver needs to define a struct:
*
diff --git a/quantum/led_matrix/led_matrix_drivers.h b/quantum/led_matrix/led_matrix_drivers.h
new file mode 100644
index 0000000000..b0ef3dfafc
--- /dev/null
+++ b/quantum/led_matrix/led_matrix_drivers.h
@@ -0,0 +1,38 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+
+#if defined(LED_MATRIX_IS31FL3218)
+# include "is31fl3218-simple.h"
+#elif defined(LED_MATRIX_IS31FL3731)
+# include "is31fl3731-simple.h"
+#elif defined(LED_MATRIX_IS31FL3733)
+# include "is31fl3733-simple.h"
+#elif defined(LED_MATRIX_IS31FL3736)
+# include "is31fl3736-simple.h"
+#elif defined(LED_MATRIX_IS31FL3737)
+# include "is31fl3737-simple.h"
+#elif defined(LED_MATRIX_IS31FL3741)
+# include "is31fl3741-simple.h"
+#elif defined(IS31FLCOMMON)
+# include "is31flcommon.h"
+#elif defined(LED_MATRIX_SNLED27351)
+# include "snled27351-simple.h"
+#endif
+
+typedef struct {
+ /* Perform any initialisation required for the other driver functions to work. */
+ void (*init)(void);
+
+ /* Set the brightness of a single LED in the buffer. */
+ void (*set_value)(int index, uint8_t value);
+ /* Set the brightness of all LEDS on the keyboard in the buffer. */
+ void (*set_value_all)(uint8_t value);
+ /* Flush any buffered changes to the hardware. */
+ void (*flush)(void);
+} led_matrix_driver_t;
+
+extern const led_matrix_driver_t led_matrix_driver;