|
|
@ -21,28 +21,28 @@
|
|
|
|
#include <Kaleidoscope-Focus.h>
|
|
|
|
#include <Kaleidoscope-Focus.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
uint16_t FingerPainter::paletteBase;
|
|
|
|
uint16_t FingerPainter::paletteBase;
|
|
|
|
uint16_t FingerPainter::colorBase;
|
|
|
|
uint16_t FingerPainter::colorBase;
|
|
|
|
bool FingerPainter::editMode;
|
|
|
|
bool FingerPainter::editMode;
|
|
|
|
const cRGB *FingerPainter::defaultPalette;
|
|
|
|
const cRGB *FingerPainter::defaultPalette;
|
|
|
|
|
|
|
|
|
|
|
|
FingerPainter::FingerPainter (void) {
|
|
|
|
FingerPainter::FingerPainter (void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
FingerPainter::begin (void) {
|
|
|
|
FingerPainter::begin (void) {
|
|
|
|
LEDMode::begin ();
|
|
|
|
LEDMode::begin ();
|
|
|
|
event_handler_hook_use (eventHandlerHook);
|
|
|
|
event_handler_hook_use (eventHandlerHook);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
FingerPainter::configure (void) {
|
|
|
|
FingerPainter::configure (void) {
|
|
|
|
paletteBase = ::EEPROMSettings.requestSlice (16 * sizeof (cRGB));
|
|
|
|
paletteBase = ::EEPROMSettings.requestSlice (16 * sizeof (cRGB));
|
|
|
|
colorBase = ::EEPROMSettings.requestSlice (ROWS * COLS);
|
|
|
|
colorBase = ::EEPROMSettings.requestSlice (ROWS * COLS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cRGB
|
|
|
|
cRGB
|
|
|
|
FingerPainter::lookupColor (uint8_t row, uint8_t column) {
|
|
|
|
FingerPainter::lookupColor (uint8_t row, uint8_t column) {
|
|
|
|
uint16_t location = row * COLS + column;
|
|
|
|
uint16_t location = row * COLS + column;
|
|
|
|
uint8_t colorIndex = EEPROM.read (colorBase + location);
|
|
|
|
uint8_t colorIndex = EEPROM.read (colorBase + location);
|
|
|
|
|
|
|
|
|
|
|
@ -53,25 +53,25 @@ namespace KaleidoscopePlugins {
|
|
|
|
EEPROM.get (paletteBase + colorIndex * sizeof (cRGB), color);
|
|
|
|
EEPROM.get (paletteBase + colorIndex * sizeof (cRGB), color);
|
|
|
|
|
|
|
|
|
|
|
|
return color;
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
FingerPainter::update (void) {
|
|
|
|
FingerPainter::update (void) {
|
|
|
|
for (uint8_t r = 0; r < ROWS; r++) {
|
|
|
|
for (uint8_t r = 0; r < ROWS; r++) {
|
|
|
|
for (uint8_t c = 0; c < COLS; c++) {
|
|
|
|
for (uint8_t c = 0; c < COLS; c++) {
|
|
|
|
cRGB color = lookupColor (r, c);
|
|
|
|
cRGB color = lookupColor (r, c);
|
|
|
|
LEDControl.led_set_crgb_at (r, c, color);
|
|
|
|
LEDControl.led_set_crgb_at (r, c, color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
FingerPainter::toggleEdit (void) {
|
|
|
|
FingerPainter::toggleEdit (void) {
|
|
|
|
editMode = !editMode;
|
|
|
|
editMode = !editMode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Key
|
|
|
|
Key
|
|
|
|
FingerPainter::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
FingerPainter::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
if (!editMode)
|
|
|
|
if (!editMode)
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
|
|
|
|
|
|
|
@ -97,10 +97,10 @@ namespace KaleidoscopePlugins {
|
|
|
|
EEPROM.update (colorBase + location, colorIndex);
|
|
|
|
EEPROM.update (colorBase + location, colorIndex);
|
|
|
|
|
|
|
|
|
|
|
|
return Key_NoKey;
|
|
|
|
return Key_NoKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
FingerPainter::focusHook (const char *command) {
|
|
|
|
FingerPainter::focusHook (const char *command) {
|
|
|
|
enum {
|
|
|
|
enum {
|
|
|
|
PALETTE,
|
|
|
|
PALETTE,
|
|
|
|
TOGGLE,
|
|
|
|
TOGGLE,
|
|
|
@ -169,7 +169,7 @@ namespace KaleidoscopePlugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
KaleidoscopePlugins::FingerPainter FingerPainter;
|
|
|
|
KaleidoscopePlugins::FingerPainter FingerPainter;
|
|
|
|