2025-04-15 22:37:50 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <SPI.h>
|
|
|
|
|
#include <Wire.h>
|
|
|
|
|
|
|
|
|
|
#define ENABLE_GxEPD2_GFX 0
|
|
|
|
|
|
|
|
|
|
#include <GxEPD2_BW.h>
|
|
|
|
|
#include <GxEPD2_3C.h>
|
|
|
|
|
#include <GxEPD2_4C.h>
|
|
|
|
|
#include <GxEPD2_7C.h>
|
|
|
|
|
#include <Fonts/FreeMono9pt7b.h>
|
|
|
|
|
|
|
|
|
|
#define GxEPD2_DISPLAY_CLASS GxEPD2_BW
|
|
|
|
|
#define GxEPD2_DRIVER_CLASS GxEPD2_150_BN // DEPG0150BN 200x200, SSD1681, (FPC8101), TTGO T5 V2.4.1
|
|
|
|
|
|
2025-05-05 08:30:12 +02:00
|
|
|
#include <epd/GxEPD2_150_BN.h> // 1.54" b/w
|
2025-04-15 22:37:50 +02:00
|
|
|
|
|
|
|
|
#include "DisplayDriver.h"
|
|
|
|
|
|
2025-05-05 08:30:12 +02:00
|
|
|
//GxEPD2_BW<GxEPD2_150_BN, 200> display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)); // DEPG0150BN 200x200, SSD1681, TTGO T5 V2.4.1
|
2025-04-15 22:37:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class GxEPDDisplay : public DisplayDriver {
|
|
|
|
|
|
|
|
|
|
GxEPD2_BW<GxEPD2_150_BN, 200> display;
|
|
|
|
|
bool _init = false;
|
2025-04-20 17:10:57 +02:00
|
|
|
bool _isOn = false;
|
2025-04-15 22:37:50 +02:00
|
|
|
|
|
|
|
|
public:
|
2025-04-20 17:10:57 +02:00
|
|
|
// there is a margin in y...
|
2025-05-05 08:30:12 +02:00
|
|
|
GxEPDDisplay() : DisplayDriver(128, 128), display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)) {
|
2025-04-15 22:37:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool begin();
|
|
|
|
|
|
2025-05-05 08:30:12 +02:00
|
|
|
bool isOn() override {return _isOn;};
|
2025-04-15 22:37:50 +02:00
|
|
|
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;
|
2025-05-04 18:17:18 -07:00
|
|
|
uint16_t getTextWidth(const char* str) override;
|
2025-04-15 22:37:50 +02:00
|
|
|
void endFrame() override;
|
|
|
|
|
};
|