Updated to use the new LEDMode/LEDControl API

Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
pull/389/head
Gergely Nagy 7 years ago
parent 1c8f7faa4d
commit 7c67b22dff

@ -30,7 +30,7 @@ LEDPaletteTheme::LEDPaletteTheme(void) {
}
void LEDPaletteTheme::begin(void) {
USE_PLUGINS(&::EEPROMSettings);
Kaleidoscope.use(&::EEPROMSettings);
if (!palette_base_)
palette_base_ = ::EEPROMSettings.requestSlice(16 * sizeof(cRGB));
@ -49,10 +49,23 @@ void LEDPaletteTheme::updateHandler(uint16_t theme_base, uint8_t theme) {
if (!lookupColorAtPosition(map_base, pos, &color))
continue;
LEDControl.setCrgbAt(pos, color);
::LEDControl.setCrgbAt(pos, color);
}
}
void LEDPaletteTheme::refreshAt(uint16_t theme_base, uint8_t theme, byte row, byte col) {
uint16_t map_base = theme_base + (theme * ROWS * COLS / 2);
uint16_t pos = KeyboardHardware.getLedIndex(row, col);
cRGB color;
if (!lookupColorAtPosition(map_base, pos, &color))
return;
::LEDControl.setCrgbAt(pos, color);
}
const uint8_t LEDPaletteTheme::lookupColorIndexAtPosition(uint16_t map_base, uint16_t position) {
uint8_t color_index;

@ -31,6 +31,7 @@ class LEDPaletteTheme : public KaleidoscopePlugin {
static uint16_t reserveThemes(uint8_t max_themes);
static void updateHandler(uint16_t theme_base, uint8_t theme);
static void refreshAt(uint16_t theme_base, uint8_t theme, byte row, byte col);
static const uint8_t lookupColorIndexAtPosition(uint16_t theme_base, uint16_t position);
static const bool lookupColorAtPosition(uint16_t theme_base, uint16_t position, cRGB *color);

Loading…
Cancel
Save