T deck: support keyboard, trackball and touchscreen (#2665)

* 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>
This commit is contained in:
Manuel
2023-07-30 14:51:26 +02:00
committed by GitHub
parent b9c9f0f865
commit 502a6596a3
27 changed files with 704 additions and 100 deletions

View File

@@ -174,7 +174,7 @@ class LGFX : public lgfx::LGFX_Device
auto cfg = _light_instance.config(); // Gets a structure for backlight settings.
cfg.pin_bl = ST7789_BL; // Pin number to which the backlight is connected
cfg.invert = true; // true to invert the brightness of the backlight
cfg.invert = false; // true to invert the brightness of the backlight
// cfg.pwm_channel = 0;
_light_instance.config(cfg);
@@ -196,7 +196,7 @@ class LGFX : public lgfx::LGFX_Device
// cfg.freq = 2500000;
// I2C
cfg.i2c_port = 1;
cfg.i2c_port = TOUCH_I2C_PORT;
cfg.i2c_addr = TOUCH_SLAVE_ADDRESS;
#ifdef SCREEN_TOUCH_USE_I2C1
cfg.pin_sda = I2C_SDA1;
@@ -205,7 +205,7 @@ class LGFX : public lgfx::LGFX_Device
cfg.pin_sda = I2C_SDA;
cfg.pin_scl = I2C_SCL;
#endif
cfg.freq = 400000;
// cfg.freq = 400000;
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance);
@@ -275,6 +275,9 @@ void TFTDisplay::sendCommand(uint8_t com)
#endif
#ifdef VTFT_CTRL
digitalWrite(VTFT_CTRL, LOW);
#endif
#ifndef M5STACK
tft.setBrightness(128);
#endif
break;
}
@@ -284,6 +287,9 @@ void TFTDisplay::sendCommand(uint8_t com)
#endif
#ifdef VTFT_CTRL
digitalWrite(VTFT_CTRL, HIGH);
#endif
#ifndef M5STACK
tft.setBrightness(0);
#endif
break;
}
@@ -294,6 +300,24 @@ void TFTDisplay::sendCommand(uint8_t com)
// Drop all other commands to device (we just update the buffer)
}
bool TFTDisplay::hasTouch(void)
{
#ifndef M5STACK
return tft.touch() != nullptr;
#else
return false;
#endif
}
bool TFTDisplay::getTouch(int16_t *x, int16_t *y)
{
#ifndef M5STACK
return tft.getTouch(x, y);
#else
return false;
#endif
}
void TFTDisplay::setDetected(uint8_t detected)
{
(void)detected;
@@ -322,12 +346,4 @@ bool TFTDisplay::connect()
return true;
}
// Get touch coords from the display
void TFTDisplay::getTouch(int *x, int *y)
{
#ifndef M5STACK
tft.getTouch(x, y);
#endif
}
#endif