diff options
Diffstat (limited to 'keyboards/matrix')
-rw-r--r-- | keyboards/matrix/abelx/abelx.c | 7 | ||||
-rw-r--r-- | keyboards/matrix/abelx/info.json | 1 | ||||
-rw-r--r-- | keyboards/matrix/abelx/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/matrix/m20add/info.json | 1 | ||||
-rw-r--r-- | keyboards/matrix/m20add/rgb_ring.c | 6 | ||||
-rw-r--r-- | keyboards/matrix/noah/noah.c | 39 |
6 files changed, 32 insertions, 23 deletions
diff --git a/keyboards/matrix/abelx/abelx.c b/keyboards/matrix/abelx/abelx.c index a05934238a..0a3071a402 100644 --- a/keyboards/matrix/abelx/abelx.c +++ b/keyboards/matrix/abelx/abelx.c @@ -57,6 +57,7 @@ void housekeeping_task_kb(void) { #ifdef RGBLIGHT_ENABLE #include "rgblight.h" +#include "ws2812.h" #include "i2c_master.h" const aw9523b_led g_aw9523b_leds[AW9523B_RGB_NUM] = { @@ -66,7 +67,7 @@ const aw9523b_led g_aw9523b_leds[AW9523B_RGB_NUM] = { {AW9523B_P07_PWM, AW9523B_P06_PWM, AW9523B_P05_PWM}, }; -void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) +void setleds_custom(rgb_led_t *start_led, uint16_t num_leds) { uint8_t num = num_leds < AW9523B_RGB_NUM ? num_leds : AW9523B_RGB_NUM; @@ -77,6 +78,10 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) } } +const rgblight_driver_t rgblight_driver = { + .setleds = setleds_custom, +}; + #endif static uint16_t caps_lock_pin = DEF_PIN(TCA6424_PORT2, 3); diff --git a/keyboards/matrix/abelx/info.json b/keyboards/matrix/abelx/info.json index 35bc059810..b9aa23b756 100644 --- a/keyboards/matrix/abelx/info.json +++ b/keyboards/matrix/abelx/info.json @@ -10,6 +10,7 @@ }, "rgblight": { "led_count": 9, + "driver": "custom", "animations": { "breathing": true, "rainbow_mood": true, diff --git a/keyboards/matrix/abelx/rules.mk b/keyboards/matrix/abelx/rules.mk index 1c2fc05ffe..83142dd71c 100644 --- a/keyboards/matrix/abelx/rules.mk +++ b/keyboards/matrix/abelx/rules.mk @@ -46,3 +46,4 @@ CUSTOM_MATRIX = lite # project specific files SRC += matrix.c tca6424.c aw9523b.c I2C_DRIVER_REQUIRED = yes +WS2812_DRIVER_REQUIRED = yes diff --git a/keyboards/matrix/m20add/info.json b/keyboards/matrix/m20add/info.json index 972aab9d0d..6e1a1c493f 100644 --- a/keyboards/matrix/m20add/info.json +++ b/keyboards/matrix/m20add/info.json @@ -10,6 +10,7 @@ }, "rgblight": { "led_count": 20, + "driver": "custom", "animations": { "breathing": true, "rainbow_mood": true, diff --git a/keyboards/matrix/m20add/rgb_ring.c b/keyboards/matrix/m20add/rgb_ring.c index f3fbe83d72..f32875cf4f 100644 --- a/keyboards/matrix/m20add/rgb_ring.c +++ b/keyboards/matrix/m20add/rgb_ring.c @@ -357,7 +357,7 @@ static void custom_effects(void) effect_funcs[rgb_ring.effect](); } -void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) +void setleds_custom(rgb_led_t *start_led, uint16_t num_leds) { if (rgb_ring.state != RING_STATE_QMK) { return; @@ -368,6 +368,10 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) } } +const rgblight_driver_t rgblight_driver = { + .setleds = setleds_custom, +}; + void rgb_ring_init(void) { diff --git a/keyboards/matrix/noah/noah.c b/keyboards/matrix/noah/noah.c index 8246da809c..b5c52f9952 100644 --- a/keyboards/matrix/noah/noah.c +++ b/keyboards/matrix/noah/noah.c @@ -17,53 +17,50 @@ extern rgblight_config_t rgblight_config; // led 0 for caps lock, led 1 for scroll lock, led 3 for num lock // led 4 for layer 1, led 5 for layer 2, led 6 for layer 3, led 7 for layer 4 -#if RGBLED_NUM < 7 -#error "MUST set the RGBLED_NUM bigger than 7" +#if RGBLIGHT_LED_COUNT < 7 +#error "MUST set the RGBLIGHT_LED_COUNT bigger than 7" #endif -rgb_led_t noah_leds[RGBLED_NUM]; +rgb_led_t noah_leds[RGBLIGHT_LED_COUNT]; static bool noah_led_mode = false; -void rgblight_set(void) { +void setleds_custom(rgb_led_t *ledarray, uint16_t num_leds) { memset(&noah_leds[0], 0, sizeof(noah_leds)); if (!rgblight_config.enable) { - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; + for (uint8_t i = 0; i < RGBLIGHT_LED_COUNT; i++) { + ledarray[i].r = 0; + ledarray[i].g = 0; + ledarray[i].b = 0; } } if (noah_led_mode) { led_t led_state = host_keyboard_led_state(); if (led_state.caps_lock) { - noah_leds[0] = led[0]; + noah_leds[0] = ledarray[0]; } if (led_state.scroll_lock) { - noah_leds[1] = led[1]; + noah_leds[1] = ledarray[1]; } if (led_state.num_lock) { - noah_leds[2] = led[2]; + noah_leds[2] = ledarray[2]; } for (int32_t i = 0; i < 4; i++) { if(layer_state_is(i+1)) { - noah_leds[i + 3] = led[i + 3]; + noah_leds[i + 3] = ledarray[i + 3]; } } } else { - memcpy(&noah_leds[0], &led[0], sizeof(noah_leds)); + memcpy(&noah_leds[0], &ledarray[0], sizeof(noah_leds)); } - ws2812_setleds(noah_leds, RGBLED_NUM); + ws2812_setleds(noah_leds, RGBLIGHT_LED_COUNT); } -#endif -void matrix_scan_kb(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_task(); +const rgblight_driver_t rgblight_driver = { + .setleds = setleds_custom, +}; #endif - matrix_scan_user(); -} #ifdef RGB_MATRIX_ENABLE -const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { +const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver * | R location |