|
|
@ -1,4 +1,5 @@ |
|
|
#include "E213Display.h" |
|
|
#include "E213Display.h" |
|
|
|
|
|
|
|
|
#include "../../MeshCore.h" |
|
|
#include "../../MeshCore.h" |
|
|
|
|
|
|
|
|
bool E213Display::begin() { |
|
|
bool E213Display::begin() { |
|
|
@ -20,17 +21,17 @@ bool E213Display::begin() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void E213Display::powerOn() { |
|
|
void E213Display::powerOn() { |
|
|
#ifdef PIN_VEXT_EN |
|
|
#ifdef PIN_VEXT_EN |
|
|
pinMode(PIN_VEXT_EN, OUTPUT); |
|
|
pinMode(PIN_VEXT_EN, OUTPUT); |
|
|
digitalWrite(PIN_VEXT_EN, LOW); // Active low
|
|
|
digitalWrite(PIN_VEXT_EN, LOW); // Active low
|
|
|
delay(50); // Allow power to stabilize
|
|
|
delay(50); // Allow power to stabilize
|
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void E213Display::powerOff() { |
|
|
void E213Display::powerOff() { |
|
|
#ifdef PIN_VEXT_EN |
|
|
#ifdef PIN_VEXT_EN |
|
|
digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
|
|
|
digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
|
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void E213Display::turnOn() { |
|
|
void E213Display::turnOn() { |
|
|
@ -70,7 +71,7 @@ void E213Display::setCursor(int x, int y) { |
|
|
display.setCursor(x, y); |
|
|
display.setCursor(x, y); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void E213Display::print(const char* str) { |
|
|
void E213Display::print(const char *str) { |
|
|
display.print(str); |
|
|
display.print(str); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -82,7 +83,7 @@ void E213Display::drawRect(int x, int y, int w, int h) { |
|
|
display.drawRect(x, y, w, h, BLACK); |
|
|
display.drawRect(x, y, w, h, BLACK); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void E213Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) { |
|
|
void E213Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) { |
|
|
// Width in bytes for bitmap processing
|
|
|
// Width in bytes for bitmap processing
|
|
|
uint16_t widthInBytes = (w + 7) / 8; |
|
|
uint16_t widthInBytes = (w + 7) / 8; |
|
|
|
|
|
|
|
|
@ -103,7 +104,7 @@ void E213Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uint16_t E213Display::getTextWidth(const char* str) { |
|
|
uint16_t E213Display::getTextWidth(const char *str) { |
|
|
int16_t x1, y1; |
|
|
int16_t x1, y1; |
|
|
uint16_t w, h; |
|
|
uint16_t w, h; |
|
|
display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h); |
|
|
display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h); |
|
|
@ -113,4 +114,3 @@ uint16_t E213Display::getTextWidth(const char* str) { |
|
|
void E213Display::endFrame() { |
|
|
void E213Display::endFrame() { |
|
|
display.update(); |
|
|
display.update(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|