aboutsummaryrefslogtreecommitdiff
path: root/color-picker.h
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-02-15 14:59:32 +0000
committerdakkar <dakkar@thenautilus.net>2019-02-15 14:59:32 +0000
commit3cc3c8831326cc50619d6f4e99de11c54b7376c9 (patch)
treeb02b51827c50a388b8abebb9d076774ee9da8ac2 /color-picker.h
parentsome cleanup (diff)
downloadkeyboardio-model01-3cc3c8831326cc50619d6f4e99de11c54b7376c9.tar.gz
keyboardio-model01-3cc3c8831326cc50619d6f4e99de11c54b7376c9.tar.bz2
keyboardio-model01-3cc3c8831326cc50619d6f4e99de11c54b7376c9.zip
start of the "color picker" toy
Diffstat (limited to 'color-picker.h')
-rw-r--r--color-picker.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/color-picker.h b/color-picker.h
new file mode 100644
index 0000000..9782ef7
--- /dev/null
+++ b/color-picker.h
@@ -0,0 +1,26 @@
+// -*- mode: c++ -*-
+#pragma once
+
+#include <Kaleidoscope.h>
+
+class ColorPicker : public kaleidoscope::Plugin {
+public:
+ ColorPicker(void) : is_active(false), current_index(0), colors{}, map{} { }
+
+ void toggle(void) { is_active = !is_active; }
+
+ kaleidoscope::EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state) {
+ 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];
+};
+
+ColorPicker theColorPicker;