Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/include/zmk/rgb_underglow.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#pragma once

#include <zephyr/types.h>
#include <zephyr/drivers/led_strip.h>

struct zmk_led_hsb {
uint16_t h;
uint8_t s;
Expand All @@ -27,3 +30,4 @@ int zmk_rgb_underglow_change_sat(int direction);
int zmk_rgb_underglow_change_brt(int direction);
int zmk_rgb_underglow_change_spd(int direction);
int zmk_rgb_underglow_set_hsb(struct zmk_led_hsb color);
__attribute__((weak)) void zmk_rgb_underglow_update_hook(struct led_rgb *pixels, size_t count);
3 changes: 3 additions & 0 deletions app/src/rgb_underglow.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ static struct led_rgb hsb_to_rgb(struct zmk_led_hsb hsb) {
return rgb;
}

void zmk_rgb_underglow_update_hook(struct led_rgb *pixels, size_t count) { /* no op */ }

static void zmk_rgb_underglow_effect_solid(void) {
for (int i = 0; i < STRIP_NUM_PIXELS; i++) {
pixels[i] = hsb_to_rgb(hsb_scale_min_max(state.color));
Expand Down Expand Up @@ -191,6 +193,7 @@ static void zmk_rgb_underglow_tick(struct k_work *work) {
break;
}

zmk_rgb_underglow_update_hook(pixels, STRIP_NUM_PIXELS);
int err = led_strip_update_rgb(led_strip, pixels, STRIP_NUM_PIXELS);
if (err < 0) {
LOG_ERR("Failed to update the RGB strip (%d)", err);
Expand Down
Loading