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
|
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
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual void display(void) override;
|
2023-01-20 15:34:39 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
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;
|
2020-08-28 22:06:52 +00:00
|
|
|
};
|