1
0
Fork 0

Rework RGBLight driver system (#22529)

This commit is contained in:
Ryan 2023-12-05 22:49:14 +11:00 committed by GitHub
parent 2acb426b8e
commit 17f36a21bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 125 additions and 87 deletions

View file

@ -14,10 +14,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dp60.h"
#include "rgblight.h"
#include QMK_KEYBOARD_H
#include "ws2812.h"
// caps led
const rgblight_segment_t PROGMEM dp60_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
@ -72,13 +70,17 @@ extern rgblight_config_t rgblight_config;
extern void rgblight_layers_write(void);
extern void indicator_write(rgb_led_t *start_led, uint8_t num_leds);
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)
{
ws2812_setleds(start_led, RGBLED_NUM-RGB_INDICATOR_NUM);
indicator_write(start_led + (RGBLED_NUM - RGB_INDICATOR_NUM), RGB_INDICATOR_NUM);
}
const rgblight_driver_t rgblight_driver = {
.setleds = setleds_custom,
};
void led_update_ports(led_t led_state) {
rgblight_set_layer_state(0, led_state.caps_lock);
rgblight_set_layer_state(1, led_state.scroll_lock);

View file

@ -1,4 +1,6 @@
RGBLIGHT_ENABLE = yes # Use RGB underglow light
RGBLIGHT_DRIVER = custom
WS2812_DRIVER_REQUIRED = yes
SRC += indicator.c led_driver.c