mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 17:52:35 +00:00
Combine rotary with canned messages.
This commit is contained in:
@@ -1,28 +1,30 @@
|
||||
#pragma once
|
||||
//#include <Arduino.h>
|
||||
//#include "Observer.h"
|
||||
#include "SinglePortPlugin.h"
|
||||
#include "HardwareInput.h"
|
||||
|
||||
enum RotaryEncoderInterruptBaseStateType
|
||||
{
|
||||
EVENT_OCCURRED,
|
||||
EVENT_CLEARED
|
||||
ROTARY_EVENT_OCCURRED,
|
||||
ROTARY_EVENT_CLEARED
|
||||
};
|
||||
|
||||
enum RotaryEncoderInterruptBaseActionType
|
||||
{
|
||||
ACTION_NONE,
|
||||
ACTION_PRESSED,
|
||||
ACTION_CW,
|
||||
ACTION_CCW
|
||||
ROTARY_ACTION_NONE,
|
||||
ROTARY_ACTION_PRESSED,
|
||||
ROTARY_ACTION_CW,
|
||||
ROTARY_ACTION_CCW
|
||||
};
|
||||
|
||||
class RotaryEncoderInterruptBase :
|
||||
public SinglePortPlugin,
|
||||
public Observable<const InputEvent *>,
|
||||
private concurrency::OSThread
|
||||
{
|
||||
public:
|
||||
RotaryEncoderInterruptBase(
|
||||
const char *name,
|
||||
uint8_t pinA, uint8_t pinB, uint8_t pinPress,
|
||||
char eventCw, char eventCcw, char eventPressed,
|
||||
// std::function<void(void)> onIntA, std::function<void(void)> onIntB, std::function<void(void)> onIntPress);
|
||||
@@ -33,11 +35,11 @@ class RotaryEncoderInterruptBase :
|
||||
|
||||
protected:
|
||||
virtual int32_t runOnce();
|
||||
volatile RotaryEncoderInterruptBaseStateType rotaryStateCW = EVENT_CLEARED;
|
||||
volatile RotaryEncoderInterruptBaseStateType rotaryStateCCW = EVENT_CLEARED;
|
||||
volatile RotaryEncoderInterruptBaseStateType rotaryStateCW = ROTARY_EVENT_CLEARED;
|
||||
volatile RotaryEncoderInterruptBaseStateType rotaryStateCCW = ROTARY_EVENT_CLEARED;
|
||||
volatile int rotaryLevelA = LOW;
|
||||
volatile int rotaryLevelB = LOW;
|
||||
volatile RotaryEncoderInterruptBaseActionType action = ACTION_NONE;
|
||||
volatile RotaryEncoderInterruptBaseActionType action = ROTARY_ACTION_NONE;
|
||||
|
||||
private:
|
||||
uint8_t _pinA;
|
||||
@@ -45,6 +47,4 @@ class RotaryEncoderInterruptBase :
|
||||
char _eventCw;
|
||||
char _eventCcw;
|
||||
char _eventPressed;
|
||||
};
|
||||
|
||||
RotaryEncoderInterruptBase *RotaryEncoderInterruptBase;
|
||||
};
|
||||
Reference in New Issue
Block a user