Files
firmware/src/graphics/EInkDisplay.h

49 lines
1.5 KiB
C
Raw Normal View History

2020-08-17 13:47:05 -07:00
#pragma once
2020-08-28 15:06:52 -07: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)
* implement displayOn/displayOff to turn off the TFT device (and backlight)
* 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
*/
2020-09-26 09:40:48 -07:00
class EInkDisplay : public OLEDDisplay
2020-08-28 15:06:52 -07:00
{
2020-10-16 10:53:55 +08:00
/// How often should we update the display
2020-10-15 15:56:38 +08:00
/// thereafter we do once per 5 minutes
2020-10-16 10:53:55 +08:00
uint32_t slowUpdateMsec = 5 * 60 * 1000;
2020-10-15 15:56:38 +08:00
2020-08-28 15:06:52 -07:00
public:
/* constructor
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
*/
2020-09-26 09:40:48 -07:00
EInkDisplay(uint8_t address, int sda, int scl);
2020-08-28 15:06:52 -07:00
2020-10-15 15:56:38 +08:00
// Write the buffer to the display memory (for eink we only do this occasionally)
2020-08-28 15:06:52 -07:00
virtual void display(void);
2020-10-15 15:56:38 +08:00
/**
* Force a display update if we haven't drawn within the specified msecLimit
*
* @return true if we did draw the screen
*/
2020-10-16 10:53:55 +08:00
bool forceDisplay(uint32_t msecLimit = 1000);
2020-10-15 15:56:38 +08:00
2020-08-28 15:06:52 -07:00
protected:
// the header size of the buffer used, e.g. for the SPI command header
virtual int getBufferOffset(void) { return 0; }
// Send a command to the display (low level function)
virtual void sendCommand(uint8_t com);
// Connect to the display
virtual bool connect();
};
2020-10-15 15:56:38 +08:00