If the code hasn't been touched in this long, its probably release-worthy.
This commit is contained in:
@@ -32,6 +32,7 @@ struct Variant {
|
||||
const char* asString() const;
|
||||
CRGB asRGB() const;
|
||||
int asInt() const;
|
||||
bool asBool() const;
|
||||
|
||||
private:
|
||||
union {
|
||||
@@ -74,6 +75,8 @@ struct InputEvent: public Variant {
|
||||
|
||||
// Timekeeping
|
||||
ScheduleChange,
|
||||
Beat,
|
||||
BeatDetect,
|
||||
|
||||
// Task management
|
||||
StartThing,
|
||||
@@ -87,6 +90,8 @@ struct InputEvent: public Variant {
|
||||
|
||||
// Firmware events
|
||||
FirmwareUpdate,
|
||||
|
||||
ReadyToRoll,
|
||||
};
|
||||
|
||||
template<typename Value>
|
||||
@@ -102,14 +107,26 @@ struct InputEvent: public Variant {
|
||||
Intent intent;
|
||||
};
|
||||
|
||||
struct MainLoop;
|
||||
|
||||
class InputSource: public Task {
|
||||
public:
|
||||
InputSource() : Task() {}
|
||||
InputSource(const char* name) : Task(name) {}
|
||||
InputSource(Task::State initialState) : Task(initialState) {}
|
||||
InputSource(const char* name, Task::State initialState) : Task(name, initialState) {}
|
||||
InputSource() : Task() {init();}
|
||||
explicit InputSource(const char* name) : Task(name) {init();}
|
||||
explicit InputSource(Task::State initialState) : Task(initialState) {init();}
|
||||
InputSource(const char* name, Task::State initialState) : Task(name, initialState) {init();}
|
||||
void loop() override;
|
||||
void onStart() override;
|
||||
virtual InputEvent read() = 0;
|
||||
private:
|
||||
void init();
|
||||
#ifdef CONFIG_THREADED_INPUTS
|
||||
static void readThread(void* data);
|
||||
MainLoop* m_threadLoop;
|
||||
static uint8_t m_threadBuf[sizeof(InputEvent) * 32];
|
||||
QueueHandle_t m_queue;
|
||||
StaticQueue_t m_threadQueue;
|
||||
#endif
|
||||
};
|
||||
|
||||
class InputFunc : public InputSource {
|
||||
@@ -128,7 +145,6 @@ private:
|
||||
|
||||
class BufferedInputSource: public InputSource {
|
||||
public:
|
||||
BufferedInputSource() : InputSource() {}
|
||||
BufferedInputSource(const char* name) : InputSource(name) {}
|
||||
InputEvent read() override;
|
||||
|
||||
|
Reference in New Issue
Block a user