mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-23 04:43:23 +00:00
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <GpioLogic.h>
|
|
#include <OLEDDisplay.h>
|
|
|
|
/**
|
|
* An adapter class that allows using the LovyanGFX library as if it was an OLEDDisplay implementation.
|
|
*
|
|
* 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?
|
|
*/
|
|
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);
|
|
|
|
// Write the buffer to the display memory
|
|
virtual void display() override { display(false); };
|
|
virtual void display(bool fromBlank);
|
|
|
|
// 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);
|
|
|
|
// Functions for changing display brightness
|
|
void setDisplayBrightness(uint8_t);
|
|
|
|
/**
|
|
* shim to make the abstraction happy
|
|
*
|
|
*/
|
|
void setDetected(uint8_t detected);
|
|
|
|
/**
|
|
* 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;
|
|
|
|
protected:
|
|
// the header size of the buffer used, e.g. for the SPI command header
|
|
virtual int getBufferOffset(void) override { return 0; }
|
|
|
|
// Send a command to the display (low level function)
|
|
virtual void sendCommand(uint8_t com) override;
|
|
|
|
// Connect to the display
|
|
virtual bool connect() override;
|
|
}; |