|
|
|
@ -6,22 +6,33 @@ bool GxEPDDisplay::begin() { |
|
|
|
SPI1.begin(); |
|
|
|
display.init(115200, true, 2, false); |
|
|
|
display.setRotation(3); |
|
|
|
display.setFont(&FreeMono9pt7b); |
|
|
|
|
|
|
|
#ifdef TECHO_ZOOM |
|
|
|
display.setFont(&FreeMono9pt7b); |
|
|
|
#endif |
|
|
|
display.setPartialWindow(0, 0, display.width(), display.height()); |
|
|
|
|
|
|
|
display.fillScreen(GxEPD_WHITE); |
|
|
|
display.display(true); |
|
|
|
#if DISP_BACKLIGHT |
|
|
|
pinMode(DISP_BACKLIGHT, OUTPUT); |
|
|
|
#endif |
|
|
|
_init = true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::turnOn() { |
|
|
|
if (!_init) begin(); |
|
|
|
#if DISP_BACKLIGHT |
|
|
|
digitalWrite(DISP_BACKLIGHT, HIGH); |
|
|
|
_isOn = true; |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::turnOff() { |
|
|
|
|
|
|
|
#if DISP_BACKLIGHT |
|
|
|
digitalWrite(DISP_BACKLIGHT, LOW); |
|
|
|
#endif |
|
|
|
_isOn = false; |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::clear() { |
|
|
|
@ -34,6 +45,7 @@ void GxEPDDisplay::startFrame(Color bkg) { |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::setTextSize(int sz) { |
|
|
|
display.setTextSize(sz); |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::setColor(Color c) { |
|
|
|
@ -41,7 +53,11 @@ void GxEPDDisplay::setColor(Color c) { |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::setCursor(int x, int y) { |
|
|
|
display.setCursor(x*1.5, (y*1.5)+10); |
|
|
|
#ifdef TECHO_ZOOM |
|
|
|
x = x + (x >> 1); |
|
|
|
y = y + (y >> 1); |
|
|
|
#endif |
|
|
|
display.setCursor(x, (y+10)); |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::print(const char* str) { |
|
|
|
@ -49,12 +65,32 @@ void GxEPDDisplay::print(const char* str) { |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::fillRect(int x, int y, int w, int h) { |
|
|
|
#ifdef TECHO_ZOOM |
|
|
|
x = x + (x >> 1); |
|
|
|
y = y + (y >> 1); |
|
|
|
w = w + (w >> 1); |
|
|
|
h = h + (h >> 1); |
|
|
|
#endif |
|
|
|
display.fillRect(x, y, w, h, GxEPD_BLACK); |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::drawRect(int x, int y, int w, int h) { |
|
|
|
#ifdef TECHO_ZOOM |
|
|
|
x = x + (x >> 1); |
|
|
|
y = y + (y >> 1); |
|
|
|
w = w + (w >> 1); |
|
|
|
h = h + (h >> 1); |
|
|
|
#endif |
|
|
|
display.drawRect(x, y, w, h, GxEPD_BLACK); |
|
|
|
} |
|
|
|
|
|
|
|
void GxEPDDisplay::drawXbm(int x, int y, const uint8_t* bits, int w, int h) { |
|
|
|
#ifdef TECHO_ZOOM |
|
|
|
x = x + (x >> 1); |
|
|
|
y = y + (y >> 1); |
|
|
|
w = w + (w >> 1); |
|
|
|
h = h + (h >> 1); |
|
|
|
#endif |
|
|
|
display.drawBitmap(x*1.5, (y*1.5) + 10, bits, w, h, GxEPD_BLACK); |
|
|
|
} |
|
|
|
|
|
|
|
|