firmware/src/graphics/TFTDisplay.h

42 lines
1.2 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 TFT_eSPI 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?
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
2022-01-24 17:24:40 +00:00
virtual void display(void) override;
2023-01-20 15:34:39 +00:00
/**
* 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
void getTouch(int *x, int *y);
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;
};