Added wireless support; Added Lemokey L3; Added Keychron V1 Max

This commit is contained in:
lokher 2024-01-10 16:22:49 +08:00
parent 9539f135d8
commit 4ae5990fcc
31585 changed files with 99327 additions and 1763186 deletions

View file

@ -45,6 +45,7 @@ extern volatile bool isLeftHand;
static pin_t encoders_pad_a[NUM_ENCODERS_MAX_PER_SIDE] = ENCODERS_PAD_A;
static pin_t encoders_pad_b[NUM_ENCODERS_MAX_PER_SIDE] = ENCODERS_PAD_B;
static bool encoder_interrupt_update[NUM_ENCODERS] = {false};
#ifdef ENCODER_RESOLUTIONS
static uint8_t encoder_resolutions[NUM_ENCODERS] = ENCODER_RESOLUTIONS;
@ -248,15 +249,23 @@ bool encoder_read(void) {
bool changed = false;
for (uint8_t i = 0; i < thisCount; i++) {
uint8_t new_status = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
if ((encoder_state[i] & 0x3) != new_status) {
if ((encoder_state[i] & 0x3) != new_status || encoder_interrupt_update[i]) {
encoder_state[i] <<= 2;
encoder_state[i] |= new_status;
changed |= encoder_update(i, encoder_state[i]);
encoder_interrupt_update[i] = false;
}
}
return changed;
}
void encoder_inerrupt_read(uint8_t index) {
encoder_state[index] <<= 2;
encoder_state[index] |= (readPin(encoders_pad_a[index]) << 0) | (readPin(encoders_pad_b[index]) << 1);
encoder_pulses[index] += encoder_LUT[encoder_state[index] & 0xF];
encoder_interrupt_update[index] = true;
}
#ifdef SPLIT_KEYBOARD
void last_encoder_activity_trigger(void);

View file

@ -27,6 +27,7 @@ bool encoder_read(void);
bool encoder_update_kb(uint8_t index, bool clockwise);
bool encoder_update_user(uint8_t index, bool clockwise);
void encoder_inerrupt_read(uint8_t index);
#ifdef SPLIT_KEYBOARD

View file

@ -58,6 +58,9 @@ const led_point_t k_led_matrix_center = LED_MATRIX_CENTER;
// -----End led effect includes macros-------
// ------------------------------------------
#if defined(LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL) && (LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL >= LED_MATRIX_MAXIMUM_BRIGHTNESS)
# pragma error("LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL must be less than LED_MATRIX_MAXIMUM_BRIGHTNESS")
#endif
// globals
led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
uint32_t g_led_timer;
@ -69,6 +72,9 @@ last_hit_t g_last_hit_tracker;
#endif // LED_MATRIX_KEYREACTIVE_ENABLED
// internals
#ifdef LED_MATRIX_DRIVER_SHUTDOWN_ENABLE
static bool driver_shutdown = false;
#endif
static bool suspend_state = false;
static uint8_t led_last_enable = UINT8_MAX;
static uint8_t led_last_effect = UINT8_MAX;
@ -76,6 +82,7 @@ static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false};
static led_task_states led_task_state = SYNCING;
#if LED_MATRIX_TIMEOUT > 0
static uint32_t led_anykey_timer;
static uint32_t led_matrix_timeout = LED_MATRIX_TIMEOUT;
#endif // LED_MATRIX_TIMEOUT > 0
// double buffers
@ -91,6 +98,8 @@ const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;
EECONFIG_DEBOUNCE_HELPER(led_matrix, EECONFIG_LED_MATRIX, led_matrix_eeconfig);
void led_matrix_increase_val_helper(bool write_to_eeprom);
void eeconfig_update_led_matrix(void) {
eeconfig_flush_led_matrix(true);
}
@ -198,12 +207,22 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) {
#endif // defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP)
}
void led_matrix_none_indicators(void) {
led_matrix_none_indicators_kb();
led_matrix_none_indicators_user();
}
__attribute__((weak)) void led_matrix_none_indicators_kb(void) {}
__attribute__((weak)) void led_matrix_none_indicators_user(void) {}
static bool led_matrix_none(effect_params_t *params) {
if (!params->init) {
return false;
}
led_matrix_set_value_all(0);
led_matrix_none_indicators();
return false;
}
@ -314,10 +333,23 @@ static void led_task_flush(uint8_t effect) {
// update last trackers after the first full render so we can init over several frames
led_last_effect = effect;
led_last_enable = led_matrix_eeconfig.enable;
#ifdef LED_MATRIX_DRIVER_SHUTDOWN_ENABLE
// exit from shutdown to if neccesary
if (driver_shutdown) {
led_matrix_driver_exit_shutdown();
}
#endif
// update pwm buffers
led_matrix_update_pwm_buffers();
#ifdef LED_MATRIX_DRIVER_SHUTDOWN_ENABLE
// shutdown if neccesary
if (effect == LED_MATRIX_NONE && !driver_shutdown && led_matrix_driver_allow_shutdown()) {
led_matrix_driver_shutdown();
}
#endif
// next task
led_task_state = SYNCING;
}
@ -329,8 +361,8 @@ void led_matrix_task(void) {
// while suspended and just do a software shutdown. This is a cheap hack for now.
bool suspend_backlight = suspend_state ||
#if LED_MATRIX_TIMEOUT > 0
(led_anykey_timer > (uint32_t)LED_MATRIX_TIMEOUT) ||
#endif // LED_MATRIX_TIMEOUT > 0
(led_anykey_timer > led_matrix_timeout) ||
#endif // led_matrix_timeout > 0
false;
uint8_t effect = suspend_backlight || !led_matrix_eeconfig.enable ? 0 : led_matrix_eeconfig.mode;
@ -465,6 +497,11 @@ void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
led_task_state = STARTING;
eeconfig_flag_led_matrix(write_to_eeprom);
dprintf("led matrix toggle [%s]: led_matrix_eeconfig.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.enable);
#ifdef LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL
while (led_matrix_eeconfig.enable && led_matrix_eeconfig.val <= LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
led_matrix_increase_val_helper(write_to_eeprom);
}
#endif
}
void led_matrix_toggle_noeeprom(void) {
led_matrix_toggle_eeprom_helper(false);
@ -476,11 +513,21 @@ void led_matrix_toggle(void) {
void led_matrix_enable(void) {
led_matrix_enable_noeeprom();
eeconfig_flag_led_matrix(true);
#ifdef LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL
while (led_matrix_eeconfig.val <= LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
led_matrix_increase_val_helper(true);
}
#endif
}
void led_matrix_enable_noeeprom(void) {
if (!led_matrix_eeconfig.enable) led_task_state = STARTING;
led_matrix_eeconfig.enable = 1;
#ifdef LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL
while (led_matrix_eeconfig.val <= LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
led_matrix_increase_val_helper(false);
}
#endif
}
void led_matrix_disable(void) {
@ -565,6 +612,12 @@ uint8_t led_matrix_get_val(void) {
}
void led_matrix_increase_val_helper(bool write_to_eeprom) {
#ifdef LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL
if (!led_matrix_eeconfig.enable) {
led_matrix_toggle_eeprom_helper(write_to_eeprom);
return;
}
#endif
led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom);
}
void led_matrix_increase_val_noeeprom(void) {
@ -576,6 +629,11 @@ void led_matrix_increase_val(void) {
void led_matrix_decrease_val_helper(bool write_to_eeprom) {
led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom);
#ifdef LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL
if (led_matrix_eeconfig.enable && led_matrix_eeconfig.val <= LED_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
led_matrix_toggle_eeprom_helper(write_to_eeprom);
}
#endif
}
void led_matrix_decrease_val_noeeprom(void) {
led_matrix_decrease_val_helper(false);
@ -637,3 +695,36 @@ void led_matrix_set_flags(led_flags_t flags) {
void led_matrix_set_flags_noeeprom(led_flags_t flags) {
led_matrix_set_flags_eeprom_helper(flags, false);
}
#if LED_MATRIX_TIMEOUT > 0
void led_matrix_disable_timeout_set(uint32_t timeout) {
led_matrix_timeout = timeout;
}
void led_matrix_disable_time_reset(void) {
led_anykey_timer = 0;
}
bool led_matrix_timeouted(void) {
return led_anykey_timer > led_matrix_timeout;
}
#endif
#ifdef LED_MATRIX_DRIVER_SHUTDOWN_ENABLE
void led_matrix_driver_shutdown(void) {
led_matrix_driver.shutdown();
driver_shutdown = true;
};
void led_matrix_driver_exit_shutdown(void) {
led_matrix_driver.exit_shutdown();
driver_shutdown = false;
};
bool led_matrix_is_driver_shutdown(void) {
return driver_shutdown;
}
__attribute__((weak)) bool led_matrix_driver_allow_shutdown(void) {
return true;
};
#endif

View file

@ -48,6 +48,9 @@
#ifdef LED_MATRIX_SNLED27351
# include "snled27351-simple.h"
#endif
#ifdef LED_MATRIX_SNLED27351_SPI
# include "snled27351-simple-spi.h"
#endif
#ifndef LED_MATRIX_TIMEOUT
# define LED_MATRIX_TIMEOUT 0
@ -108,6 +111,8 @@ struct led_matrix_limits_t led_matrix_get_limits(uint8_t iter);
#define LED_MATRIX_TEST_LED_FLAGS() \
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue
#define LED_MATRIX_TIMEOUT_INFINITE (UINT32_MAX)
enum led_matrix_effects {
LED_MATRIX_NONE = 0,
@ -147,6 +152,9 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed);
void led_matrix_task(void);
void led_matrix_none_indicators_kb(void);
void led_matrix_none_indicators_user(void);
// This runs after another backlight effect and replaces
// values already set
void led_matrix_indicators(void);
@ -193,6 +201,21 @@ 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);
#ifdef LED_MATRIX_TIMEOUT
# if LED_MATRIX_TIMEOUT > 0
void led_matrix_disable_timeout_set(uint32_t timeout);
void led_matrix_disable_time_reset(void);
bool led_matrix_timeouted(void);
# endif
#endif
#ifdef LED_MATRIX_DRIVER_SHUTDOWN_ENABLE
void led_matrix_driver_shutdown(void);
void led_matrix_driver_exit_shutdown(void);
bool led_matrix_is_driver_shutdown(void);
bool led_matrix_driver_allow_shutdown(void);
#endif
typedef struct {
/* Perform any initialisation required for the other driver functions to work. */
void (*init)(void);
@ -203,6 +226,12 @@ typedef struct {
void (*set_value_all)(uint8_t value);
/* Flush any buffered changes to the hardware. */
void (*flush)(void);
#ifdef LED_MATRIX_DRIVER_SHUTDOWN_ENABLE
/* Shutdown the driver. */
void (*shutdown)(void);
/* Exit from shutdown state. */
void (*exit_shutdown)(void);
#endif
} led_matrix_driver_t;
static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {

View file

@ -89,4 +89,16 @@ const led_matrix_driver_t led_matrix_driver = {
.set_value_all = snled27351_set_value_all,
};
#elif defined(LED_MATRIX_SNLED27351_SPI)
const led_matrix_driver_t led_matrix_driver = {
.init = snled27351_init_drivers,
.flush = snled27351_flush,
.set_value = snled27351_set_value,
.set_value_all = snled27351_set_value_all,
#ifdef LED_MATRIX_SHUTDOWN_ENABLE
.shutdown = snled27351_shutdown,
.exit_shutdown = snled27351_exit_shutdown,
#endif
};
#endif

View file

@ -60,6 +60,9 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) {
// -----End rgb effect includes macros-------
// ------------------------------------------
#if defined(RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL) && (RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL >= RGB_MATRIX_MAXIMUM_BRIGHTNESS)
# pragma error("RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL must be less than RGB_MATRIX_MAXIMUM_BRIGHTNESS")
#endif
// globals
rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
uint32_t g_rgb_timer;
@ -71,6 +74,9 @@ last_hit_t g_last_hit_tracker;
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
// internals
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
static bool driver_shutdown = false;
#endif
static bool suspend_state = false;
static uint8_t rgb_last_enable = UINT8_MAX;
static uint8_t rgb_last_effect = UINT8_MAX;
@ -78,6 +84,7 @@ static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
static rgb_task_states rgb_task_state = SYNCING;
#if RGB_MATRIX_TIMEOUT > 0
static uint32_t rgb_anykey_timer;
static uint32_t rgb_matrix_timeout = RGB_MATRIX_TIMEOUT;
#endif // RGB_MATRIX_TIMEOUT > 0
// double buffers
@ -93,6 +100,8 @@ const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT;
EECONFIG_DEBOUNCE_HELPER(rgb_matrix, EECONFIG_RGB_MATRIX, rgb_matrix_config);
void rgb_matrix_increase_val_helper(bool write_to_eeprom);
void eeconfig_update_rgb_matrix(void) {
eeconfig_flush_rgb_matrix(true);
}
@ -236,12 +245,22 @@ void rgb_matrix_test(void) {
}
}
void rgb_matrix_none_indicators(void) {
rgb_matrix_none_indicators_kb();
rgb_matrix_none_indicators_user();
}
__attribute__((weak)) void rgb_matrix_none_indicators_kb(void) {}
__attribute__((weak)) void rgb_matrix_none_indicators_user(void) {}
static bool rgb_matrix_none(effect_params_t *params) {
if (!params->init) {
return false;
}
rgb_matrix_set_color_all(0, 0, 0);
rgb_matrix_none_indicators();
return false;
}
@ -355,9 +374,20 @@ static void rgb_task_flush(uint8_t effect) {
// update last trackers after the first full render so we can init over several frames
rgb_last_effect = effect;
rgb_last_enable = rgb_matrix_config.enable;
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
// exit from shutdown to if neccesary
if (driver_shutdown) {
rgb_matrix_driver_exit_shutdown();
}
#endif
// update pwm buffers
rgb_matrix_update_pwm_buffers();
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
// shutdown to if neccesary
if (effect == RGB_MATRIX_NONE && !driver_shutdown && rgb_matrix_driver_allow_shutdown()) {
rgb_matrix_driver_shutdown();
}
#endif
// next task
rgb_task_state = SYNCING;
@ -370,7 +400,7 @@ void rgb_matrix_task(void) {
// while suspended and just do a software shutdown. This is a cheap hack for now.
bool suspend_backlight = suspend_state ||
#if RGB_MATRIX_TIMEOUT > 0
(rgb_anykey_timer > (uint32_t)RGB_MATRIX_TIMEOUT) ||
(rgb_anykey_timer > rgb_matrix_timeout) ||
#endif // RGB_MATRIX_TIMEOUT > 0
false;
@ -460,6 +490,9 @@ __attribute__((weak)) bool rgb_matrix_indicators_advanced_user(uint8_t led_min,
void rgb_matrix_init(void) {
rgb_matrix_driver.init();
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
driver_shutdown = false;
#endif
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
g_last_hit_tracker.count = 0;
@ -506,6 +539,11 @@ void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
rgb_task_state = STARTING;
eeconfig_flag_rgb_matrix(write_to_eeprom);
dprintf("rgb matrix toggle [%s]: rgb_matrix_config.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.enable);
#ifdef RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL
while (rgb_matrix_config.enable && rgb_matrix_config.hsv.v < RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
rgb_matrix_increase_val_helper(write_to_eeprom);
}
#endif
}
void rgb_matrix_toggle_noeeprom(void) {
rgb_matrix_toggle_eeprom_helper(false);
@ -517,11 +555,21 @@ void rgb_matrix_toggle(void) {
void rgb_matrix_enable(void) {
rgb_matrix_enable_noeeprom();
eeconfig_flag_rgb_matrix(true);
#ifdef RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL
while (rgb_matrix_config.hsv.v < RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
rgb_matrix_increase_val_helper(true);
}
#endif
}
void rgb_matrix_enable_noeeprom(void) {
if (!rgb_matrix_config.enable) rgb_task_state = STARTING;
rgb_matrix_config.enable = 1;
#ifdef RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL
while (rgb_matrix_config.hsv.v < RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
rgb_matrix_increase_val_helper(false);
}
#endif
}
void rgb_matrix_disable(void) {
@ -657,6 +705,12 @@ void rgb_matrix_decrease_sat(void) {
}
void rgb_matrix_increase_val_helper(bool write_to_eeprom) {
#ifdef RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL
if (!rgb_matrix_config.enable) {
rgb_matrix_toggle_eeprom_helper(write_to_eeprom);
return;
}
#endif
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom);
}
void rgb_matrix_increase_val_noeeprom(void) {
@ -668,6 +722,11 @@ void rgb_matrix_increase_val(void) {
void rgb_matrix_decrease_val_helper(bool write_to_eeprom) {
rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom);
#ifdef RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL
if (rgb_matrix_config.enable && rgb_matrix_config.hsv.v <= RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL) {
rgb_matrix_toggle_eeprom_helper(write_to_eeprom);
}
#endif
}
void rgb_matrix_decrease_val_noeeprom(void) {
rgb_matrix_decrease_val_helper(false);
@ -729,3 +788,36 @@ void rgb_matrix_set_flags(led_flags_t flags) {
void rgb_matrix_set_flags_noeeprom(led_flags_t flags) {
rgb_matrix_set_flags_eeprom_helper(flags, false);
}
#if RGB_MATRIX_TIMEOUT > 0
void rgb_matrix_disable_timeout_set(uint32_t timeout) {
rgb_matrix_timeout = timeout;
}
void rgb_matrix_disable_time_reset(void) {
rgb_anykey_timer = 0;
}
bool rgb_matrix_timeouted(void) {
return (rgb_anykey_timer > rgb_matrix_timeout);
}
#endif
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
void rgb_matrix_driver_shutdown(void) {
rgb_matrix_driver.shutdown();
driver_shutdown = true;
};
void rgb_matrix_driver_exit_shutdown(void) {
rgb_matrix_driver.exit_shutdown();
driver_shutdown = false;
};
bool rgb_matrix_is_driver_shutdown(void) {
return driver_shutdown;
}
__attribute__((weak)) bool rgb_matrix_driver_allow_shutdown(void) {
return true;
};
#endif

View file

@ -40,6 +40,8 @@
# include "is31flcommon.h"
#elif defined(RGB_MATRIX_SNLED27351)
# include "snled27351.h"
#elif defined(RGB_MATRIX_SNLED27351_SPI)
# include "snled27351-spi.h"
#elif defined(RGB_MATRIX_AW20216S)
# include "aw20216s.h"
#elif defined(RGB_MATRIX_WS2812)
@ -131,6 +133,8 @@ struct rgb_matrix_limits_t rgb_matrix_get_limits(uint8_t iter);
#define RGB_MATRIX_TEST_LED_FLAGS() \
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue
#define RGB_MATRIX_TIMEOUT_INFINITE (UINT32_MAX)
enum rgb_matrix_effects {
RGB_MATRIX_NONE = 0,
@ -169,6 +173,9 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed);
void rgb_matrix_task(void);
void rgb_matrix_none_indicators_kb(void);
void rgb_matrix_none_indicators_user(void);
// This runs after another backlight effect and replaces
// colors already set
void rgb_matrix_indicators(void);
@ -227,6 +234,19 @@ void rgb_matrix_decrease_speed_noeeprom(void);
led_flags_t rgb_matrix_get_flags(void);
void rgb_matrix_set_flags(led_flags_t flags);
void rgb_matrix_set_flags_noeeprom(led_flags_t flags);
#ifdef RGB_MATRIX_TIMEOUT
# if RGB_MATRIX_TIMEOUT > 0
void rgb_matrix_disable_timeout_set(uint32_t timeout);
void rgb_matrix_disable_time_reset(void);
bool rgb_matrix_timeouted(void);
# endif
#endif
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
void rgb_matrix_driver_shutdown(void);
void rgb_matrix_driver_exit_shutdown(void);
bool rgb_matrix_is_driver_shutdown(void);
bool rgb_matrix_driver_allow_shutdown(void);
#endif
#ifndef RGBLIGHT_ENABLE
# define eeconfig_update_rgblight_current eeconfig_update_rgb_matrix
@ -281,6 +301,12 @@ typedef struct {
void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b);
/* Flush any buffered changes to the hardware. */
void (*flush)(void);
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
/* Shutdown the driver. */
void (*shutdown)(void);
/* Exit from shutdown state. */
void (*exit_shutdown)(void);
#endif
} rgb_matrix_driver_t;
static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) {

View file

@ -87,7 +87,17 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
.set_color = snled27351_set_color,
.set_color_all = snled27351_set_color_all,
};
#elif defined(RGB_MATRIX_SNLED27351_SPI)
const rgb_matrix_driver_t rgb_matrix_driver = {
.init = snled27351_init_drivers,
.flush = snled27351_flush,
.set_color = snled27351_set_color,
.set_color_all = snled27351_set_color_all,
# if defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
.shutdown = snled27351_shutdown,
.exit_shutdown = snled27351_exit_shutdown
# endif
};
#elif defined(RGB_MATRIX_AW20216S)
const rgb_matrix_driver_t rgb_matrix_driver = {
.init = aw20216s_init_drivers,