mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-21 12:38:34 +00:00
Trackball everywhere, and unPhone buttons
This commit is contained in:
parent
8794e7bae4
commit
b26b74bb24
@ -302,6 +302,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#error HW_VENDOR must be defined
|
#error HW_VENDOR must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TB_DOWN
|
||||||
|
#define TB_DOWN 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_UP
|
||||||
|
#define TB_UP 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_LEFT
|
||||||
|
#define TB_LEFT 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_RIGHT
|
||||||
|
#define TB_RIGHT 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_PRESS
|
||||||
|
#define TB_PRESS 255
|
||||||
|
#endif
|
||||||
|
|
||||||
// Support multiple RGB LED configuration
|
// Support multiple RGB LED configuration
|
||||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||||
#define HAS_RGB_LED
|
#define HAS_RGB_LED
|
||||||
|
@ -8,11 +8,6 @@ TrackballInterruptImpl1::TrackballInterruptImpl1() : TrackballInterruptBase("tra
|
|||||||
|
|
||||||
void TrackballInterruptImpl1::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLeft, uint8_t pinRight, uint8_t pinPress)
|
void TrackballInterruptImpl1::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLeft, uint8_t pinRight, uint8_t pinPress)
|
||||||
{
|
{
|
||||||
#if !HAS_TRACKBALL
|
|
||||||
// Input device is disabled.
|
|
||||||
return;
|
|
||||||
#else
|
|
||||||
|
|
||||||
input_broker_event eventDown = INPUT_BROKER_DOWN;
|
input_broker_event eventDown = INPUT_BROKER_DOWN;
|
||||||
input_broker_event eventUp = INPUT_BROKER_UP;
|
input_broker_event eventUp = INPUT_BROKER_UP;
|
||||||
input_broker_event eventLeft = INPUT_BROKER_LEFT;
|
input_broker_event eventLeft = INPUT_BROKER_LEFT;
|
||||||
@ -24,7 +19,6 @@ void TrackballInterruptImpl1::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLe
|
|||||||
TrackballInterruptImpl1::handleIntLeft, TrackballInterruptImpl1::handleIntRight,
|
TrackballInterruptImpl1::handleIntLeft, TrackballInterruptImpl1::handleIntRight,
|
||||||
TrackballInterruptImpl1::handleIntPressed);
|
TrackballInterruptImpl1::handleIntPressed);
|
||||||
inputBroker->registerSource(this);
|
inputBroker->registerSource(this);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackballInterruptImpl1::handleIntDown()
|
void TrackballInterruptImpl1::handleIntDown()
|
||||||
|
@ -431,6 +431,10 @@ void setup()
|
|||||||
gpio_pullup_en((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
|
gpio_pullup_en((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
|
||||||
delay(10);
|
delay(10);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BUTTON_NEED_PULLUP2
|
||||||
|
gpio_pullup_en((gpio_num_t)BUTTON_NEED_PULLUP2);
|
||||||
|
delay(10);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -911,7 +915,7 @@ void setup()
|
|||||||
pullup_sense = INPUT_PULLUP_SENSE;
|
pullup_sense = INPUT_PULLUP_SENSE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(ARCH_PORTDUINO) // make it work
|
#if defined(ARCH_PORTDUINO)
|
||||||
|
|
||||||
if (settingsMap.count(userButtonPin) != 0 && settingsMap[userButtonPin] != RADIOLIB_NC) {
|
if (settingsMap.count(userButtonPin) != 0 && settingsMap[userButtonPin] != RADIOLIB_NC) {
|
||||||
|
|
||||||
|
@ -371,7 +371,8 @@ bool CannedMessageModule::isUpEvent(const InputEvent *event)
|
|||||||
}
|
}
|
||||||
bool CannedMessageModule::isDownEvent(const InputEvent *event)
|
bool CannedMessageModule::isDownEvent(const InputEvent *event)
|
||||||
{
|
{
|
||||||
return event->inputEvent == INPUT_BROKER_DOWN;
|
return event->inputEvent == INPUT_BROKER_DOWN ||
|
||||||
|
(runState == CANNED_MESSAGE_RUN_STATE_ACTIVE && event->inputEvent == INPUT_BROKER_USER_PRESS);
|
||||||
}
|
}
|
||||||
bool CannedMessageModule::isSelectEvent(const InputEvent *event)
|
bool CannedMessageModule::isSelectEvent(const InputEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ void setupModules()
|
|||||||
aLinuxInputImpl->init();
|
aLinuxInputImpl->init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
#if !MESHTASTIC_EXCLUDE_INPUTBROKER
|
||||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
|
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
|
||||||
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
||||||
trackballInterruptImpl1->init(TB_DOWN, TB_UP, TB_LEFT, TB_RIGHT, TB_PRESS);
|
trackballInterruptImpl1->init(TB_DOWN, TB_UP, TB_LEFT, TB_RIGHT, TB_PRESS);
|
||||||
|
@ -57,9 +57,13 @@
|
|||||||
#define LED_PIN 13 // the red part of the RGB LED
|
#define LED_PIN 13 // the red part of the RGB LED
|
||||||
#define LED_STATE_ON 0 // State when LED is lit
|
#define LED_STATE_ON 0 // State when LED is lit
|
||||||
|
|
||||||
#define BUTTON_PIN 21 // Button 3 - square - top button in landscape mode
|
#define TB_UP 21 // Button 3 - square - top button in landscape mode
|
||||||
|
#define BUTTON_NEED_PULLUP2 TB_UP
|
||||||
|
#define BUTTON_PIN 0 // Circle button
|
||||||
#define BUTTON_NEED_PULLUP // we do need a helping hand up
|
#define BUTTON_NEED_PULLUP // we do need a helping hand up
|
||||||
#define CANCEL_BUTTON_PIN 45 // Button 1 - triangle - bottom button in landscape mode
|
#define CANCEL_BUTTON_PIN 45 // Button 1 - triangle - bottom button in landscape mode
|
||||||
|
#define CANCEL_BUTTON_ACTIVE_LOW true
|
||||||
|
#define CANCEL_BUTTON_ACTIVE_PULLUP true
|
||||||
|
|
||||||
#define I2C_SDA 3 // I2C pins for this board
|
#define I2C_SDA 3 // I2C pins for this board
|
||||||
#define I2C_SCL 4
|
#define I2C_SCL 4
|
||||||
|
Loading…
Reference in New Issue
Block a user