make astyle

pull/389/head
Jesse Vincent 8 years ago
parent 45cd790729
commit 849c87606f
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -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;

@ -22,7 +22,7 @@
#include <Kaleidoscope-EEPROM-Settings.h> #include <Kaleidoscope-EEPROM-Settings.h>
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
class FingerPainter : public LEDMode { class FingerPainter : public LEDMode {
public: public:
FingerPainter (void); FingerPainter (void);
@ -42,7 +42,7 @@ namespace KaleidoscopePlugins {
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
static cRGB lookupColor (uint8_t row, uint8_t column); static cRGB lookupColor (uint8_t row, uint8_t column);
}; };
}; };
extern KaleidoscopePlugins::FingerPainter FingerPainter; extern KaleidoscopePlugins::FingerPainter FingerPainter;

Loading…
Cancel
Save