2025-08-26 16:35:25 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2025-09-14 20:17:24 +02:00
|
|
|
#ifdef T_LORA_PAGER
|
|
|
|
|
|
|
|
|
|
// This is a version of RotaryEncoder which is based on a debounce inherent FSM table (see RotaryEncoder library)
|
2025-08-26 16:35:25 +02:00
|
|
|
|
|
|
|
|
#include "InputBroker.h"
|
|
|
|
|
#include "concurrency/OSThread.h"
|
|
|
|
|
#include "mesh/NodeDB.h"
|
|
|
|
|
|
|
|
|
|
class RotaryEncoder;
|
|
|
|
|
|
|
|
|
|
class RotaryEncoderImpl : public Observable<const InputEvent *>, public concurrency::OSThread
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
RotaryEncoderImpl();
|
|
|
|
|
bool init(void);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual int32_t runOnce() override;
|
|
|
|
|
|
2025-09-12 05:53:35 +02:00
|
|
|
QueueHandle_t inputQueue;
|
|
|
|
|
void dispatchInputs(void);
|
|
|
|
|
TaskHandle_t inputWorkerTask;
|
|
|
|
|
static void inputWorker(void *p);
|
2025-09-17 02:07:24 +02:00
|
|
|
EventGroupHandle_t interruptFlag;
|
|
|
|
|
static RotaryEncoderImpl *interruptInstance;
|
2025-09-12 05:53:35 +02:00
|
|
|
|
2025-08-26 16:35:25 +02:00
|
|
|
input_broker_event eventCw = INPUT_BROKER_NONE;
|
|
|
|
|
input_broker_event eventCcw = INPUT_BROKER_NONE;
|
|
|
|
|
input_broker_event eventPressed = INPUT_BROKER_NONE;
|
|
|
|
|
|
|
|
|
|
RotaryEncoder *rotary;
|
|
|
|
|
const char *originName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern RotaryEncoderImpl *rotaryEncoderImpl;
|
2025-09-14 20:17:24 +02:00
|
|
|
|
|
|
|
|
#endif
|