Browse Source

Add shim for setleds, tweak index type

pull/23355/head
fauxpark 1 month ago
parent
commit
d374f54b5b
3 changed files with 11 additions and 3 deletions
  1. +2
    -2
      drivers/led/apa102.c
  2. +1
    -1
      drivers/led/apa102.h
  3. +8
    -0
      quantum/rgblight/rgblight_drivers.c

+ 2
- 2
drivers/led/apa102.c View File

@ -122,14 +122,14 @@ void apa102_init(void) {
gpio_set_pin_output(APA102_CI_PIN);
}
void apa102_set_color(uint8_t index, uint8_t red, uint8_t green, uint8_t blue) {
void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue) {
apa102_leds[index].r = red;
apa102_leds[index].g = green;
apa102_leds[index].b = blue;
}
void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (uint8_t i = 0; i < APA102_LED_COUNT; i++) {
for (uint16_t i = 0; i < APA102_LED_COUNT; i++) {
apa102_set_color(i, red, green, blue);
}
}


+ 1
- 1
drivers/led/apa102.h View File

@ -32,7 +32,7 @@
#define APA102_MAX_BRIGHTNESS 31
void apa102_init(void);
void apa102_set_color(uint8_t index, uint8_t red, uint8_t green, uint8_t blue);
void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue);
void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void apa102_flush(void);


+ 8
- 0
quantum/rgblight/rgblight_drivers.c View File

@ -14,6 +14,14 @@ const rgblight_driver_t rgblight_driver = {
#elif defined(RGBLIGHT_APA102)
# include "apa102.h"
// Temporary shim
static void apa102_setleds(rgb_led_t *ledarray, uint16_t number_of_leds) {
for (uint16_t i = 0; i < number_of_leds; i++) {
apa102_set_color(i, ledarray[i].r, ledarray[i].g, ledarray[i].b);
}
apa102_flush();
}
const rgblight_driver_t rgblight_driver = {
.init = apa102_init,
.setleds = apa102_setleds,


Loading…
Cancel
Save