2022-01-09 10:08:31 +01:00
|
|
|
#include "RotaryEncoderInterruptImpl1.h"
|
2022-01-11 16:02:55 +01:00
|
|
|
#include "InputBroker.h"
|
2022-01-09 10:08:31 +01:00
|
|
|
|
|
|
|
|
RotaryEncoderInterruptImpl1 *rotaryEncoderInterruptImpl1;
|
|
|
|
|
|
2022-05-07 20:31:21 +10:00
|
|
|
RotaryEncoderInterruptImpl1::RotaryEncoderInterruptImpl1() : RotaryEncoderInterruptBase("rotEnc1") {}
|
2022-01-11 13:12:04 +01:00
|
|
|
|
2022-01-12 09:26:42 +01:00
|
|
|
void RotaryEncoderInterruptImpl1::init()
|
2022-01-11 13:12:04 +01:00
|
|
|
{
|
2022-05-07 20:31:21 +10:00
|
|
|
if (!moduleConfig.payloadVariant.canned_message.rotary1_enabled) {
|
2022-01-12 09:26:42 +01:00
|
|
|
// Input device is disabled.
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-07 20:31:21 +10:00
|
|
|
uint8_t pinA = moduleConfig.payloadVariant.canned_message.inputbroker_pin_a;
|
|
|
|
|
uint8_t pinB = moduleConfig.payloadVariant.canned_message.inputbroker_pin_b;
|
|
|
|
|
uint8_t pinPress = moduleConfig.payloadVariant.canned_message.inputbroker_pin_press;
|
|
|
|
|
char eventCw = static_cast<char>(moduleConfig.payloadVariant.canned_message.inputbroker_event_cw);
|
|
|
|
|
char eventCcw = static_cast<char>(moduleConfig.payloadVariant.canned_message.inputbroker_event_ccw);
|
|
|
|
|
char eventPressed = static_cast<char>(moduleConfig.payloadVariant.canned_message.inputbroker_event_press);
|
2022-01-12 09:26:42 +01:00
|
|
|
|
2022-05-07 20:31:21 +10:00
|
|
|
// moduleConfig.payloadVariant.canned_message.ext_notification_module_output
|
|
|
|
|
RotaryEncoderInterruptBase::init(pinA, pinB, pinPress, eventCw, eventCcw, eventPressed,
|
|
|
|
|
RotaryEncoderInterruptImpl1::handleIntA, RotaryEncoderInterruptImpl1::handleIntB,
|
|
|
|
|
RotaryEncoderInterruptImpl1::handleIntPressed);
|
2022-01-13 14:06:10 +01:00
|
|
|
inputBroker->registerSource(this);
|
2022-01-09 10:08:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RotaryEncoderInterruptImpl1::handleIntA()
|
|
|
|
|
{
|
2022-01-09 21:14:23 +01:00
|
|
|
rotaryEncoderInterruptImpl1->intAHandler();
|
2022-01-09 10:08:31 +01:00
|
|
|
}
|
|
|
|
|
void RotaryEncoderInterruptImpl1::handleIntB()
|
|
|
|
|
{
|
2022-01-09 21:14:23 +01:00
|
|
|
rotaryEncoderInterruptImpl1->intBHandler();
|
2022-01-09 10:08:31 +01:00
|
|
|
}
|
|
|
|
|
void RotaryEncoderInterruptImpl1::handleIntPressed()
|
|
|
|
|
{
|
2022-01-09 21:14:23 +01:00
|
|
|
rotaryEncoderInterruptImpl1->intPressHandler();
|
2022-01-09 10:08:31 +01:00
|
|
|
}
|