astyle with current project style guidelines

pull/365/head
Jesse Vincent 7 years ago
parent 356dd681f9
commit ecef342f1f
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -43,14 +43,14 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
};
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (!key_toggled_on (keyState))
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);
LEDControl.set_all_leds_to(0, 0, 0);
LEDControl.led_sync();
delay(100);
uint8_t col = 2;
if (i % 2)
@ -58,47 +58,47 @@ const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
for (uint8_t step = 0; step <= 0xf0; step += 8) {
AlphaSquare.color = { step, step, step };
AlphaSquare.display ({i, 0}, col);
delay (10);
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);
AlphaSquare.display({i, 0}, col);
delay(10);
}
delay (100);
delay(100);
}
LEDControl.set_all_leds_to (0, 0, 0);
LEDControl.led_sync ();
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);
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);
AlphaSquare.display(KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 2);
AlphaSquare.display(KaleidoscopePlugins::AlphaSquareSymbols::Lambda, 10);
delay(10);
}
delay (100);
delay(100);
}
LEDControl.set_all_leds_to (0, 0, 0);
LEDControl.set_all_leds_to(0, 0, 0);
return MACRO_NONE;
}
void setup () {
Kaleidoscope.setup ();
void setup() {
Kaleidoscope.setup();
USE_PLUGINS (&AlphaSquare, &AlphaSquareEffect, &Macros);
USE_PLUGINS(&AlphaSquare, &AlphaSquareEffect, &Macros);
AlphaSquare.color = { 0xcb, 0xc0, 0xff };
}
void loop () {
Kaleidoscope.loop ();
void loop() {
Kaleidoscope.loop();
}

@ -25,31 +25,31 @@ 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);
AlphaSquareEffect::begin(void) {
Kaleidoscope.useEventHandlerHook(eventHandlerHook);
Kaleidoscope.use(&LEDControl, NULL);
us = LEDControl.mode_add(this);
}
void
AlphaSquareEffect::update (void) {
if (endTimeLeft && millis () > endTimeLeft) {
::AlphaSquare.clear (lastKeyLeft);
AlphaSquareEffect::update(void) {
if (endTimeLeft && millis() > endTimeLeft) {
::AlphaSquare.clear(lastKeyLeft);
endTimeLeft = 0;
}
if (endTimeRight && millis () > endTimeRight) {
::AlphaSquare.clear (lastKeyRight, 10);
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)
AlphaSquareEffect::eventHandlerHook(Key key, byte row, byte col, uint8_t keyState) {
if (LEDControl.get_mode() != us)
return key;
if (keyState & INJECTED)
@ -58,7 +58,7 @@ AlphaSquareEffect::eventHandlerHook (Key key, byte row, byte col, uint8_t keySta
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;
@ -66,17 +66,17 @@ AlphaSquareEffect::eventHandlerHook (Key key, byte row, byte col, uint8_t keySta
if (col < COLS / 2) {
lastKeyLeft = key;
endTimeLeft = millis () + length;
endTimeLeft = millis() + length;
} else {
prevKey = lastKeyRight;
lastKeyRight = key;
endTimeRight = millis () + length;
endTimeRight = millis() + length;
displayCol = 10;
}
if (prevKey != key)
::AlphaSquare.clear (prevKey, displayCol);
::AlphaSquare.display (key, displayCol);
::AlphaSquare.clear(prevKey, displayCol);
::AlphaSquare.display(key, displayCol);
return key;
}
};

@ -25,10 +25,10 @@ namespace KaleidoscopePlugins {
namespace LEDEffects {
class AlphaSquareEffect : public LEDMode {
public:
AlphaSquareEffect (void);
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:
@ -36,7 +36,7 @@ class AlphaSquareEffect : public LEDMode {
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);
};
};
};

@ -170,47 +170,47 @@ static const uint16_t alphabet[] PROGMEM = {
cRGB AlphaSquare::color = {0x80, 0x80, 0x80};
AlphaSquare::AlphaSquare (void) {
AlphaSquare::AlphaSquare(void) {
}
void
AlphaSquare::begin (void) {
AlphaSquare::begin(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)
return;
uint8_t index = key.keyCode - Key_A.keyCode;
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
AlphaSquare::display (Key key, uint8_t row, uint8_t col) {
display (key, row, col, color);
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) {
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);
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 ();
LEDControl.led_sync();
}
void
AlphaSquare::display (uint16_t symbol, uint8_t row, uint8_t col) {
display (symbol, row, col, color);
AlphaSquare::display(uint16_t symbol, uint8_t row, uint8_t col) {
display(symbol, row, col, color);
}
};

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

Loading…
Cancel
Save