mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-10 14:41:26 +00:00
![Manuel](/assets/img/avatar_default.png)
* add hwid for auto-detection * fix: heltec-wireless-tracker USB serial * T-Deck support * trunk fmt * set FRAMERATE to 1 * fix some defines * trunk fmt * corrected vendor link * T-Deck: support keyboard, trackball & touch screen * T-Watch add touchscreen defs, remove getTouch * fix warnings * getTouch uint16 -> int16 * fix touch x,y * fix I2C port * CannedMsgModule: use entire display height * trunk fmt * fix I2C issue for T-Watch * allow dest selection in canned mode * fix: allow dest selection in canned mode * use tft.setBrightness() to poweroff display * Increased t-watch framerate and added back haptic feedback * add da ref * Move to touched * improved sensitivity and accuracy of touch events * use double tap to send canned message * fix warning * trunk fmt * Remove extra hapticFeedback() --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#include "UpDownInterruptBase.h"
|
|
#include "configuration.h"
|
|
|
|
UpDownInterruptBase::UpDownInterruptBase(const char *name)
|
|
{
|
|
this->_originName = name;
|
|
}
|
|
|
|
void UpDownInterruptBase::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinPress, char eventDown, char eventUp, char eventPressed,
|
|
void (*onIntDown)(), void (*onIntUp)(), void (*onIntPress)())
|
|
{
|
|
this->_pinDown = pinDown;
|
|
this->_pinUp = pinUp;
|
|
this->_eventDown = eventDown;
|
|
this->_eventUp = eventUp;
|
|
this->_eventPressed = eventPressed;
|
|
|
|
pinMode(pinPress, INPUT_PULLUP);
|
|
pinMode(this->_pinDown, INPUT_PULLUP);
|
|
pinMode(this->_pinUp, INPUT_PULLUP);
|
|
|
|
attachInterrupt(pinPress, onIntPress, RISING);
|
|
attachInterrupt(this->_pinDown, onIntDown, RISING);
|
|
attachInterrupt(this->_pinUp, onIntUp, RISING);
|
|
|
|
LOG_DEBUG("Up/down/press GPIO initialized (%d, %d, %d)\n", this->_pinUp, this->_pinDown, pinPress);
|
|
}
|
|
|
|
void UpDownInterruptBase::intPressHandler()
|
|
{
|
|
InputEvent e;
|
|
e.source = this->_originName;
|
|
LOG_DEBUG("GPIO event Press\n");
|
|
e.inputEvent = this->_eventPressed;
|
|
this->notifyObservers(&e);
|
|
}
|
|
|
|
void UpDownInterruptBase::intDownHandler()
|
|
{
|
|
InputEvent e;
|
|
e.source = this->_originName;
|
|
LOG_DEBUG("GPIO event Down\n");
|
|
e.inputEvent = this->_eventDown;
|
|
this->notifyObservers(&e);
|
|
}
|
|
|
|
void UpDownInterruptBase::intUpHandler()
|
|
{
|
|
InputEvent e;
|
|
e.source = this->_originName;
|
|
LOG_DEBUG("GPIO event Up\n");
|
|
e.inputEvent = this->_eventUp;
|
|
this->notifyObservers(&e);
|
|
}
|