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

@ -22,83 +22,83 @@
#include <Kaleidoscope-Macros.h>
const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED
(
Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, M(0),
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
[0] = KEYMAP_STACKED
(
Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, M(0),
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_skip,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_skip,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip
),
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip
),
};
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (!key_toggled_on (keyState))
return MACRO_NONE;
if (!key_toggled_on (keyState))
return MACRO_NONE;
if (macroIndex == 0) {
for (uint8_t i = Key_A.keyCode; i <= Key_0.keyCode; i++) {
LEDControl.set_all_leds_to (0, 0, 0);
LEDControl.led_sync ();
delay (100);
if (macroIndex == 0) {
for (uint8_t i = Key_A.keyCode; i <= Key_0.keyCode; i++) {
LEDControl.set_all_leds_to (0, 0, 0);
LEDControl.led_sync ();
delay (100);
uint8_t col = 2;
if (i % 2)
col = 10;
uint8_t col = 2;
if (i % 2)
col = 10;
for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display ({i, 0}, col);
delay (10);
}
for (uint8_t step = 0xff; step >= 8; step -= 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display ({i, 0}, col);
delay (10);
}
delay (100);
}
for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display ({i, 0}, col);
delay (10);
}
for (uint8_t step = 0xff; step >= 8; step -= 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display ({i, 0}, col);
delay (10);
}
delay (100);
}
LEDControl.set_all_leds_to (0, 0, 0);
LEDControl.led_sync ();
delay (100);
for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 2);
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 10);
delay (10);
}
for (uint8_t step = 0xff; step >= 8; step -= 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 2);
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 10);
delay (10);
}
delay (100);
LEDControl.set_all_leds_to (0, 0, 0);
LEDControl.led_sync ();
delay (100);
for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 2);
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 10);
delay (10);
}
for (uint8_t step = 0xff; step >= 8; step -= 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 2);
AlphaSquare.display (KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 10);
delay (10);
}
delay (100);
}
LEDControl.set_all_leds_to (0, 0, 0);
}
LEDControl.set_all_leds_to (0, 0, 0);
return MACRO_NONE;
return MACRO_NONE;
}
void setup () {
Kaleidoscope.setup ();
Kaleidoscope.setup ();
USE_PLUGINS (&AlphaSquare, &AlphaSquareEffect, &Macros);
AlphaSquare.color = { 0xcb, 0xc0, 0xff };
USE_PLUGINS (&AlphaSquare, &AlphaSquareEffect, &Macros);
AlphaSquare.color = { 0xcb, 0xc0, 0xff };
}
void loop () {
Kaleidoscope.loop ();
Kaleidoscope.loop ();
}

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

@ -22,23 +22,23 @@
#include <Kaleidoscope-LEDControl.h>
namespace KaleidoscopePlugins {
namespace LEDEffects {
class AlphaSquareEffect : public LEDMode {
public:
AlphaSquareEffect (void);
namespace LEDEffects {
class AlphaSquareEffect : public LEDMode {
public:
AlphaSquareEffect (void);
virtual void begin (void) final;
virtual void update (void) final;
virtual void begin (void) final;
virtual void update (void) final;
static uint16_t length;
private:
static uint32_t endTimeLeft, endTimeRight;
static Key lastKeyLeft, lastKeyRight;
static uint8_t us;
static uint16_t length;
private:
static uint32_t endTimeLeft, endTimeRight;
static Key lastKeyLeft, lastKeyRight;
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;

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

@ -20,198 +20,198 @@
namespace KaleidoscopePlugins {
static const uint16_t alphabet[] PROGMEM = {
static const uint16_t alphabet[] PROGMEM = {
SYM4x4(1, 1, 1, 1,
1, 0, 0, 1,
1, 1, 1, 1,
1, 0, 0, 1), // A
1, 0, 0, 1,
1, 1, 1, 1,
1, 0, 0, 1), // A
SYM4x4(1, 1, 1, 1,
1, 0, 1, 1,
1, 1, 0, 1,
1, 1, 1, 1), // B
1, 0, 1, 1,
1, 1, 0, 1,
1, 1, 1, 1), // B
SYM4x4(1, 1, 1, 1,
1, 0, 0, 0,
1, 0, 0, 0,
1, 1, 1, 1), // C
1, 0, 0, 0,
1, 0, 0, 0,
1, 1, 1, 1), // C
SYM4x4(1, 1, 1, 0,
1, 0, 0, 1,
1, 0, 0, 1,
1, 1, 1, 0), // D
1, 0, 0, 1,
1, 0, 0, 1,
1, 1, 1, 0), // D
SYM4x4(1, 1, 1, 1,
1, 1, 0, 0,
1, 0, 0, 0,
1, 1, 1, 1), // E
1, 1, 0, 0,
1, 0,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lphaSquare (void) {
}
AlphaSquare::AlphaSquare (void) {
}
void
AlphaSquare::begin (void) {
}
void
AlphaSquare::begin (void) {
}
void
AlphaSquare::display (Key key, uint8_t row, uint8_t col, cRGB keyColor) {
void
AlphaSquare::display (Key key, uint8_t row, uint8_t col, cRGB keyColor) {
if (key < Key_A || key > Key_0)
return;
return;
uint8_t index = key.keyCode - Key_A.keyCode;
uint16_t symbol = pgm_read_word (&alphabet[index]);
display (symbol, row, col, keyColor);
}
}
void
AlphaSquare::display (Key key, uint8_t row, uint8_t col) {
void
AlphaSquare::display (Key key, uint8_t row, uint8_t col) {
display (key, row, col, color);
}
}
void
AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col, cRGB keyColor) {
void
AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col, cRGB keyColor) {
for (uint8_t r = 0; r < 4; r++) {
for (uint8_t c = 0; c < 4; c++) {
uint8_t pixel = bitRead (symbol, r * 4 + c);
if (!pixel)
continue;
for (uint8_t c = 0; c < 4; c++) {
uint8_t pixel = bitRead (symbol, r * 4 + c);
if (!pixel)
continue;
LEDControl.led_set_crgb_at (row + r, col + c, keyColor);
}
LEDControl.led_set_crgb_at (row + r, col + c, keyColor);
}
}
LEDControl.led_sync ();
}
}
void
AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col) {
void
AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col) {
display (symbol, row, col, color);
}
}
};
KaleidoscopePlugins::AlphaSquare AlphaSquare;

@ -35,7 +35,7 @@
)
namespace KaleidoscopePlugins {
class AlphaSquare : public KaleidoscopePlugin {
class AlphaSquare : public KaleidoscopePlugin {
public:
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);
static void display (Key key) { display (key, 0, 2); };
static void display (Key key, uint8_t col) { display (key, 0, col); };
static void display (Key key) {
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);
static void display (uint16_t symbol) { display (symbol, 0, 2); };
static void display (uint16_t symbol, uint8_t col) { display (symbol, 0, col); };
static void display (uint16_t symbol) {
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 col) { clear (key, 0, col); };
static void clear (Key key) { clear (key, 0, 2); };
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 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 col) { clear (symbol, 0, col); };
static void clear (uint16_t symbol) { clear (symbol, 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 col) {
clear (symbol, 0, col);
};
static void clear (uint16_t symbol) {
clear (symbol, 0, 2);
};
static cRGB color;
};
};
};
extern KaleidoscopePlugins::AlphaSquare AlphaSquare;

Loading…
Cancel
Save