Files
firmware/src/graphics/TFTDisplay.h

66 lines
2.0 KiB
C
Raw Normal View History

2020-08-17 13:47:05 -07:00
#pragma once
#include <GpioLogic.h>
2020-08-28 15:06:52 -07:00
#include <OLEDDisplay.h>
/**
* 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
*
* 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
*/
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
virtual void display() override { display(false); };
virtual void display(bool fromBlank);
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();
// 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);
/**
* shim to make the abstraction happy
2023-01-20 16:34:39 +01:00
*
*/
void setDetected(uint8_t detected);
2020-08-28 15:06:52 -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.
*
* We (cruftily) make it static so that variant.cpp can access it without needing a ptr to the TFTDisplay instance.
*/
static GpioPin *backlightEnable;
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;
uint16_t *linePixelBuffer = nullptr;
};