Merge pull request #1 from keyboardio/f/led-api-update

Updated to use the new LEDMode/LEDControl API
pull/365/head
Gergely Nagy 7 years ago committed by GitHub
commit dafb257e42

@ -1,22 +1,21 @@
#include "Kaleidoscope-LEDEffect-Chase.h"
LEDChaseEffect_::LEDChaseEffect_(void) {
}
void LEDChaseEffect_::update(void) {
namespace kaleidoscope {
void LEDChaseEffect::update(void) {
if (current_chase_counter++ < chase_threshold) {
return;
}
current_chase_counter = 0;
LEDControl.setCrgbAt(pos - (chase_sign * chase_pixels), {0, 0, 0});
LEDControl.setCrgbAt(pos, {0, 0, 0});
::LEDControl.setCrgbAt(pos - (chase_sign * chase_pixels), {0, 0, 0});
::LEDControl.setCrgbAt(pos, {0, 0, 0});
pos += chase_sign;
if (pos >= LED_COUNT || pos <= 0) {
chase_sign = -chase_sign;
}
LEDControl.setCrgbAt(pos, {0, 0, 255});
LEDControl.setCrgbAt(pos - (chase_sign * chase_pixels), {255, 0, 0});
::LEDControl.setCrgbAt(pos, {0, 0, 255});
::LEDControl.setCrgbAt(pos - (chase_sign * chase_pixels), {255, 0, 0});
}
}
LEDChaseEffect_ LEDChaseEffect;
kaleidoscope::LEDChaseEffect LEDChaseEffect;

@ -3,10 +3,12 @@
#include "Kaleidoscope-LEDControl.h"
#include "LEDUtils.h"
class LEDChaseEffect_ : public LEDMode {
namespace kaleidoscope {
class LEDChaseEffect : public LEDMode {
public:
LEDChaseEffect_(void);
LEDChaseEffect(void) {}
protected:
void update(void) final;
private:
@ -16,5 +18,6 @@ class LEDChaseEffect_ : public LEDMode {
uint8_t current_chase_counter = 0;
static const uint8_t chase_threshold = 20;
};
}
extern LEDChaseEffect_ LEDChaseEffect;
extern kaleidoscope::LEDChaseEffect LEDChaseEffect;

Loading…
Cancel
Save