acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
RLE_Font_test.ino (4799B)
1 /* 2 Display all the fast rendering fonts. 3 4 This sketch uses the GLCD (font 1) and fonts 2, 4, 6, 7, 8 5 6 Make sure all the display driver and pin connections are correct by 7 editing the User_Setup.h file in the TFT_eSPI library folder. 8 9 ######################################################################### 10 ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ###### 11 ######################################################################### 12 */ 13 14 // New background colour 15 #define TFT_BROWN 0x38E0 16 17 // Pause in milliseconds between screens, change to 0 to time font rendering 18 #define WAIT 500 19 20 #include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip 21 #include <SPI.h> 22 23 TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h 24 25 unsigned long targetTime = 0; // Used for testing draw times 26 27 void setup(void) { 28 tft.init(); 29 tft.setRotation(1); 30 } 31 32 void loop() { 33 targetTime = millis(); 34 35 // First we test them with a background colour set 36 tft.setTextSize(1); 37 tft.fillScreen(TFT_BLACK); 38 tft.setTextColor(TFT_GREEN, TFT_BLACK); 39 40 tft.drawString(" !\"#$%&'()*+,-./0123456", 0, 0, 2); 41 tft.drawString("789:;<=>?@ABCDEFGHIJKL", 0, 16, 2); 42 tft.drawString("MNOPQRSTUVWXYZ[\\]^_`", 0, 32, 2); 43 tft.drawString("abcdefghijklmnopqrstuvw", 0, 48, 2); 44 int xpos = 0; 45 xpos += tft.drawString("xyz{|}~", 0, 64, 2); 46 tft.drawChar(127, xpos, 64, 2); 47 delay(WAIT); 48 49 tft.fillScreen(TFT_BLACK); 50 tft.setTextColor(TFT_GREEN, TFT_BLACK); 51 52 tft.drawString(" !\"#$%&'()*+,-.", 0, 0, 4); 53 tft.drawString("/0123456789:;", 0, 26, 4); 54 tft.drawString("<=>?@ABCDE", 0, 52, 4); 55 tft.drawString("FGHIJKLMNO", 0, 78, 4); 56 tft.drawString("PQRSTUVWX", 0, 104, 4); 57 delay(WAIT); 58 59 tft.fillScreen(TFT_BLACK); 60 tft.drawString("YZ[\\]^_`abc", 0, 0, 4); 61 tft.drawString("defghijklmno", 0, 26, 4); 62 tft.drawString("pqrstuvwxyz", 0, 52, 4); 63 xpos = 0; 64 xpos += tft.drawString("{|}~", 0, 78, 4); 65 tft.drawChar(127, xpos, 78, 4); 66 delay(WAIT); 67 68 tft.fillScreen(TFT_BLACK); 69 tft.setTextColor(TFT_BLUE, TFT_BLACK); 70 71 tft.drawString("012345", 0, 0, 6); 72 tft.drawString("6789", 0, 40, 6); 73 tft.drawString("apm-:.", 0, 80, 6); 74 delay(WAIT); 75 76 tft.fillScreen(TFT_BLACK); 77 tft.setTextColor(TFT_RED, TFT_BLACK); 78 79 tft.drawString("0123", 0, 0, 7); 80 tft.drawString("4567", 0, 60, 7); 81 delay(WAIT); 82 83 tft.fillScreen(TFT_BLACK); 84 tft.drawString("890:.", 0, 0, 7); 85 tft.drawString("", 0, 60, 7); 86 delay(WAIT); 87 88 tft.fillScreen(TFT_BLACK); 89 tft.setTextColor(TFT_YELLOW, TFT_BLACK); 90 91 tft.drawString("01", 0, 0, 8); 92 delay(WAIT); 93 94 tft.drawString("23", 0, 0, 8); 95 delay(WAIT); 96 97 tft.drawString("45", 0, 0, 8); 98 delay(WAIT); 99 100 tft.drawString("67", 0, 0, 8); 101 delay(WAIT); 102 103 tft.drawString("89", 0, 0, 8); 104 delay(WAIT); 105 106 tft.drawString("0:.", 0, 0, 8); 107 delay(WAIT); 108 109 tft.setTextColor(TFT_MAGENTA); 110 tft.drawNumber(millis() - targetTime, 0, 100, 4); 111 delay(4000); 112 113 // Now test them with transparent background 114 targetTime = millis(); 115 116 tft.setTextSize(1); 117 tft.fillScreen(TFT_BROWN); 118 tft.setTextColor(TFT_GREEN); 119 120 tft.drawString(" !\"#$%&'()*+,-./0123456", 0, 0, 2); 121 tft.drawString("789:;<=>?@ABCDEFGHIJKL", 0, 16, 2); 122 tft.drawString("MNOPQRSTUVWXYZ[\\]^_`", 0, 32, 2); 123 tft.drawString("abcdefghijklmnopqrstuvw", 0, 48, 2); 124 xpos = 0; 125 xpos += tft.drawString("xyz{|}~", 0, 64, 2); 126 tft.drawChar(127, xpos, 64, 2); 127 delay(WAIT); 128 129 tft.fillScreen(TFT_BROWN); 130 tft.setTextColor(TFT_GREEN); 131 132 tft.drawString(" !\"#$%&'()*+,-.", 0, 0, 4); 133 tft.drawString("/0123456789:;", 0, 26, 4); 134 tft.drawString("<=>?@ABCDE", 0, 52, 4); 135 tft.drawString("FGHIJKLMNO", 0, 78, 4); 136 tft.drawString("PQRSTUVWX", 0, 104, 4); 137 138 delay(WAIT); 139 tft.fillScreen(TFT_BROWN); 140 tft.drawString("YZ[\\]^_`abc", 0, 0, 4); 141 tft.drawString("defghijklmno", 0, 26, 4); 142 tft.drawString("pqrstuvwxyz", 0, 52, 4); 143 xpos = 0; 144 xpos += tft.drawString("{|}~", 0, 78, 4); 145 tft.drawChar(127, xpos, 78, 4); 146 delay(WAIT); 147 148 tft.fillScreen(TFT_BROWN); 149 tft.setTextColor(TFT_BLUE); 150 151 tft.drawString("012345", 0, 0, 6); 152 tft.drawString("6789", 0, 40, 6); 153 tft.drawString("apm-:.", 0, 80, 6); 154 delay(WAIT); 155 156 tft.fillScreen(TFT_BROWN); 157 tft.setTextColor(TFT_RED); 158 159 tft.drawString("0123", 0, 0, 7); 160 tft.drawString("4567", 0, 60, 7); 161 delay(WAIT); 162 163 tft.fillScreen(TFT_BROWN); 164 tft.drawString("890:.", 0, 0, 7); 165 tft.drawString("", 0, 60, 7); 166 delay(WAIT); 167 168 tft.fillScreen(TFT_BROWN); 169 tft.setTextColor(TFT_YELLOW); 170 171 tft.drawString("0123", 0, 0, 8); 172 delay(WAIT); 173 174 tft.fillScreen(TFT_BROWN); 175 tft.drawString("4567", 0, 0, 8); 176 delay(WAIT); 177 178 tft.fillScreen(TFT_BROWN); 179 tft.drawString("890:.", 0, 0, 8); 180 delay(WAIT); 181 182 tft.setTextColor(TFT_MAGENTA); 183 184 tft.drawNumber(millis() - targetTime, 0, 100, 4); 185 delay(4000);; 186 } 187