aboutsummaryrefslogtreecommitdiff
path: root/color-picker.h
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-02-15 15:13:07 +0000
committerdakkar <dakkar@thenautilus.net>2019-02-15 15:13:07 +0000
commit332b5ceec3963a5ecbf123865698d824d1eedc43 (patch)
treec9bc6b31291079e1654ee78d70c9b4f4d9552317 /color-picker.h
parentstart of the "color picker" toy (diff)
downloadkeyboardio-model01-332b5ceec3963a5ecbf123865698d824d1eedc43.tar.gz
keyboardio-model01-332b5ceec3963a5ecbf123865698d824d1eedc43.tar.bz2
keyboardio-model01-332b5ceec3963a5ecbf123865698d824d1eedc43.zip
probably simpler: use LEDMode
Diffstat (limited to 'color-picker.h')
-rw-r--r--color-picker.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/color-picker.h b/color-picker.h
index 9782ef7..9aa9f1f 100644
--- a/color-picker.h
+++ b/color-picker.h
@@ -1,26 +1,27 @@
// -*- mode: c++ -*-
#pragma once
-#include <Kaleidoscope.h>
+#include <Kaleidoscope-LEDControl.h>
-class ColorPicker : public kaleidoscope::Plugin {
+class ColorPicker : public kaleidoscope::plugin::LEDMode {
public:
- ColorPicker(void) : is_active(false), current_index(0), colors{}, map{} { }
-
- void toggle(void) { is_active = !is_active; }
+ ColorPicker(void) : current_index(0), colors{}, map{} { }
kaleidoscope::EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state) {
- if (!Kaleidoscope.has_leds || !is_active)
+ if (!Kaleidoscope.has_leds || !is_active())
return kaleidoscope::EventHandlerResult::OK;
return kaleidoscope::EventHandlerResult::EVENT_CONSUMED;
}
private:
- bool is_active;
uint8_t current_index;
cRGB colors[16];
uint8_t map[ROWS][COLS];
+
+ bool is_active() {
+ return LEDControl.get_mode() == this;
+ }
};
ColorPicker theColorPicker;