make astyle

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

@ -20,33 +20,33 @@
#include <LEDUtils.h>
namespace KaleidoscopePlugins {
namespace LEDEffects {
uint8_t StalkerEffect::map[ROWS][COLS];
StalkerEffect::ColorComputer *StalkerEffect::colorComputer;
uint16_t StalkerEffect::stepLength = 50;
uint32_t StalkerEffect::stepEndTime;
namespace LEDEffects {
uint8_t StalkerEffect::map[ROWS][COLS];
StalkerEffect::ColorComputer *StalkerEffect::colorComputer;
uint16_t StalkerEffect::stepLength = 50;
uint32_t StalkerEffect::stepEndTime;
StalkerEffect::StalkerEffect (void) {
}
StalkerEffect::StalkerEffect (void) {
}
void
StalkerEffect::configure (ColorComputer *colorComputer_) {
void
StalkerEffect::configure (ColorComputer *colorComputer_) {
colorComputer = colorComputer_;
}
}
void
StalkerEffect::begin (void) {
void
StalkerEffect::begin (void) {
event_handler_hook_use (eventHandlerHook);
LEDMode::begin ();
}
}
void
StalkerEffect::init (void) {
void
StalkerEffect::init (void) {
memset (map, 0, sizeof (map));
}
}
Key
StalkerEffect::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
Key
StalkerEffect::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
if (row >= ROWS || col >= COLS)
return mappedKey;
@ -55,10 +55,10 @@ namespace KaleidoscopePlugins {
}
return mappedKey;
}
}
void
StalkerEffect::update (void) {
void
StalkerEffect::update (void) {
if (!colorComputer)
return;
@ -78,25 +78,27 @@ namespace KaleidoscopePlugins {
}
if (!wasZero && !map[r][c])
LEDControl.led_set_crgb_at (r, c, (cRGB){0, 0, 0});
LEDControl.led_set_crgb_at (r, c, (cRGB) {
0, 0, 0
});
}
}
if (timeOut)
stepEndTime = millis () + stepLength;
}
}
namespace Stalker {
namespace Stalker {
cRGB Haunt::highlightColor;
cRGB Haunt::highlightColor;
// Haunt
Haunt::Haunt (const cRGB highlightColor_) {
// Haunt
Haunt::Haunt (const cRGB highlightColor_) {
highlightColor = highlightColor_;
}
}
cRGB
Haunt::compute (uint8_t *step) {
cRGB
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));
@ -111,20 +113,19 @@ namespace KaleidoscopePlugins {
*step = 0;
return color;
}
}
// BlazingTrail
BlazingTrail::BlazingTrail (...) {
}
// BlazingTrail
BlazingTrail::BlazingTrail (...) {
}
cRGB
BlazingTrail::compute (uint8_t *step) {
cRGB
BlazingTrail::compute (uint8_t *step) {
cRGB color;
if (*step >= 0xff - 30) {
color = hsv_to_rgb (0xff - *step, 255, 255);
}
else {
} else {
color = hsv_to_rgb (30, 255, 255);
color.r = min(*step * color.r / 255, 255);
@ -141,11 +142,11 @@ namespace KaleidoscopePlugins {
*step = 0;
return color;
}
}
};
};
};
};
};
KaleidoscopePlugins::LEDEffects::StalkerEffect StalkerEffect;

@ -22,8 +22,8 @@
#define STALKER(n, ...) (({static KaleidoscopePlugins::LEDEffects::Stalker::n _effect (__VA_ARGS__); &_effect;}))
namespace KaleidoscopePlugins {
namespace LEDEffects {
class StalkerEffect : public LEDMode {
namespace LEDEffects {
class StalkerEffect : public LEDMode {
public:
class ColorComputer {
public:
@ -45,31 +45,33 @@ namespace KaleidoscopePlugins {
static uint8_t map[ROWS][COLS];
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
};
};
namespace Stalker {
namespace Stalker {
class Haunt : public StalkerEffect::ColorComputer {
class Haunt : public StalkerEffect::ColorComputer {
public:
Haunt (const cRGB highlightColor);
Haunt (void) : Haunt ({0x40, 0x80, 0x80}) {};
Haunt (void) : Haunt ( {
0x40, 0x80, 0x80
}) {};
Haunt (void *) : Haunt () {};
virtual cRGB compute (uint8_t *step) final;
private:
static cRGB highlightColor;
};
};
class BlazingTrail : public StalkerEffect::ColorComputer {
class BlazingTrail : public StalkerEffect::ColorComputer {
public:
BlazingTrail (...);
virtual cRGB compute (uint8_t *step) final;
};
};
};
};
};
};
};
extern KaleidoscopePlugins::LEDEffects::StalkerEffect StalkerEffect;

Loading…
Cancel
Save