Update 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 f14e31fdd6
commit d4ddd5fd73

@ -29,12 +29,7 @@ namespace kaleidoscope {
uint16_t ColormapEffect::map_base_; uint16_t ColormapEffect::map_base_;
uint8_t ColormapEffect::max_layers_; uint8_t ColormapEffect::max_layers_;
ColormapEffect::ColormapEffect(void) { void ColormapEffect::setup(void) {
}
void ColormapEffect::begin(void) {
LEDMode::begin();
Kaleidoscope.use(&::EEPROMSettings, &::LEDPaletteTheme); Kaleidoscope.use(&::EEPROMSettings, &::LEDPaletteTheme);
} }
@ -55,6 +50,15 @@ void ColormapEffect::update(void) {
} }
} }
void ColormapEffect::refreshAt(byte row, byte col) {
for (uint8_t l = 0; l < max_layers_; l++) {
if (!Layer.isOn(l))
continue;
::LEDPaletteTheme.refreshAt(map_base_, l, row, col);
}
}
bool ColormapEffect::focusHook(const char *command) { bool ColormapEffect::focusHook(const char *command) {
return ::LEDPaletteTheme.themeFocusHandler(command, PSTR("colormap.map"), return ::LEDPaletteTheme.themeFocusHandler(command, PSTR("colormap.map"),
map_base_, max_layers_); map_base_, max_layers_);

@ -24,15 +24,17 @@
namespace kaleidoscope { namespace kaleidoscope {
class ColormapEffect : public LEDMode { class ColormapEffect : public LEDMode {
public: public:
ColormapEffect(void); ColormapEffect(void) {}
void begin(void) final;
void update(void) final;
void max_layers(uint8_t max_); void max_layers(uint8_t max_);
static bool focusHook(const char *command); static bool focusHook(const char *command);
protected:
void setup(void) final;
void update(void) final;
void refreshAt(byte row, byte col) final;
private: private:
static uint8_t max_layers_; static uint8_t max_layers_;
static uint16_t map_base_; static uint16_t map_base_;

Loading…
Cancel
Save