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 @@
23#include <stdint.h> 23#include <stdint.h>
24#include <stdbool.h> 24#include <stdbool.h>
25#include "led_matrix_types.h" 25#include "led_matrix_types.h"
26#include "led_matrix_drivers.h"
26#include "keyboard.h" 27#include "keyboard.h"
27 28
28#if defined(LED_MATRIX_IS31FL3218)
29# include "is31fl3218-simple.h"
30#elif defined(LED_MATRIX_IS31FL3731)
31# include "is31fl3731-simple.h"
32#endif
33#ifdef LED_MATRIX_IS31FL3733
34# include "is31fl3733-simple.h"
35#endif
36#ifdef LED_MATRIX_IS31FL3736
37# include "is31fl3736-simple.h"
38#endif
39#ifdef LED_MATRIX_IS31FL3737
40# include "is31fl3737-simple.h"
41#endif
42#ifdef LED_MATRIX_IS31FL3741
43# include "is31fl3741-simple.h"
44#endif
45#if defined(IS31FLCOMMON)
46# include "is31flcommon.h"
47#endif
48#ifdef LED_MATRIX_SNLED27351
49# include "snled27351-simple.h"
50#endif
51
52#ifndef LED_MATRIX_TIMEOUT 29#ifndef LED_MATRIX_TIMEOUT
53# define LED_MATRIX_TIMEOUT 0 30# define LED_MATRIX_TIMEOUT 0
54#endif 31#endif
@@ -193,18 +170,6 @@ led_flags_t led_matrix_get_flags(void);
193void led_matrix_set_flags(led_flags_t flags); 170void led_matrix_set_flags(led_flags_t flags);
194void led_matrix_set_flags_noeeprom(led_flags_t flags); 171void led_matrix_set_flags_noeeprom(led_flags_t flags);
195 172
196typedef struct {
197 /* Perform any initialisation required for the other driver functions to work. */
198 void (*init)(void);
199
200 /* Set the brightness of a single LED in the buffer. */
201 void (*set_value)(int index, uint8_t value);
202 /* Set the brightness of all LEDS on the keyboard in the buffer. */
203 void (*set_value_all)(uint8_t value);
204 /* Flush any buffered changes to the hardware. */
205 void (*flush)(void);
206} led_matrix_driver_t;
207
208static inline bool led_matrix_check_finished_leds(uint8_t led_idx) { 173static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {
209#if defined(LED_MATRIX_SPLIT) 174#if defined(LED_MATRIX_SPLIT)
210 if (is_keyboard_left()) { 175 if (is_keyboard_left()) {
@@ -217,8 +182,6 @@ static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {
217#endif 182#endif
218} 183}
219 184
220extern const led_matrix_driver_t led_matrix_driver;
221
222extern led_eeconfig_t led_matrix_eeconfig; 185extern led_eeconfig_t led_matrix_eeconfig;
223 186
224extern uint32_t g_led_timer; 187extern 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 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "led_matrix.h" 18#include "led_matrix_drivers.h"
19 19
20/* Each driver needs to define a struct: 20/* Each driver needs to define a struct:
21 * 21 *
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 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <stdint.h>
7
8#if defined(LED_MATRIX_IS31FL3218)
9# include "is31fl3218-simple.h"
10#elif defined(LED_MATRIX_IS31FL3731)
11# include "is31fl3731-simple.h"
12#elif defined(LED_MATRIX_IS31FL3733)
13# include "is31fl3733-simple.h"
14#elif defined(LED_MATRIX_IS31FL3736)
15# include "is31fl3736-simple.h"
16#elif defined(LED_MATRIX_IS31FL3737)
17# include "is31fl3737-simple.h"
18#elif defined(LED_MATRIX_IS31FL3741)
19# include "is31fl3741-simple.h"
20#elif defined(IS31FLCOMMON)
21# include "is31flcommon.h"
22#elif defined(LED_MATRIX_SNLED27351)
23# include "snled27351-simple.h"
24#endif
25
26typedef struct {
27 /* Perform any initialisation required for the other driver functions to work. */
28 void (*init)(void);
29
30 /* Set the brightness of a single LED in the buffer. */
31 void (*set_value)(int index, uint8_t value);
32 /* Set the brightness of all LEDS on the keyboard in the buffer. */
33 void (*set_value_all)(uint8_t value);
34 /* Flush any buffered changes to the hardware. */
35 void (*flush)(void);
36} led_matrix_driver_t;
37
38extern const led_matrix_driver_t led_matrix_driver;