Dropped dot_a_linkage, so that the functions in LEDUtils do not get optimized out. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>pull/365/head
parent
53e36c13e2
commit
2a35a350f1
@ -1,12 +0,0 @@
|
||||
#include "LED-BreatheEffect.h"
|
||||
|
||||
LEDBreatheEffect_::LEDBreatheEffect_ (void) {
|
||||
}
|
||||
|
||||
void
|
||||
LEDBreatheEffect_::update (void) {
|
||||
cRGB color = breath_compute();
|
||||
LEDControl.set_all_leds_to (color);
|
||||
}
|
||||
|
||||
LEDBreatheEffect_ LEDBreatheEffect;
|
@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Keyboardio-LEDControl.h"
|
||||
#include "LEDUtils.h"
|
||||
|
||||
class LEDBreatheEffect_ : LEDMode {
|
||||
public:
|
||||
LEDBreatheEffect_ (void);
|
||||
|
||||
virtual void update (void) final;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
extern LEDBreatheEffect_ LEDBreatheEffect;
|
@ -1,23 +0,0 @@
|
||||
#include "LED-ChaseEffect.h"
|
||||
|
||||
LEDChaseEffect_::LEDChaseEffect_ (void) {
|
||||
}
|
||||
|
||||
void
|
||||
LEDChaseEffect_::update (void) {
|
||||
if (current_chase_counter++ < chase_threshold) {
|
||||
return;
|
||||
}
|
||||
current_chase_counter = 0;
|
||||
LEDControl.led_set_crgb_at(pos - (chase_sign* chase_pixels), {0, 0, 0});
|
||||
LEDControl.led_set_crgb_at(pos, {0, 0, 0});
|
||||
|
||||
pos += chase_sign;
|
||||
if (pos >= LED_COUNT || pos <= 0) {
|
||||
chase_sign = -chase_sign;
|
||||
}
|
||||
LEDControl.led_set_crgb_at(pos, {0, 0, 255});
|
||||
LEDControl.led_set_crgb_at(pos - (chase_sign * chase_pixels), {255, 0, 0});
|
||||
}
|
||||
|
||||
LEDChaseEffect_ LEDChaseEffect;
|
@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Keyboardio-LEDControl.h"
|
||||
#include "LEDUtils.h"
|
||||
|
||||
class LEDChaseEffect_ : LEDMode {
|
||||
public:
|
||||
LEDChaseEffect_ (void);
|
||||
|
||||
virtual void update (void) final;
|
||||
|
||||
private:
|
||||
uint8_t pos = 0;
|
||||
int8_t chase_sign = 1; //negative values when it's going backwar
|
||||
uint8_t chase_pixels = 5;
|
||||
uint8_t current_chase_counter = 0;
|
||||
static const uint8_t chase_threshold = 20;
|
||||
};
|
||||
|
||||
extern LEDChaseEffect_ LEDChaseEffect;
|
@ -1,55 +0,0 @@
|
||||
#include "LED-Numlock.h"
|
||||
#include "LEDUtils.h"
|
||||
#include "layers.h"
|
||||
|
||||
static uint8_t numpadIndex;
|
||||
static uint8_t storedLEDMode;
|
||||
static uint8_t us;
|
||||
|
||||
LEDNumlock::LEDNumlock (uint8_t numpadIdx) {
|
||||
numpadIndex = numpadIdx;
|
||||
}
|
||||
|
||||
void
|
||||
LEDNumlock::begin (void) {
|
||||
us = LEDControl.mode_add (this);
|
||||
loop_hook_add (this->loopHook);
|
||||
}
|
||||
|
||||
void
|
||||
LEDNumlock::setup (void) {
|
||||
if (!Layer.isOn (numpadIndex)) {
|
||||
LEDControl.next_mode ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LEDNumlock::update (void) {
|
||||
for (uint8_t i = 0; i < 44; i++) {
|
||||
LEDControl.led_set_crgb_at(i, {0, 0, 0});
|
||||
}
|
||||
for (uint8_t i = 44; i < LED_COUNT; i++) {
|
||||
LEDControl.led_set_crgb_at(i, {255, 0, 0});
|
||||
}
|
||||
|
||||
cRGB color = breath_compute ();
|
||||
LEDControl.led_set_crgb_at (60, color);
|
||||
}
|
||||
|
||||
void
|
||||
LEDNumlock::loopHook (bool postClear) {
|
||||
if (!postClear)
|
||||
return;
|
||||
|
||||
if (Layer.isOn (numpadIndex)) {
|
||||
if (storedLEDMode != us) {
|
||||
storedLEDMode = LEDControl.get_mode ();
|
||||
}
|
||||
LEDControl.set_mode (us);
|
||||
}
|
||||
|
||||
if (!Layer.isOn (numpadIndex) &&
|
||||
LEDControl.get_mode () == us) {
|
||||
LEDControl.set_mode (storedLEDMode);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Keyboardio-LEDControl.h"
|
||||
#include "LEDUtils.h"
|
||||
|
||||
class LEDNumlock : LEDMode {
|
||||
public:
|
||||
LEDNumlock (uint8_t numpadIndex);
|
||||
|
||||
virtual void begin (void) final;
|
||||
|
||||
virtual void update (void) final;
|
||||
virtual void setup (void) final;
|
||||
|
||||
private:
|
||||
static void loopHook (bool postClear);
|
||||
};
|
@ -1,52 +0,0 @@
|
||||
#include "LED-RainbowEffect.h"
|
||||
|
||||
LEDRainbowEffect_::LEDRainbowEffect_ (void) {
|
||||
}
|
||||
|
||||
void
|
||||
LEDRainbowEffect_::update (void) {
|
||||
if (rainbow_current_ticks++ < rainbow_ticks) {
|
||||
return;
|
||||
} else {
|
||||
rainbow_current_ticks = 0;
|
||||
}
|
||||
|
||||
cRGB rainbow = hsv_to_rgb(rainbow_hue, rainbow_saturation, rainbow_value);
|
||||
|
||||
rainbow_hue += rainbow_steps;
|
||||
if (rainbow_hue >= 255) {
|
||||
rainbow_hue -= 255;
|
||||
}
|
||||
LEDControl.set_all_leds_to(rainbow);
|
||||
}
|
||||
|
||||
LEDRainbowEffect_ LEDRainbowEffect;
|
||||
|
||||
// ---------
|
||||
|
||||
LEDRainbowWaveEffect_::LEDRainbowWaveEffect_ (void) {
|
||||
}
|
||||
|
||||
void
|
||||
LEDRainbowWaveEffect_::update (void) {
|
||||
if (rainbow_current_ticks++ < rainbow_wave_ticks) {
|
||||
return;
|
||||
} else {
|
||||
rainbow_current_ticks = 0;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < LED_COUNT; i++) {
|
||||
uint16_t key_hue = rainbow_hue +16*(i/4);
|
||||
if (key_hue >= 255) {
|
||||
key_hue -= 255;
|
||||
}
|
||||
cRGB rainbow = hsv_to_rgb(key_hue, rainbow_saturation, rainbow_value);
|
||||
LEDControl.led_set_crgb_at (i, rainbow);
|
||||
}
|
||||
rainbow_hue += rainbow_wave_steps;
|
||||
if (rainbow_hue >= 255) {
|
||||
rainbow_hue -= 255;
|
||||
}
|
||||
}
|
||||
|
||||
LEDRainbowWaveEffect_ LEDRainbowWaveEffect;
|
@ -1,43 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Keyboardio-LEDControl.h"
|
||||
#include "LEDUtils.h"
|
||||
|
||||
class LEDRainbowEffect_ : LEDMode {
|
||||
public:
|
||||
LEDRainbowEffect_ (void);
|
||||
|
||||
virtual void update (void) final;
|
||||
|
||||
private:
|
||||
uint16_t rainbow_hue = 0; //stores 0 to 614
|
||||
|
||||
static const uint8_t rainbow_steps = 1; //number of hues we skip in a 360 range per update
|
||||
long rainbow_current_ticks = 0;
|
||||
static const long rainbow_ticks = 10; //delays between update
|
||||
|
||||
static const byte rainbow_saturation = 255;
|
||||
static const byte rainbow_value = 50;
|
||||
|
||||
};
|
||||
|
||||
extern LEDRainbowEffect_ LEDRainbowEffect;
|
||||
|
||||
class LEDRainbowWaveEffect_ : LEDMode {
|
||||
public:
|
||||
LEDRainbowWaveEffect_ (void);
|
||||
|
||||
virtual void update (void) final;
|
||||
|
||||
private:
|
||||
uint16_t rainbow_hue = 0; //stores 0 to 614
|
||||
|
||||
static const uint8_t rainbow_wave_steps = 1; //number of hues we skip in a 360 range per update
|
||||
long rainbow_current_ticks = 0;
|
||||
static const long rainbow_wave_ticks = 10; //delays between update
|
||||
|
||||
static const byte rainbow_saturation = 255;
|
||||
static const byte rainbow_value = 50;
|
||||
};
|
||||
|
||||
extern LEDRainbowWaveEffect_ LEDRainbowWaveEffect;
|
@ -1,13 +0,0 @@
|
||||
#include "LED-SolidColor.h"
|
||||
|
||||
LEDSolidColor::LEDSolidColor (uint8_t r, uint8_t g, uint8_t b) {
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
LEDControl.mode_add (this);
|
||||
}
|
||||
|
||||
void
|
||||
LEDSolidColor::init (void) {
|
||||
LEDControl.set_all_leds_to (r, g, b);
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Keyboardio-LEDControl.h"
|
||||
|
||||
class LEDSolidColor : LEDMode {
|
||||
public:
|
||||
LEDSolidColor (uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
virtual void init (void) final;
|
||||
|
||||
private:
|
||||
uint8_t r, g, b;
|
||||
};
|
Loading…
Reference in new issue