Merge pull request #7 from keyboardio/f/led-api-update

Update to use the new LEDMode/LEDControl API
pull/389/head
Gergely Nagy 7 years ago committed by GitHub
commit 1672a1c033

@ -28,14 +28,9 @@ namespace kaleidoscope {
uint16_t FingerPainter::color_base_; uint16_t FingerPainter::color_base_;
bool FingerPainter::edit_mode_; bool FingerPainter::edit_mode_;
FingerPainter::FingerPainter(void) { void FingerPainter::setup(void) {
} Kaleidoscope.use(&::LEDPaletteTheme);
Kaleidoscope.useEventHandlerHook(eventHandlerHook);
void FingerPainter::begin(void) {
USE_PLUGINS(&::LEDPaletteTheme);
LEDMode::begin();
event_handler_hook_use(eventHandlerHook);
color_base_ = ::LEDPaletteTheme.reserveThemes(1); color_base_ = ::LEDPaletteTheme.reserveThemes(1);
} }
@ -44,6 +39,10 @@ void FingerPainter::update(void) {
::LEDPaletteTheme.updateHandler(color_base_, 0); ::LEDPaletteTheme.updateHandler(color_base_, 0);
} }
void FingerPainter::refreshAt(byte row, byte col) {
::LEDPaletteTheme.refreshAt(color_base_, 0, row, col);
}
void FingerPainter::toggle(void) { void FingerPainter::toggle(void) {
edit_mode_ = !edit_mode_; edit_mode_ = !edit_mode_;
} }

@ -23,14 +23,16 @@
namespace kaleidoscope { namespace kaleidoscope {
class FingerPainter : public LEDMode { class FingerPainter : public LEDMode {
public: public:
FingerPainter(void); FingerPainter(void) {}
void begin(void) final;
void update(void) final;
static void toggle(void); static void toggle(void);
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 uint16_t color_base_; static uint16_t color_base_;
static bool edit_mode_; static bool edit_mode_;

Loading…
Cancel
Save