2020-08-17 13:47:05 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-08-22 10:38:19 -07:00
|
|
|
#include <GpioLogic.h>
|
2020-08-28 15:06:52 -07:00
|
|
|
#include <OLEDDisplay.h>
|
|
|
|
|
|
|
|
|
|
/**
|
2023-08-06 15:45:47 +02:00
|
|
|
* An adapter class that allows using the LovyanGFX library as if it was an OLEDDisplay implementation.
|
2020-08-28 15:06:52 -07:00
|
|
|
*
|
|
|
|
|
* Remaining TODO:
|
|
|
|
|
* optimize display() to only draw changed pixels (see other OLED subclasses for examples)
|
|
|
|
|
* Use the fast NRF52 SPI API rather than the slow standard arduino version
|
2020-08-28 17:38:23 -07:00
|
|
|
*
|
|
|
|
|
* turn radio back on - currently with both on spi bus is fucked? or are we leaving chip select asserted?
|
2020-08-28 15:06:52 -07:00
|
|
|
*/
|
|
|
|
|
class TFTDisplay : public OLEDDisplay
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/* constructor
|
|
|
|
|
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
|
|
|
|
|
*/
|
2023-03-08 19:13:46 -08:00
|
|
|
TFTDisplay(uint8_t, int, int, OLEDDISPLAY_GEOMETRY, HW_I2C);
|
2020-08-28 15:06:52 -07:00
|
|
|
|
2025-09-05 06:22:21 -05:00
|
|
|
// Destructor to clean up allocated memory
|
|
|
|
|
~TFTDisplay();
|
|
|
|
|
|
2020-08-28 15:06:52 -07:00
|
|
|
// Write the buffer to the display memory
|
2023-12-12 20:27:31 -06:00
|
|
|
virtual void display() override { display(false); };
|
|
|
|
|
virtual void display(bool fromBlank);
|
2025-08-20 12:51:14 -05:00
|
|
|
void sdlLoop();
|
2023-01-20 16:34:39 +01:00
|
|
|
|
2023-08-08 18:06:39 +02:00
|
|
|
// Turn the display upside down
|
|
|
|
|
virtual void flipScreenVertically();
|
|
|
|
|
|
2023-07-30 14:51:26 +02:00
|
|
|
// Touch screen (static handlers)
|
|
|
|
|
static bool hasTouch(void);
|
|
|
|
|
static bool getTouch(int16_t *x, int16_t *y);
|
|
|
|
|
|
Added modifier key combination to allow keyboard shortcuts on t-deck (#3668)
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Updated kbI2cBase.cpp
Updated keyboard settings for t-deck to allow a modifier key to trigger 'tab', mute notifications, or quit. To trigger the modifier press the shift key and mic (0) button at the same time. Then press q (quit), m (mute), or t (tab).
* Update kbI2cBase.cpp
* fixed formatting issues in kbI2cBase.cpp
* Removed keyboard shortcut code that doesnt work
alt+t does not work on a t-deck so I removed it to avoid confusion.
* Changed modifier key to alt+c
* Added screen brightness functionality
Use modifier key with o(+) to increase brightness or i(-) to decrease.
Currently there are 4 levels of brightness, (L, ML, MH, H). I would like to add a popup message to tell you the brightness.
* Added checks to disable screen brightness changes on unsupported hardware
* Setting the brightness code to work on only applicable devices
* Added "function symbol" display to bottom right corner of screen. Now shows when mute is active or modifier key is pressed. Also fixed some other minor issues.
* commented out a log
* Reworked how modifier functions worked, added
I wasn’t happy with my previous implementation, and I think it would have caused issues with other devices. This should work on all devices.
* Added back the function I moved causing issue with versions
* Fixed the version conflicts, everything seems to work fine now
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
2024-05-08 08:37:50 -04:00
|
|
|
// Functions for changing display brightness
|
|
|
|
|
void setDisplayBrightness(uint8_t);
|
|
|
|
|
|
2022-05-09 19:50:39 +02:00
|
|
|
/**
|
|
|
|
|
* shim to make the abstraction happy
|
2023-01-20 16:34:39 +01:00
|
|
|
*
|
2022-05-09 19:50:39 +02:00
|
|
|
*/
|
|
|
|
|
void setDetected(uint8_t detected);
|
2020-08-28 15:06:52 -07:00
|
|
|
|
2024-08-22 10:38:19 -07:00
|
|
|
/**
|
|
|
|
|
* This is normally managed entirely by TFTDisplay, but some rare applications (heltec tracker) might need to replace the
|
|
|
|
|
* default GPIO behavior with something a bit more complex.
|
2024-08-28 09:59:42 -07:00
|
|
|
*
|
|
|
|
|
* We (cruftily) make it static so that variant.cpp can access it without needing a ptr to the TFTDisplay instance.
|
2024-08-22 10:38:19 -07:00
|
|
|
*/
|
2024-08-28 09:59:42 -07:00
|
|
|
static GpioPin *backlightEnable;
|
2024-08-22 10:38:19 -07:00
|
|
|
|
2020-08-28 15:06:52 -07:00
|
|
|
protected:
|
|
|
|
|
// the header size of the buffer used, e.g. for the SPI command header
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual int getBufferOffset(void) override { return 0; }
|
2020-08-28 15:06:52 -07:00
|
|
|
|
|
|
|
|
// Send a command to the display (low level function)
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual void sendCommand(uint8_t com) override;
|
2020-08-28 15:06:52 -07:00
|
|
|
|
|
|
|
|
// Connect to the display
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool connect() override;
|
2025-08-26 16:35:25 +02:00
|
|
|
|
|
|
|
|
uint16_t *linePixelBuffer = nullptr;
|
2023-07-22 09:26:54 -05:00
|
|
|
};
|