diff options
author | dakkar <dakkar@thenautilus.net> | 2019-02-15 17:02:40 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2019-02-15 17:02:40 +0000 |
commit | 41e7e99cdefb895c5eabbd012fe7182e8de6f165 (patch) | |
tree | 15b6c57e3ad0724b6493ac3e0d255be3e423b031 | |
parent | some docs (diff) | |
download | keyboardio-model01-41e7e99cdefb895c5eabbd012fe7182e8de6f165.tar.gz keyboardio-model01-41e7e99cdefb895c5eabbd012fe7182e8de6f165.tar.bz2 keyboardio-model01-41e7e99cdefb895c5eabbd012fe7182e8de6f165.zip |
color picker dumps via Focus
-rw-r--r-- | color-picker.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/color-picker.h b/color-picker.h index 0e15b23..d442c79 100644 --- a/color-picker.h +++ b/color-picker.h @@ -19,6 +19,7 @@ #include <kaleidoscope/plugin/LEDControl.h> #include <kaleidoscope/plugin/LEDControl/LEDUtils.h> +#include <kaleidoscope/plugin/FocusSerial.h> class ColorPicker : public kaleidoscope::plugin::LEDMode { public: @@ -97,6 +98,30 @@ public: return kaleidoscope::EventHandlerResult::EVENT_CONSUMED; } + kaleidoscope::EventHandlerResult onFocusEvent(const char *command) { + if (Focus.handleHelp(command, PSTR("color-picker.dump"))) + return kaleidoscope::EventHandlerResult::OK; + + if (strncmp_P(command, PSTR("color-picker."), 13) != 0) + return kaleidoscope::EventHandlerResult::OK; + + if (strcmp_P(command + 13, PSTR("dump")) != 0) + return kaleidoscope::EventHandlerResult::OK; + + for (uint8_t i=0;i<16;++i) { + Focus.send(F("color"),i,colors[i],Focus.NEWLINE); + } + Focus.send(F("map\n")); + for (uint8_t r=0;r<ROWS;++r) { + for (uint8_t c=0;c<COLS;++c) { + Focus.send(map[r][c]); + } + Focus.send(Focus.NEWLINE); + } + + return kaleidoscope::EventHandlerResult::EVENT_CONSUMED; + } + protected: void update(void) { for (uint8_t r = 0; r < ROWS; r++) { |