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

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

Loading…
Cancel
Save