2022-03-26 16:45:42 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "InputBroker.h"
|
2022-05-07 10:31:21 +00:00
|
|
|
#include "SinglePortModule.h" // TODO: what header file to include?
|
2022-03-26 16:45:42 +00:00
|
|
|
|
2022-05-07 10:31:21 +00:00
|
|
|
class UpDownInterruptBase : public Observable<const InputEvent *>
|
2022-03-26 16:45:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-05-07 10:31:21 +00:00
|
|
|
explicit UpDownInterruptBase(const char *name);
|
|
|
|
void init(uint8_t pinDown, uint8_t pinUp, uint8_t pinPress, char eventDown, char eventUp, char eventPressed,
|
|
|
|
void (*onIntDown)(), void (*onIntUp)(), void (*onIntPress)());
|
2022-03-26 16:45:42 +00:00
|
|
|
void intPressHandler();
|
|
|
|
void intDownHandler();
|
|
|
|
void intUpHandler();
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t _pinDown = 0;
|
|
|
|
uint8_t _pinUp = 0;
|
2022-05-07 10:31:21 +00:00
|
|
|
char _eventDown = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
|
|
|
|
char _eventUp = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
|
|
|
|
char _eventPressed = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
|
2022-03-26 16:45:42 +00:00
|
|
|
const char *_originName;
|
|
|
|
};
|