blob: b1c0f23d6e6ee7da8cd04168a9b4867f2b7f955b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#pragma once
#include <vector>
#include <filesystem>
struct LED
{
// the root to the whole LED interface, e.g. "/sys/class/leds/ACT"
std::filesystem::path green;
std::filesystem::path red;
};
class StatusLED
{
public:
enum class Mode
{
OK, // green
OKBeat, // green with heartbeat
Error, // red
};
StatusLED();
void addLED(const LED& led);
void setMode(Mode mode);
void setBPM(int bpm);
private:
void initLED(const LED& led);
void updateLED(const LED& led);
std::vector<LED> m_leds; // on best effort base, those will all show the same status
Mode m_mode;
int m_bpm;
};
|