Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
indicator.h
Go to the documentation of this file.
1
5#ifndef PHYSICAL_INDICATOR_H
6#define PHYSICAL_INDICATOR_H
7
9#include <initializer_list>
10
11namespace lampda {
12namespace physical {
14namespace indicator {
15
16// RGB leds do not have the same output power per color
18static constexpr float redColorCorrection = 1.0f;
20static constexpr float greenColorCorrection = 1.0f / 3.0f;
22static constexpr float blueColorCorrection = 1.0f / 4.0f;
23
25extern void init();
26
28extern void set_color(const utils::ColorSpace::RGB& c);
29
31extern void set_brightness(const uint8_t brightness);
33extern uint8_t get_brightness();
34
42extern bool breeze(const uint32_t periodOn, const uint32_t periodOff, const utils::ColorSpace::RGB& color);
43
50extern bool color_loop(const uint32_t colorDuration, std::initializer_list<utils::ColorSpace::RGB> colors);
51
59extern bool blink(const uint32_t offFreq, const uint32_t onFreq, std::initializer_list<utils::ColorSpace::RGB> colors);
60
68inline bool blink(const uint32_t offFreq, const uint32_t onFreq, const utils::ColorSpace::RGB& color)
69{
70 return blink(offFreq, onFreq, {color});
71}
72
73} // namespace indicator
74} // namespace physical
75} // namespace lampda
76
77#endif
Definition: colorspace.h:50
Define commonly used color spaces.
bool breeze(const uint32_t periodOn, const uint32_t periodOff, const utils::ColorSpace::RGB &color)
Breeze animation.
Definition: indicator.cpp:61
static constexpr float greenColorCorrection
Scaling for the green color channel of an this RGB diode.
Definition: indicator.h:20
bool blink(const uint32_t offFreq, const uint32_t onFreq, std::initializer_list< utils::ColorSpace::RGB > colors)
Blink animation.
Definition: indicator.cpp:125
uint8_t get_brightness()
Return the brightness of the indicator (0-255)
Definition: indicator.cpp:55
static constexpr float redColorCorrection
Scaling for the red color channel of an this RGB diode.
Definition: indicator.h:18
static constexpr float blueColorCorrection
Scaling for the blue color channel of an this RGB diode.
Definition: indicator.h:22
void set_brightness(const uint8_t brightness)
Set an indicator brightness (0-255)
Definition: indicator.cpp:50
bool color_loop(const uint32_t colorDuration, std::initializer_list< utils::ColorSpace::RGB > colors)
color loop animation
Definition: indicator.cpp:109
void init()
Initialize the RGB indicator. Call once on program start.
Definition: indicator.cpp:33
void set_color(const utils::ColorSpace::RGB &c)
Set the color of the indicator.
Definition: indicator.cpp:42
Program scope.
Definition: control_fixed_modes.hpp:12