Implement some EDIPTFT commands

This commit is contained in:
2022-03-13 18:17:41 +01:00
parent 0eeafa9393
commit f62f264b29
3 changed files with 54 additions and 5 deletions

View File

@ -471,6 +471,22 @@ void EDIPTFT::drawText(uint16_t x1, uint16_t y1, char justification, const char*
}
void EDIPTFT::drawTextInRect(int x1, int y1, int x2, int y2, uint8_t align, const char* text) {
int len_text = strlen(text);
int len = 3 + 8 + 1 + len_text + 1;
char data[len] = {
27, 'Z', 'B', lowByte(x1), highByte(x1), lowByte(y1), highByte(y1),
lowByte(x2), highByte(x2), lowByte(y2), highByte(y2), align
};
for (int i = 0; i < len_text; i++) {
data[3 + 8 + 1 + i] = text[i];
}
data[len - 1] = 0;
sendData(data, len);
}
void EDIPTFT::drawLine(int x1, int y1, int x2, int y2) {
char command [] = {
27,'G','D',
@ -514,6 +530,25 @@ void EDIPTFT::drawRectf(int x1, int y1, int x2, int y2, char color) {
}
void EDIPTFT::clearRect(int x1, int y1, int x2, int y2) {
Serial.print("Clearing ");
Serial.print(x1); Serial.print(", ");
Serial.print(y1); Serial.print(", ");
Serial.print(x2); Serial.print(", ");
Serial.println(y2);
char command [] = {
27, 'R', 'L',
#if COORD_SIZE == 1
x1, y1, x2, y2
#else
lowByte(x1),highByte(x1),lowByte(y1),highByte(y1),
lowByte(x2),highByte(x2),lowByte(y2),highByte(y2),
#endif
};
sendData(command, sizeof(command));
}
void EDIPTFT::defineTouchKey(int x1, int y1, int x2, int y2, char down, char up,
const char* text) { //text nicht const 17
byte len = strlen(text);