#pragma once #include #include #define ENABLE_GxEPD2_GFX 0 #include #include #include #include #include #include #include #include // 1.54" b/w #include // 2.13" b/w #include #include "DisplayDriver.h" //GxEPD2_BW display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)); // DEPG0150BN 200x200, SSD1681, TTGO T5 V2.4.1 class GxEPDDisplay : public DisplayDriver { #if defined(EINK_DISPLAY_MODEL) GxEPD2_BW display; const float scale_x = EINK_SCALE_X; const float scale_y = EINK_SCALE_Y; const float offset_x = EINK_X_OFFSET; const float offset_y = EINK_Y_OFFSET; #else GxEPD2_BW display; const float scale_x = 1.5625f; const float scale_y = 1.5625f; const float offset_x = 0; const float offset_y = 10; #endif bool _init = false; bool _isOn = false; uint16_t _curr_color; CRC32 display_crc; int last_display_crc_value = 0; public: // there is a margin in y... #if defined(EINK_DISPLAY_MODEL) GxEPDDisplay() : DisplayDriver(128, 128), display(EINK_DISPLAY_MODEL(PIN_DISPLAY_CS, PIN_DISPLAY_DC, PIN_DISPLAY_RST, PIN_DISPLAY_BUSY)) {} #else GxEPDDisplay() : DisplayDriver(128, 128), display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)) {} #endif bool begin(); bool isOn() override {return _isOn;}; void turnOn() override; void turnOff() override; void clear() override; void startFrame(Color bkg = DARK) override; void setTextSize(int sz) override; void setColor(Color c) override; void setCursor(int x, int y) override; void print(const char* str) override; void fillRect(int x, int y, int w, int h) override; void drawRect(int x, int y, int w, int h) override; void drawXbm(int x, int y, const uint8_t* bits, int w, int h) override; uint16_t getTextWidth(const char* str) override; void endFrame() override; };