diff --git a/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h b/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h index f3384a5..7e99512 100644 --- a/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h +++ b/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h @@ -4,11 +4,6 @@ #include "FT18_STW_INIT.h" #ifndef FT18_STW_DISPLAY_h #define FT18_STW_DISPLAY_h - - #define EA_BLACK 1 - #define EA_RED 3 - #define EA_GREY 10 - #define EA_WHITE 8 #define MOSI 75 #define MISO 74 diff --git a/lib/arduino-ediptft-master/EDIPTFT.cpp b/lib/arduino-ediptft-master/EDIPTFT.cpp index 83a72ed..66a1168 100644 --- a/lib/arduino-ediptft-master/EDIPTFT.cpp +++ b/lib/arduino-ediptft-master/EDIPTFT.cpp @@ -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); diff --git a/lib/arduino-ediptft-master/EDIPTFT.h b/lib/arduino-ediptft-master/EDIPTFT.h index c494752..5a0cd89 100644 --- a/lib/arduino-ediptft-master/EDIPTFT.h +++ b/lib/arduino-ediptft-master/EDIPTFT.h @@ -37,6 +37,7 @@ #define COORD_SIZE DEVICE //Byte count for coordinates #define SERIAL_DEV Serial3 +#define EA_TRANSPARENT 0 #define EA_BLACK 1 #define EA_BLUE 2 #define EA_RED 3 @@ -252,6 +253,21 @@ class EDIPTFT { */ void drawText(uint16_t x1, uint16_t y1, char justification, const char* text); + /*! \brief Draw text on display in an area + * + * Draw a *text* on screen. Several lines are separated by the character `|` + * ($7C). + * * place text between `~`: characters flash on/off + * * place text between `@`: characters flash inversely + * * use `\\` as to escape special characters + * + * \param align set alignment in the rectangle. 1 = top left, 2 = top + * center, 3 = top right, 4 = center left, 5 = center, 6 = center right, 7 = + * bottom left, 8 = bottom center, 9 = bottom right. + * \param text text to draw on display + */ + void drawTextInRect(int x1, int y1, int x2, int y2, uint8_t align, const char* text); + // Rectangle and Line void setLineColor(char fg, char bg); @@ -276,6 +292,9 @@ class EDIPTFT { void drawRectf(int x1, int y1, int x2, int y2, char color); + /*! \brief Clear rectangular area */ + void clearRect(int x1, int y1, int x2, int y2); + // Touch keys /*! \brief Define touch key