reformat in uvostyle
This commit is contained in:
76
rgbled.h
76
rgbled.h
@ -4,54 +4,54 @@
|
||||
class RgbLed
|
||||
{
|
||||
private:
|
||||
Pwm8b* _pwmA;
|
||||
Pwm8b* _pwmB;
|
||||
|
||||
Pwm8b* _pwmA;
|
||||
Pwm8b* _pwmB;
|
||||
|
||||
static constexpr uint16_t calRed[] = {1000, 1000, 1000};
|
||||
static constexpr uint16_t calGreen[] = {1000, 1000, 1000};
|
||||
static constexpr uint16_t calBlue[] = {400, 500, 500};
|
||||
|
||||
uint8_t _pattern = 0;
|
||||
|
||||
uint16_t _counter = 0;
|
||||
bool _stroke = false;
|
||||
|
||||
uint8_t _targetR = 0;
|
||||
uint8_t _targetG = 0;
|
||||
uint8_t _targetB = 0;
|
||||
bool _fade = true;
|
||||
uint8_t _fadeSpeed = 7;
|
||||
|
||||
bool _powerd = false;
|
||||
|
||||
void patternStep();
|
||||
|
||||
uint8_t _pattern = 0;
|
||||
|
||||
uint16_t _counter = 0;
|
||||
bool _stroke = false;
|
||||
|
||||
uint8_t _targetR = 0;
|
||||
uint8_t _targetG = 0;
|
||||
uint8_t _targetB = 0;
|
||||
bool _fade = true;
|
||||
uint8_t _fadeSpeed = 7;
|
||||
|
||||
bool _powerd = false;
|
||||
|
||||
void patternStep();
|
||||
|
||||
uint16_t getCalValue();
|
||||
uint8_t applyCal(uint16_t value, const uint16_t* cal);
|
||||
void adjustHeadroom(uint8_t& r, uint8_t& g, uint8_t& b, const uint8_t lumina);
|
||||
|
||||
|
||||
public:
|
||||
RgbLed( Pwm8b* pwmA, Pwm8b* pwmB );
|
||||
|
||||
void setSolidColor( const uint8_t r, const uint8_t g, const uint8_t b);
|
||||
void setPattern(const uint8_t id);
|
||||
void setPreset( const uint8_t preset);
|
||||
|
||||
void on();
|
||||
void off();
|
||||
|
||||
void setFade(bool fade = true);
|
||||
|
||||
void logic();
|
||||
uint8_t getR();
|
||||
uint8_t getB();
|
||||
uint8_t getG();
|
||||
bool isPowerd();
|
||||
uint8_t getPattern();
|
||||
RgbLed( Pwm8b* pwmA, Pwm8b* pwmB );
|
||||
|
||||
void setSolidColor( const uint8_t r, const uint8_t g, const uint8_t b);
|
||||
void setPattern(const uint8_t id);
|
||||
void setPreset( const uint8_t preset);
|
||||
|
||||
void on();
|
||||
void off();
|
||||
|
||||
void setFade(bool fade = true);
|
||||
|
||||
void logic();
|
||||
uint8_t getR();
|
||||
uint8_t getB();
|
||||
uint8_t getG();
|
||||
bool isPowerd();
|
||||
uint8_t getPattern();
|
||||
|
||||
};
|
||||
|
||||
template <typename T> T sgn(T val)
|
||||
template <typename T> T sgn(T val)
|
||||
{
|
||||
return (T(0) < val) - (val < T(0));
|
||||
return (T(0) < val) - (val < T(0));
|
||||
}
|
||||
|
Reference in New Issue
Block a user