OXYGENHUB
◆ main openmsx / src / LedStatus.hh
874 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef LEDSTATUS_HH
2
#define LEDSTATUS_HH
3
4
#include "RTSchedulable.hh"
5
#include "ReadOnlySetting.hh"
6
7
#include <array>
8
#include <cstdint>
9
10
namespace openmsx {
11
12
class CommandController;
13
class MSXCliComm;
14
class RTScheduler;
15
class Interpreter;
16
17
class LedStatus final : public RTSchedulable
18
{
19
public:
20
	enum Led : uint8_t {
21
		POWER,
22
		CAPS,
23
		KANA, // same as CODE LED
24
		PAUSE,
25
		TURBO,
26
		FDD,
27
		NUM_LEDS // must be last
28
	};
29
30
	LedStatus(RTScheduler& rtScheduler,
31
	          CommandController& commandController,
32
	          MSXCliComm& msxCliComm);
33
34
	void setLed(Led led, bool status);
35
36
private:
37
	void handleEvent(Led led) noexcept;
38
39
	// RTSchedulable
40
	void executeRT() override;
41
42
private:
43
	MSXCliComm& msxCliComm;
44
	Interpreter& interp;
45
	std::array<ReadOnlySetting, NUM_LEDS> ledStatus;
46
	uint64_t lastTime;
47
	std::array<bool, NUM_LEDS> ledValue;
48
};
49
50
} // namespace openmsx
51
52
#endif