astyle with current project style guidelines

pull/365/head
Jesse Vincent 8 years ago
parent 46d40dd3d5
commit b75b3ac960
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -42,15 +42,15 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
),
};
void setup () {
Kaleidoscope.setup ();
void setup() {
Kaleidoscope.setup();
StalkerEffect.configure (STALKER (BlazingTrail, NULL));
USE_PLUGINS (&LEDOff, &StalkerEffect);
StalkerEffect.configure(STALKER(BlazingTrail, NULL));
USE_PLUGINS(&LEDOff, &StalkerEffect);
StalkerEffect.activate ();
StalkerEffect.activate();
}
void loop () {
Kaleidoscope.loop ();
void loop() {
Kaleidoscope.loop();
}

@ -26,31 +26,31 @@ StalkerEffect::ColorComputer *StalkerEffect::colorComputer;
uint16_t StalkerEffect::stepLength = 50;
uint32_t StalkerEffect::stepEndTime;
StalkerEffect::StalkerEffect (void) {
StalkerEffect::StalkerEffect(void) {
}
void
StalkerEffect::configure (ColorComputer *colorComputer_) {
StalkerEffect::configure(ColorComputer *colorComputer_) {
colorComputer = colorComputer_;
}
void
StalkerEffect::begin (void) {
event_handler_hook_use (eventHandlerHook);
LEDMode::begin ();
StalkerEffect::begin(void) {
event_handler_hook_use(eventHandlerHook);
LEDMode::begin();
}
void
StalkerEffect::init (void) {
memset (map, 0, sizeof (map));
StalkerEffect::init(void) {
memset(map, 0, sizeof(map));
}
Key
StalkerEffect::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
StalkerEffect::eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyState) {
if (row >= ROWS || col >= COLS)
return mappedKey;
if (key_is_pressed (keyState)) {
if (key_is_pressed(keyState)) {
map[row][col] = 0xff;
}
@ -58,17 +58,17 @@ StalkerEffect::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyS
}
void
StalkerEffect::update (void) {
StalkerEffect::update(void) {
if (!colorComputer)
return;
bool timeOut = millis () >= stepEndTime;
bool timeOut = millis() >= stepEndTime;
for (byte r = 0; r < ROWS; r++) {
for (byte c = 0; c < COLS; c++) {
uint8_t step = map[r][c];
if (step) {
LEDControl.led_set_crgb_at (r, c, colorComputer->compute (&step));
LEDControl.led_set_crgb_at(r, c, colorComputer->compute(&step));
}
bool wasZero = (map[r][c] == 0);
@ -78,14 +78,14 @@ StalkerEffect::update (void) {
}
if (!wasZero && !map[r][c])
LEDControl.led_set_crgb_at (r, c, (cRGB) {
LEDControl.led_set_crgb_at(r, c, (cRGB) {
0, 0, 0
});
}
}
if (timeOut)
stepEndTime = millis () + stepLength;
stepEndTime = millis() + stepLength;
}
namespace Stalker {
@ -93,12 +93,12 @@ namespace Stalker {
cRGB Haunt::highlightColor;
// Haunt
Haunt::Haunt (const cRGB highlightColor_) {
Haunt::Haunt(const cRGB highlightColor_) {
highlightColor = highlightColor_;
}
cRGB
Haunt::compute (uint8_t *step) {
Haunt::compute(uint8_t *step) {
cRGB color = CRGB((uint8_t)min(*step * highlightColor.r / 255, 255),
(uint8_t)min(*step * highlightColor.g / 255, 255),
(uint8_t)min(*step * highlightColor.b / 255, 255));
@ -116,17 +116,17 @@ Haunt::compute (uint8_t *step) {
}
// BlazingTrail
BlazingTrail::BlazingTrail (...) {
BlazingTrail::BlazingTrail(...) {
}
cRGB
BlazingTrail::compute (uint8_t *step) {
BlazingTrail::compute(uint8_t *step) {
cRGB color;
if (*step >= 0xff - 30) {
color = hsv_to_rgb (0xff - *step, 255, 255);
color = hsv_to_rgb(0xff - *step, 255, 255);
} else {
color = hsv_to_rgb (30, 255, 255);
color = hsv_to_rgb(30, 255, 255);
color.r = min(*step * color.r / 255, 255);
color.g = min(*step * color.g / 255, 255);

@ -27,16 +27,16 @@ class StalkerEffect : public LEDMode {
public:
class ColorComputer {
public:
virtual cRGB compute (uint8_t *step) = 0;
virtual cRGB compute(uint8_t *step) = 0;
};
StalkerEffect (void);
StalkerEffect(void);
virtual void begin (void) final;
virtual void init (void) final;
virtual void update (void) final;
virtual void begin(void) final;
virtual void init(void) final;
virtual void update(void) final;
static void configure (ColorComputer *colorComputer);
static void configure(ColorComputer *colorComputer);
static uint16_t stepLength;
private:
@ -44,29 +44,29 @@ class StalkerEffect : public LEDMode {
static ColorComputer *colorComputer;
static uint8_t map[ROWS][COLS];
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
static Key eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyState);
};
namespace Stalker {
class Haunt : public StalkerEffect::ColorComputer {
public:
Haunt (const cRGB highlightColor);
Haunt (void) : Haunt ( {
Haunt(const cRGB highlightColor);
Haunt(void) : Haunt( {
0x40, 0x80, 0x80
}) {};
Haunt (void *) : Haunt () {};
Haunt(void *) : Haunt() {};
virtual cRGB compute (uint8_t *step) final;
virtual cRGB compute(uint8_t *step) final;
private:
static cRGB highlightColor;
};
class BlazingTrail : public StalkerEffect::ColorComputer {
public:
BlazingTrail (...);
BlazingTrail(...);
virtual cRGB compute (uint8_t *step) final;
virtual cRGB compute(uint8_t *step) final;
};
};

Loading…
Cancel
Save