firmware/src/input/RotaryEncoderInterruptImpl1.cpp

52 lines
1.5 KiB
C++
Raw Normal View History

2022-01-09 09:08:31 +00:00
#include "RotaryEncoderInterruptImpl1.h"
2022-01-11 15:02:55 +00:00
#include "InputBroker.h"
2022-01-09 09:08:31 +00:00
RotaryEncoderInterruptImpl1 *rotaryEncoderInterruptImpl1;
2022-01-11 12:12:04 +00:00
RotaryEncoderInterruptImpl1::RotaryEncoderInterruptImpl1() :
2022-01-09 09:08:31 +00:00
RotaryEncoderInterruptBase(
2022-01-11 12:12:04 +00:00
"rotEnc1")
{
}
2022-01-12 08:26:42 +00:00
void RotaryEncoderInterruptImpl1::init()
2022-01-11 12:12:04 +00:00
{
2022-01-12 08:26:42 +00:00
if (!radioConfig.preferences.rotary1_enabled)
{
// Input device is disabled.
return;
}
uint8_t pinA = radioConfig.preferences.rotary1_pin_a;
uint8_t pinB = radioConfig.preferences.rotary1_pin_b;
uint8_t pinPress = radioConfig.preferences.rotary1_pin_press;
char eventCw =
static_cast<char>(radioConfig.preferences.rotary1_event_cw);
char eventCcw =
static_cast<char>(radioConfig.preferences.rotary1_event_ccw);
char eventPressed =
static_cast<char>(radioConfig.preferences.rotary1_event_press);
//radioConfig.preferences.ext_notification_module_output
2022-01-11 12:12:04 +00:00
RotaryEncoderInterruptBase::init(
2022-01-09 09:08:31 +00:00
pinA, pinB, pinPress,
eventCw, eventCcw, eventPressed,
RotaryEncoderInterruptImpl1::handleIntA,
RotaryEncoderInterruptImpl1::handleIntB,
2022-01-11 12:12:04 +00:00
RotaryEncoderInterruptImpl1::handleIntPressed);
2022-01-13 13:06:10 +00:00
inputBroker->registerSource(this);
2022-01-09 09:08:31 +00:00
}
void RotaryEncoderInterruptImpl1::handleIntA()
{
2022-01-09 20:14:23 +00:00
rotaryEncoderInterruptImpl1->intAHandler();
2022-01-09 09:08:31 +00:00
}
void RotaryEncoderInterruptImpl1::handleIntB()
{
2022-01-09 20:14:23 +00:00
rotaryEncoderInterruptImpl1->intBHandler();
2022-01-09 09:08:31 +00:00
}
void RotaryEncoderInterruptImpl1::handleIntPressed()
{
2022-01-09 20:14:23 +00:00
rotaryEncoderInterruptImpl1->intPressHandler();
2022-01-09 09:08:31 +00:00
}