mirror of
https://github.com/meshtastic/firmware.git
synced 2026-11-07 23:04:49 -05:00
* Add Elecrow ThinkNode M8 variant scaffold (thinknode_m8) nRF52840 + SX1262 + 2.4" e-paper + ATGM336H-5NR32 GPS. All pins resolved from ThinkNode_M8_V0.3.sch; cross-checked against meshtastic/firmware#9181 (Elecrow V0.1 reference). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add Elecrow ThinkNode M8 board support (nRF52840/SX1262, 1.54in e-ink, ATGM336H GNSS, SC7A20, EC04 encoder) * Address review: keep the stored backlight level out of blanking, match only the SC7A20 WHO_AM_I byte, and transfer detents atomically * Use std::atomic for the press-and-turn detent counter so native builds compile * Drop the ThinkNode M8 LED_BUILTIN redefinition that warned on every translation unit --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
2.0 KiB
C++
50 lines
2.0 KiB
C++
#include "RotaryEncoderInterruptImpl1.h"
|
|
#include "InputBroker.h"
|
|
extern bool osk_found;
|
|
|
|
RotaryEncoderInterruptImpl1 *rotaryEncoderInterruptImpl1;
|
|
|
|
RotaryEncoderInterruptImpl1::RotaryEncoderInterruptImpl1() : RotaryEncoderInterruptBase("rotEnc1") {}
|
|
|
|
bool RotaryEncoderInterruptImpl1::init()
|
|
{
|
|
if (!moduleConfig.canned_message.rotary1_enabled) {
|
|
// Input device is disabled.
|
|
disable();
|
|
return false;
|
|
}
|
|
|
|
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;
|
|
|
|
// moduleConfig.canned_message.ext_notification_module_output
|
|
RotaryEncoderInterruptBase::init(pinA, pinB, pinPress, eventCw, eventCcw, eventPressed, eventPressedLong,
|
|
RotaryEncoderInterruptImpl1::handleIntA, RotaryEncoderInterruptImpl1::handleIntB,
|
|
RotaryEncoderInterruptImpl1::handleIntPressed);
|
|
#if defined(INPUTDRIVER_PRESS_AND_TURN_CW) && defined(INPUTDRIVER_PRESS_AND_TURN_CCW)
|
|
setPressAndTurnChars(INPUTDRIVER_PRESS_AND_TURN_CW, INPUTDRIVER_PRESS_AND_TURN_CCW);
|
|
#endif
|
|
inputBroker->registerSource(this);
|
|
#ifndef HAS_PHYSICAL_KEYBOARD
|
|
osk_found = true;
|
|
#endif
|
|
return true;
|
|
}
|
|
|
|
void RotaryEncoderInterruptImpl1::handleIntA()
|
|
{
|
|
rotaryEncoderInterruptImpl1->intAHandler();
|
|
}
|
|
void RotaryEncoderInterruptImpl1::handleIntB()
|
|
{
|
|
rotaryEncoderInterruptImpl1->intBHandler();
|
|
}
|
|
void RotaryEncoderInterruptImpl1::handleIntPressed()
|
|
{
|
|
rotaryEncoderInterruptImpl1->intPressHandler();
|
|
} |