firmware/src/graphics/TFTDisplay.h

48 lines
1.4 KiB
C
Raw Normal View History

2020-08-17 20:47:05 +00:00
#pragma once
2020-08-28 22:06:52 +00:00
#include <OLEDDisplay.h>
/**
* 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
*
* 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
*/
TFTDisplay(uint8_t, int, int, OLEDDISPLAY_GEOMETRY, HW_I2C);
2020-08-28 22:06:52 +00:00
// Write the buffer to the display memory
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();
// Touch screen (static handlers)
static bool hasTouch(void);
static bool getTouch(int16_t *x, int16_t *y);
/**
* shim to make the abstraction happy
2023-01-20 15:34:39 +00:00
*
*/
void setDetected(uint8_t detected);
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;
};