2020-08-17 20:47:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
2024-08-22 17:38:19 +00:00
|
|
|
#include <GpioLogic.h>
|
2020-08-28 22:06:52 +00:00
|
|
|
#include <OLEDDisplay.h>
|
|
|
|
|
|
|
|
/**
|
2023-08-06 13:45:47 +00:00
|
|
|
* An adapter class that allows using the LovyanGFX library as if it was an OLEDDisplay implementation.
|
2020-08-28 22:06:52 +00: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-29 00:38:23 +00:00
|
|
|
*
|
|
|
|
* turn radio back on - currently with both on spi bus is fucked? or are we leaving chip select asserted?
|
2020-08-28 22:06:52 +00: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-09 03:13:46 +00:00
|
|
|
TFTDisplay(uint8_t, int, int, OLEDDISPLAY_GEOMETRY, HW_I2C);
|
2020-08-28 22:06:52 +00:00
|
|
|
|
|
|
|
// Write the buffer to the display memory
|
2023-12-13 02:27:31 +00:00
|
|
|
virtual void display() override { display(false); };
|
|
|
|
virtual void display(bool fromBlank);
|
2023-01-20 15:34:39 +00:00
|
|
|
|
2023-08-08 16:06:39 +00:00
|
|
|
// Turn the display upside down
|
|
|
|
virtual void flipScreenVertically();
|
|
|
|
|
2023-07-30 12:51:26 +00: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 12:37:50 +00:00
|
|
|
// Functions for changing display brightness
|
|
|
|
void setDisplayBrightness(uint8_t);
|
|
|
|
|
2022-05-09 17:50:39 +00:00
|
|
|
/**
|
|
|
|
* shim to make the abstraction happy
|
2023-01-20 15:34:39 +00:00
|
|
|
*
|
2022-05-09 17:50:39 +00:00
|
|
|
*/
|
|
|
|
void setDetected(uint8_t detected);
|
2020-08-28 22:06:52 +00:00
|
|
|
|
2024-08-22 17:38:19 +00: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.
|
|
|
|
*/
|
|
|
|
GpioPin *backlightEnable;
|
|
|
|
|
2020-08-28 22:06:52 +00: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 22:06:52 +00: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 22:06:52 +00:00
|
|
|
|
|
|
|
// Connect to the display
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool connect() override;
|
2023-07-22 14:26:54 +00:00
|
|
|
};
|