2022-01-09 10:08:31 +01:00
|
|
|
#include "RotaryEncoderInterruptImpl1.h"
|
2022-01-11 16:02:55 +01:00
|
|
|
#include "InputBroker.h"
|
2025-08-29 23:26:27 +08:00
|
|
|
extern bool osk_found;
|
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
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
bool RotaryEncoderInterruptImpl1::init()
|
|
|
|
|
{
|
|
|
|
|
if (!moduleConfig.canned_message.rotary1_enabled) {
|
|
|
|
|
// Input device is disabled.
|
|
|
|
|
disable();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-01-12 09:26:42 +01:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
uint8_t pinA = moduleConfig.canned_message.inputbroker_pin_a;
|
|
|
|
|
uint8_t pinB = moduleConfig.canned_message.inputbroker_pin_b;
|
|
|
|
|
uint8_t pinPress = moduleConfig.canned_message.inputbroker_pin_press;
|
|
|
|
|
input_broker_event eventCw = static_cast<input_broker_event>(moduleConfig.canned_message.inputbroker_event_cw);
|
|
|
|
|
input_broker_event eventCcw = static_cast<input_broker_event>(moduleConfig.canned_message.inputbroker_event_ccw);
|
|
|
|
|
input_broker_event eventPressed = static_cast<input_broker_event>(moduleConfig.canned_message.inputbroker_event_press);
|
|
|
|
|
input_broker_event eventPressedLong = INPUT_BROKER_SELECT_LONG;
|
2022-01-12 09:26:42 +01:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
// moduleConfig.canned_message.ext_notification_module_output
|
|
|
|
|
RotaryEncoderInterruptBase::init(pinA, pinB, pinPress, eventCw, eventCcw, eventPressed, eventPressedLong,
|
|
|
|
|
RotaryEncoderInterruptImpl1::handleIntA, RotaryEncoderInterruptImpl1::handleIntB,
|
|
|
|
|
RotaryEncoderInterruptImpl1::handleIntPressed);
|
|
|
|
|
inputBroker->registerSource(this);
|
2025-12-26 07:34:25 -06:00
|
|
|
#ifndef HAS_PHYSICAL_KEYBOARD
|
2026-01-04 12:15:53 +01:00
|
|
|
osk_found = true;
|
2025-12-26 07:34:25 -06:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
return true;
|
2022-01-09 10:08:31 +01:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void RotaryEncoderInterruptImpl1::handleIntA()
|
|
|
|
|
{
|
|
|
|
|
rotaryEncoderInterruptImpl1->intAHandler();
|
|
|
|
|
}
|
|
|
|
|
void RotaryEncoderInterruptImpl1::handleIntB()
|
|
|
|
|
{
|
|
|
|
|
rotaryEncoderInterruptImpl1->intBHandler();
|
|
|
|
|
}
|
|
|
|
|
void RotaryEncoderInterruptImpl1::handleIntPressed()
|
|
|
|
|
{
|
|
|
|
|
rotaryEncoderInterruptImpl1->intPressHandler();
|
|
|
|
|
}
|