make astyle

pull/365/head
Jesse Vincent 8 years ago
parent 2b33266452
commit 3adb8c28af
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -19,24 +19,24 @@
#include <Kaleidoscope-LED-AlphaSquare.h> #include <Kaleidoscope-LED-AlphaSquare.h>
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
namespace LEDEffects { namespace LEDEffects {
uint16_t AlphaSquareEffect::length = 1000; uint16_t AlphaSquareEffect::length = 1000;
uint32_t AlphaSquareEffect::endTimeLeft, AlphaSquareEffect::endTimeRight; uint32_t AlphaSquareEffect::endTimeLeft, AlphaSquareEffect::endTimeRight;
Key AlphaSquareEffect::lastKeyLeft, AlphaSquareEffect::lastKeyRight; Key AlphaSquareEffect::lastKeyLeft, AlphaSquareEffect::lastKeyRight;
uint8_t AlphaSquareEffect::us; uint8_t AlphaSquareEffect::us;
AlphaSquareEffect::AlphaSquareEffect (void) { AlphaSquareEffect::AlphaSquareEffect (void) {
} }
void void
AlphaSquareEffect::begin (void) { AlphaSquareEffect::begin (void) {
Kaleidoscope.useEventHandlerHook (eventHandlerHook); Kaleidoscope.useEventHandlerHook (eventHandlerHook);
Kaleidoscope.use (&LEDControl, NULL); Kaleidoscope.use (&LEDControl, NULL);
us = LEDControl.mode_add (this); us = LEDControl.mode_add (this);
} }
void void
AlphaSquareEffect::update (void) { AlphaSquareEffect::update (void) {
if (endTimeLeft && millis () > endTimeLeft) { if (endTimeLeft && millis () > endTimeLeft) {
::AlphaSquare.clear (lastKeyLeft); ::AlphaSquare.clear (lastKeyLeft);
endTimeLeft = 0; endTimeLeft = 0;
@ -45,10 +45,10 @@ namespace KaleidoscopePlugins {
::AlphaSquare.clear (lastKeyRight, 10); ::AlphaSquare.clear (lastKeyRight, 10);
endTimeRight = 0; endTimeRight = 0;
} }
} }
Key Key
AlphaSquareEffect::eventHandlerHook (Key key, byte row, byte col, uint8_t keyState) { AlphaSquareEffect::eventHandlerHook (Key key, byte row, byte col, uint8_t keyState) {
if (LEDControl.get_mode () != us) if (LEDControl.get_mode () != us)
return key; return key;
@ -78,8 +78,8 @@ namespace KaleidoscopePlugins {
::AlphaSquare.clear (prevKey, displayCol); ::AlphaSquare.clear (prevKey, displayCol);
::AlphaSquare.display (key, displayCol); ::AlphaSquare.display (key, displayCol);
return key; return key;
} }
}; };
}; };
KaleidoscopePlugins::LEDEffects::AlphaSquareEffect AlphaSquareEffect; KaleidoscopePlugins::LEDEffects::AlphaSquareEffect AlphaSquareEffect;

@ -22,8 +22,8 @@
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
namespace LEDEffects { namespace LEDEffects {
class AlphaSquareEffect : public LEDMode { class AlphaSquareEffect : public LEDMode {
public: public:
AlphaSquareEffect (void); AlphaSquareEffect (void);
@ -37,8 +37,8 @@ namespace KaleidoscopePlugins {
static uint8_t us; static uint8_t us;
static Key eventHandlerHook (Key key, uint8_t row, uint8_t col, uint8_t keyState); static Key eventHandlerHook (Key key, uint8_t row, uint8_t col, uint8_t keyState);
}; };
}; };
}; };
extern KaleidoscopePlugins::LEDEffects::AlphaSquareEffect AlphaSquareEffect; extern KaleidoscopePlugins::LEDEffects::AlphaSquareEffect AlphaSquareEffect;

@ -21,11 +21,11 @@
#include <Kaleidoscope/LED-AlphaSquare.h> #include <Kaleidoscope/LED-AlphaSquare.h>
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
namespace AlphaSquareSymbols { namespace AlphaSquareSymbols {
/* λ */ /* λ */
static constexpr uint16_t Lambda = SYM4x4(1, 0, 0, 0, static constexpr uint16_t Lambda = SYM4x4(1, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0,
1, 0, 0, 1); 1, 0, 0, 1);
}; };
}; };

@ -20,7 +20,7 @@
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
static const uint16_t alphabet[] PROGMEM = { static const uint16_t alphabet[] PROGMEM = {
SYM4x4(1, 1, 1, 1, SYM4x4(1, 1, 1, 1,
1, 0, 0, 1, 1, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1,
@ -166,19 +166,19 @@ namespace KaleidoscopePlugins {
1, 0, 0, 1, 1, 0, 0, 1,
1, 0, 0, 1, 1, 0, 0, 1,
0, 1, 1, 0), // 0 0, 1, 1, 0), // 0
}; };
cRGB AlphaSquare::color = {0x80, 0x80, 0x80}; cRGB AlphaSquare::color = {0x80, 0x80, 0x80};
AlphaSquare::AlphaSquare (void) { AlphaSquare::AlphaSquare (void) {
} }
void void
AlphaSquare::begin (void) { AlphaSquare::begin (void) {
} }
void void
AlphaSquare::display (Key key, uint8_t row, uint8_t col, cRGB keyColor) { AlphaSquare::display (Key key, uint8_t row, uint8_t col, cRGB keyColor) {
if (key < Key_A || key > Key_0) if (key < Key_A || key > Key_0)
return; return;
@ -186,15 +186,15 @@ namespace KaleidoscopePlugins {
uint16_t symbol = pgm_read_word (&alphabet[index]); uint16_t symbol = pgm_read_word (&alphabet[index]);
display (symbol, row, col, keyColor); display (symbol, row, col, keyColor);
} }
void void
AlphaSquare::display (Key key, uint8_t row, uint8_t col) { AlphaSquare::display (Key key, uint8_t row, uint8_t col) {
display (key, row, col, color); display (key, row, col, color);
} }
void void
AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col, cRGB keyColor) { AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col, cRGB keyColor) {
for (uint8_t r = 0; r < 4; r++) { for (uint8_t r = 0; r < 4; r++) {
for (uint8_t c = 0; c < 4; c++) { for (uint8_t c = 0; c < 4; c++) {
uint8_t pixel = bitRead (symbol, r * 4 + c); uint8_t pixel = bitRead (symbol, r * 4 + c);
@ -206,12 +206,12 @@ namespace KaleidoscopePlugins {
} }
LEDControl.led_sync (); LEDControl.led_sync ();
} }
void void
AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col) { AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col) {
display (symbol, row, col, color); display (symbol, row, col, color);
} }
}; };
KaleidoscopePlugins::AlphaSquare AlphaSquare; KaleidoscopePlugins::AlphaSquare AlphaSquare;

@ -35,7 +35,7 @@
) )
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
class AlphaSquare : public KaleidoscopePlugin { class AlphaSquare : public KaleidoscopePlugin {
public: public:
AlphaSquare (void); AlphaSquare (void);
@ -43,24 +43,44 @@ namespace KaleidoscopePlugins {
static void display (Key key, uint8_t row, uint8_t col, cRGB keyColor); static void display (Key key, uint8_t row, uint8_t col, cRGB keyColor);
static void display (Key key, uint8_t row, uint8_t col); static void display (Key key, uint8_t row, uint8_t col);
static void display (Key key) { display (key, 0, 2); }; static void display (Key key) {
static void display (Key key, uint8_t col) { display (key, 0, col); }; display (key, 0, 2);
};
static void display (Key key, uint8_t col) {
display (key, 0, col);
};
static void display (uint16_t symbol, uint8_t row, uint8_t col, cRGB keyColor); static void display (uint16_t symbol, uint8_t row, uint8_t col, cRGB keyColor);
static void display (uint16_t symbol, uint8_t row, uint8_t col); static void display (uint16_t symbol, uint8_t row, uint8_t col);
static void display (uint16_t symbol) { display (symbol, 0, 2); }; static void display (uint16_t symbol) {
static void display (uint16_t symbol, uint8_t col) { display (symbol, 0, col); }; display (symbol, 0, 2);
};
static void display (uint16_t symbol, uint8_t col) {
display (symbol, 0, col);
};
static void clear (Key key, uint8_t row, uint8_t col) { display (key, row, col, {0, 0, 0}); }; static void clear (Key key, uint8_t row, uint8_t col) {
static void clear (Key key, uint8_t col) { clear (key, 0, col); }; display (key, row, col, {0, 0, 0});
static void clear (Key key) { clear (key, 0, 2); }; };
static void clear (Key key, uint8_t col) {
clear (key, 0, col);
};
static void clear (Key key) {
clear (key, 0, 2);
};
static void clear (uint16_t symbol, uint8_t row, uint8_t col) { display (symbol, row, col, {0, 0, 0}); }; static void clear (uint16_t symbol, uint8_t row, uint8_t col) {
static void clear (uint16_t symbol, uint8_t col) { clear (symbol, 0, col); }; display (symbol, row, col, {0, 0, 0});
static void clear (uint16_t symbol) { clear (symbol, 0, 2); }; };
static void clear (uint16_t symbol, uint8_t col) {
clear (symbol, 0, col);
};
static void clear (uint16_t symbol) {
clear (symbol, 0, 2);
};
static cRGB color; static cRGB color;
}; };
}; };
extern KaleidoscopePlugins::AlphaSquare AlphaSquare; extern KaleidoscopePlugins::AlphaSquare AlphaSquare;

Loading…
Cancel
Save