diff options
| -rw-r--r-- | quantum/led_matrix/led_matrix.h | 39 | ||||
| -rw-r--r-- | quantum/led_matrix/led_matrix_drivers.c | 2 | ||||
| -rw-r--r-- | quantum/led_matrix/led_matrix_drivers.h | 38 | ||||
| -rw-r--r-- | quantum/rgb_matrix/rgb_matrix.h | 36 | ||||
| -rw-r--r-- | quantum/rgb_matrix/rgb_matrix_drivers.c | 6 | ||||
| -rw-r--r-- | quantum/rgb_matrix/rgb_matrix_drivers.h | 41 |
6 files changed, 87 insertions, 75 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); | |||
| 193 | void led_matrix_set_flags(led_flags_t flags); | 170 | void led_matrix_set_flags(led_flags_t flags); |
| 194 | void led_matrix_set_flags_noeeprom(led_flags_t flags); | 171 | void led_matrix_set_flags_noeeprom(led_flags_t flags); |
| 195 | 172 | ||
| 196 | typedef 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 | |||
| 208 | static inline bool led_matrix_check_finished_leds(uint8_t led_idx) { | 173 | static 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 | ||
| 220 | extern const led_matrix_driver_t led_matrix_driver; | ||
| 221 | |||
| 222 | extern led_eeconfig_t led_matrix_eeconfig; | 185 | extern led_eeconfig_t led_matrix_eeconfig; |
| 223 | 186 | ||
| 224 | extern uint32_t g_led_timer; | 187 | 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 @@ | |||
| 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 | |||
| 26 | typedef 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 | |||
| 38 | extern const led_matrix_driver_t led_matrix_driver; | ||
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 @@ | |||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| 23 | #include "rgb_matrix_types.h" | 23 | #include "rgb_matrix_types.h" |
| 24 | #include "rgb_matrix_drivers.h" | ||
| 24 | #include "color.h" | 25 | #include "color.h" |
| 25 | #include "keyboard.h" | 26 | #include "keyboard.h" |
| 26 | 27 | ||
| 27 | #if defined(RGB_MATRIX_IS31FL3218) | ||
| 28 | # include "is31fl3218.h" | ||
| 29 | #elif defined(RGB_MATRIX_IS31FL3731) | ||
| 30 | # include "is31fl3731.h" | ||
| 31 | #elif defined(RGB_MATRIX_IS31FL3733) | ||
| 32 | # include "is31fl3733.h" | ||
| 33 | #elif defined(RGB_MATRIX_IS31FL3736) | ||
| 34 | # include "is31fl3736.h" | ||
| 35 | #elif defined(RGB_MATRIX_IS31FL3737) | ||
| 36 | # include "is31fl3737.h" | ||
| 37 | #elif defined(RGB_MATRIX_IS31FL3741) | ||
| 38 | # include "is31fl3741.h" | ||
| 39 | #elif defined(IS31FLCOMMON) | ||
| 40 | # include "is31flcommon.h" | ||
| 41 | #elif defined(RGB_MATRIX_SNLED27351) | ||
| 42 | # include "snled27351.h" | ||
| 43 | #elif defined(RGB_MATRIX_AW20216S) | ||
| 44 | # include "aw20216s.h" | ||
| 45 | #elif defined(RGB_MATRIX_WS2812) | ||
| 46 | # include "ws2812.h" | ||
| 47 | #endif | ||
| 48 | |||
| 49 | #ifndef RGB_MATRIX_TIMEOUT | 28 | #ifndef RGB_MATRIX_TIMEOUT |
| 50 | # define RGB_MATRIX_TIMEOUT 0 | 29 | # define RGB_MATRIX_TIMEOUT 0 |
| 51 | #endif | 30 | #endif |
| @@ -272,17 +251,6 @@ void rgb_matrix_set_flags_noeeprom(led_flags_t flags); | |||
| 272 | # define rgblight_decrease_speed_noeeprom rgb_matrix_decrease_speed_noeeprom | 251 | # define rgblight_decrease_speed_noeeprom rgb_matrix_decrease_speed_noeeprom |
| 273 | #endif | 252 | #endif |
| 274 | 253 | ||
| 275 | typedef struct { | ||
| 276 | /* Perform any initialisation required for the other driver functions to work. */ | ||
| 277 | void (*init)(void); | ||
| 278 | /* Set the colour of a single LED in the buffer. */ | ||
| 279 | void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b); | ||
| 280 | /* Set the colour of all LEDS on the keyboard in the buffer. */ | ||
| 281 | void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b); | ||
| 282 | /* Flush any buffered changes to the hardware. */ | ||
| 283 | void (*flush)(void); | ||
| 284 | } rgb_matrix_driver_t; | ||
| 285 | |||
| 286 | static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) { | 254 | static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) { |
| 287 | #if defined(RGB_MATRIX_SPLIT) | 255 | #if defined(RGB_MATRIX_SPLIT) |
| 288 | if (is_keyboard_left()) { | 256 | if (is_keyboard_left()) { |
| @@ -295,8 +263,6 @@ static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) { | |||
| 295 | #endif | 263 | #endif |
| 296 | } | 264 | } |
| 297 | 265 | ||
| 298 | extern const rgb_matrix_driver_t rgb_matrix_driver; | ||
| 299 | |||
| 300 | extern rgb_config_t rgb_matrix_config; | 266 | extern rgb_config_t rgb_matrix_config; |
| 301 | 267 | ||
| 302 | extern uint32_t g_rgb_timer; | 268 | 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 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "rgb_matrix.h" | 17 | #include "rgb_matrix_drivers.h" |
| 18 | |||
| 19 | #include <stdbool.h> | ||
| 20 | #include "keyboard.h" | ||
| 21 | #include "color.h" | ||
| 18 | #include "util.h" | 22 | #include "util.h" |
| 19 | 23 | ||
| 20 | /* Each driver needs to define the struct | 24 | /* 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 @@ | |||
| 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(RGB_MATRIX_AW20216S) | ||
| 9 | # include "aw20216s.h" | ||
| 10 | #elif defined(RGB_MATRIX_IS31FL3218) | ||
| 11 | # include "is31fl3218.h" | ||
| 12 | #elif defined(RGB_MATRIX_IS31FL3731) | ||
| 13 | # include "is31fl3731.h" | ||
| 14 | #elif defined(RGB_MATRIX_IS31FL3733) | ||
| 15 | # include "is31fl3733.h" | ||
| 16 | #elif defined(RGB_MATRIX_IS31FL3736) | ||
| 17 | # include "is31fl3736.h" | ||
| 18 | #elif defined(RGB_MATRIX_IS31FL3737) | ||
| 19 | # include "is31fl3737.h" | ||
| 20 | #elif defined(RGB_MATRIX_IS31FL3741) | ||
| 21 | # include "is31fl3741.h" | ||
| 22 | #elif defined(IS31FLCOMMON) | ||
| 23 | # include "is31flcommon.h" | ||
| 24 | #elif defined(RGB_MATRIX_SNLED27351) | ||
| 25 | # include "snled27351.h" | ||
| 26 | #elif defined(RGB_MATRIX_WS2812) | ||
| 27 | # include "ws2812.h" | ||
| 28 | #endif | ||
| 29 | |||
| 30 | typedef struct { | ||
| 31 | /* Perform any initialisation required for the other driver functions to work. */ | ||
| 32 | void (*init)(void); | ||
| 33 | /* Set the colour of a single LED in the buffer. */ | ||
| 34 | void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b); | ||
| 35 | /* Set the colour of all LEDS on the keyboard in the buffer. */ | ||
| 36 | void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b); | ||
| 37 | /* Flush any buffered changes to the hardware. */ | ||
| 38 | void (*flush)(void); | ||
| 39 | } rgb_matrix_driver_t; | ||
| 40 | |||
| 41 | extern const rgb_matrix_driver_t rgb_matrix_driver; | ||
