aboutsummaryrefslogtreecommitdiff
path: root/Model01-Firmware.ino
diff options
context:
space:
mode:
Diffstat (limited to 'Model01-Firmware.ino')
-rw-r--r--Model01-Firmware.ino50
1 files changed, 1 insertions, 49 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino
index b45f626..5045e3e 100644
--- a/Model01-Firmware.ino
+++ b/Model01-Firmware.ino
@@ -145,56 +145,8 @@ typedef enum {
COLOR_COUNT,
} color_index;
-class DakkarColor: public kaleidoscope::plugin::LEDMode {
-public:
- typedef const cRGB (*color_function)();
-
- struct colorSrc {
- enum { VALUE, FUNCTION };
- uint8_t value_or_function;
- union {
- cRGB value;
- color_function function;
- } vf;
- };
-
- typedef const color_index (*color_index_map)[ROWS][COLS];
- typedef const colorSrc *color_src_array;
-
- DakkarColor(
- const color_index_map _map,
- const color_src_array _colors
- ) : map(_map),
- color_sources(_colors) {}
-private:
- const color_index_map map;
- const color_src_array color_sources;
-
- cRGB getColor(uint8_t l, uint8_t r, uint8_t c) {
- color_index index = map[l][r][c];
- colorSrc color_src = color_sources[index];
- if (color_src.value_or_function == colorSrc::VALUE) {
- return color_src.vf.value;
- }
- else {
- return color_src.vf.function();
- }
- }
-protected:
- void update(void) final {
- uint8_t layer = Layer.top();
- for (uint8_t r = 0; r < ROWS; r++) {
- for (uint8_t c = 0; c < COLS; c++) {
- LEDControl.setCrgbAt(r, c, getColor(layer,r,c));
- }
- }
- }
- void refreshAt(byte r, byte c) final {
- LEDControl.setCrgbAt(r, c, getColor(Layer.top(),r,c));
- }
-};
-
#include "keymap-wrapper.h"
+#include "DakkarColor.h"
const cRGB num_breathe() { return breath_compute(170); }