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 (8068B)

      1 /*
      2  Display all the fonts.
      3 
      4  This sketch uses the GLCD (font 1) and fonts 2, 4, 6, 7, 8
      5  
      6  #########################################################################
      7  ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
      8  ######       TO SELECT THE FONTS AND PINS YOU USE, SEE ABOVE       ######
      9  #########################################################################
     10 
     11  */
     12 
     13 // New background colour
     14 #define TFT_BROWN 0x38E0
     15 
     16 // Pause in milliseconds between screens, change to 0 to time font rendering
     17 #define WAIT 1000
     18 
     19 #include <TFT_eSPI.h> // Graphics and font library for ILI9341 driver chip
     20 #include <SPI.h>
     21 
     22 TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h
     23 
     24 unsigned long targetTime = 0; // Used for testing draw times
     25 
     26 void setup(void) {
     27   tft.init();
     28   tft.setRotation(1);
     29 }
     30 
     31 void loop() {
     32   targetTime = millis();
     33 
     34   // First we test them with a background colour set
     35   tft.setTextSize(1);
     36   tft.fillScreen(TFT_BLACK);
     37   tft.setTextColor(TFT_GREEN, TFT_BLACK);
     38 
     39   tft.drawString(" !\"#$%&'()*+,-./0123456", 0, 0, 2);
     40   tft.drawString("789:;<=>?@ABCDEFGHIJKL", 0, 16, 2);
     41   tft.drawString("MNOPQRSTUVWXYZ[\\]^_`", 0, 32, 2);
     42   tft.drawString("abcdefghijklmnopqrstuvw", 0, 48, 2);
     43   int xpos = 0;
     44   xpos += tft.drawString("xyz{|}~", 0, 64, 2);
     45   tft.drawChar(127, xpos, 64, 2);
     46   delay(WAIT);
     47 
     48   tft.fillScreen(TFT_BLACK);
     49   tft.setTextColor(TFT_GREEN, TFT_BLACK);
     50 
     51   tft.drawString(" !\"#$%&'()*+,-.", 0, 0, 4);
     52   tft.drawString("/0123456789:;", 0, 26, 4);
     53   tft.drawString("<=>?@ABCDE", 0, 52, 4);
     54   tft.drawString("FGHIJKLMNO", 0, 78, 4);
     55   tft.drawString("PQRSTUVWX", 0, 104, 4);
     56   delay(WAIT);
     57 
     58   tft.fillScreen(TFT_BLACK);
     59   tft.drawString("YZ[\\]^_`abc", 0, 0, 4);
     60   tft.drawString("defghijklmno", 0, 26, 4);
     61   tft.drawString("pqrstuvwxyz", 0, 52, 4);
     62   xpos = 0;
     63   xpos += tft.drawString("{|}~", 0, 78, 4);
     64   tft.drawChar(127, xpos, 78, 4);
     65   delay(WAIT);
     66 
     67   tft.fillScreen(TFT_BLACK);
     68   tft.setTextColor(TFT_BLUE, TFT_BLACK);
     69 
     70   tft.drawString("012345", 0, 0, 6);
     71   tft.drawString("6789", 0, 40, 6);
     72   tft.drawString("apm-:.", 0, 80, 6);
     73   delay(WAIT);
     74 
     75   tft.fillScreen(TFT_BLACK);
     76   tft.setTextColor(TFT_RED, TFT_BLACK);
     77 
     78   tft.drawString("0123", 0, 0, 7);
     79   tft.drawString("4567", 0, 60, 7);
     80   delay(WAIT);
     81 
     82   tft.fillScreen(TFT_BLACK);
     83   tft.drawString("890:.", 0, 0, 7);
     84   tft.drawString("", 0, 60, 7);
     85   delay(WAIT);
     86 
     87   tft.fillScreen(TFT_BLACK);
     88   tft.setTextColor(TFT_YELLOW, TFT_BLACK);
     89 
     90   tft.drawString("0123", 0, 0, 8);
     91   tft.drawString("4567", 0, 72, 8);
     92   delay(WAIT);;
     93 
     94   tft.fillScreen(TFT_BLACK);
     95   tft.drawString("890:.", 0, 0, 8);
     96   tft.drawString("", 0, 72, 8);
     97   delay(WAIT);;
     98 
     99   tft.setTextSize(2);
    100   tft.fillScreen(TFT_BLACK);
    101   tft.setTextColor(TFT_GREEN, TFT_BLACK);
    102 
    103   tft.drawString(" !\"#$%&'()*+,-./0123456", 0, 0, 2);
    104   tft.drawString("789:;<=>?@ABCDEFGHIJKL", 0, 32, 2);
    105   tft.drawString("MNOPQRSTUVWXYZ[\\]^_`", 0, 64, 2);
    106   tft.drawString("abcdefghijklmnopqrstuvw", 0, 96, 2);
    107   xpos = 0;
    108   xpos += tft.drawString("xyz{|}~", 0, 128, 2);
    109   tft.drawChar(127, xpos, 128, 2);
    110   delay(WAIT);
    111 
    112   tft.fillScreen(TFT_BLACK);
    113   tft.setTextColor(TFT_GREEN, TFT_BLACK);
    114 
    115   tft.drawString(" !\"#$%&'()*+,-.", 0, 0, 4);
    116   tft.drawString("/0123456789:;", 0, 52, 4);
    117   tft.drawString("<=>?@ABCDE", 0, 104, 4);
    118   tft.drawString("FGHIJKLMNO", 0, 156, 4);
    119   tft.drawString("PQRSTUVWX", 0, 208, 4);
    120   delay(WAIT);
    121   tft.fillScreen(TFT_BLACK);
    122   tft.drawString("YZ[\\]^_`abc", 0, 0, 4);
    123   tft.drawString("defghijklmno", 0, 52, 4);
    124   tft.drawString("pqrstuvwxyz", 0, 104, 4);
    125   xpos = 0;
    126   xpos += tft.drawString("{|}~", 0, 156, 4);
    127   tft.drawChar(127, xpos, 156, 4);
    128   delay(WAIT);
    129 
    130   tft.fillScreen(TFT_BLACK);
    131   tft.setTextColor(TFT_BLUE, TFT_BLACK);
    132 
    133   tft.drawString("01234", 0, 0, 6);
    134   tft.drawString("56789", 0, 80, 6);
    135   tft.drawString("apm-:.", 0, 160, 6);
    136   delay(WAIT);
    137 
    138   tft.fillScreen(TFT_BLACK);
    139   tft.setTextColor(TFT_RED, TFT_BLACK);
    140 
    141   tft.drawString("0123", 0, 0, 7);
    142   tft.drawString("4567", 0, 120, 7);
    143   delay(WAIT);
    144 
    145   tft.fillScreen(TFT_BLACK);
    146   tft.drawString("890:.", 0, 0, 7);
    147   tft.drawString("", 0, 120, 7);
    148   delay(WAIT);
    149 
    150   tft.fillScreen(TFT_BLACK);
    151   tft.setTextColor(TFT_YELLOW, TFT_BLACK);
    152 
    153   tft.drawString("0123", 0, 0, 8);
    154   tft.drawString("4567", 0, 144, 8);
    155   delay(WAIT);;
    156 
    157   tft.fillScreen(TFT_BLACK);
    158   tft.drawString("890:.", 0, 0, 8);
    159   tft.drawString("", 0, 144, 8);
    160   delay(WAIT);;
    161 
    162   tft.setTextColor(TFT_MAGENTA, TFT_BROWN);
    163 
    164   tft.drawNumber(millis() - targetTime, 0, 180, 4);
    165   delay(4000);;
    166 
    167   // Now test them with transparent background
    168   targetTime = millis();
    169 
    170   tft.setTextSize(1);
    171   tft.fillScreen(TFT_BROWN);
    172   tft.setTextColor(TFT_GREEN);
    173 
    174   tft.drawString(" !\"#$%&'()*+,-./0123456", 0, 0, 2);
    175   tft.drawString("789:;<=>?@ABCDEFGHIJKL", 0, 16, 2);
    176   tft.drawString("MNOPQRSTUVWXYZ[\\]^_`", 0, 32, 2);
    177   tft.drawString("abcdefghijklmnopqrstuvw", 0, 48, 2);
    178   xpos = 0;
    179   xpos += tft.drawString("xyz{|}~", 0, 64, 2);
    180   tft.drawChar(127, xpos, 64, 2);
    181   delay(WAIT);
    182 
    183   tft.fillScreen(TFT_BROWN);
    184   tft.setTextColor(TFT_GREEN);
    185 
    186   tft.drawString(" !\"#$%&'()*+,-.", 0, 0, 4);
    187   tft.drawString("/0123456789:;", 0, 26, 4);
    188   tft.drawString("<=>?@ABCDE", 0, 52, 4);
    189   tft.drawString("FGHIJKLMNO", 0, 78, 4);
    190   tft.drawString("PQRSTUVWX", 0, 104, 4);
    191 
    192   delay(WAIT);
    193   tft.fillScreen(TFT_BROWN);
    194   tft.drawString("YZ[\\]^_`abc", 0, 0, 4);
    195   tft.drawString("defghijklmno", 0, 26, 4);
    196   tft.drawString("pqrstuvwxyz", 0, 52, 4);
    197   xpos = 0;
    198   xpos += tft.drawString("{|}~", 0, 78, 4);
    199   tft.drawChar(127, xpos, 78, 4);
    200   delay(WAIT);
    201 
    202   tft.fillScreen(TFT_BROWN);
    203   tft.setTextColor(TFT_BLUE);
    204 
    205   tft.drawString("012345", 0, 0, 6);
    206   tft.drawString("6789", 0, 40, 6);
    207   tft.drawString("apm-:.", 0, 80, 6);
    208   delay(WAIT);
    209 
    210   tft.fillScreen(TFT_BROWN);
    211   tft.setTextColor(TFT_RED);
    212 
    213   tft.drawString("0123", 0, 0, 7);
    214   tft.drawString("4567", 0, 60, 7);
    215   delay(WAIT);
    216 
    217   tft.fillScreen(TFT_BROWN);
    218   tft.drawString("890:.", 0, 0, 7);
    219   tft.drawString("", 0, 60, 7);
    220   delay(WAIT);
    221 
    222   tft.fillScreen(TFT_BROWN);
    223   tft.setTextColor(TFT_YELLOW);
    224 
    225   tft.drawString("0123", 0, 0, 8);
    226   tft.drawString("4567", 0, 72, 8);
    227   delay(WAIT);
    228 
    229   tft.fillScreen(TFT_BROWN);
    230   tft.drawString("890:.", 0, 0, 8);
    231   tft.drawString("", 0, 72, 8);
    232   delay(WAIT);
    233 
    234   tft.setTextSize(2);
    235   tft.fillScreen(TFT_BROWN);
    236   tft.setTextColor(TFT_GREEN);
    237 
    238   tft.drawString(" !\"#$%&'()*+,-./0123456", 0, 0, 2);
    239   tft.drawString("789:;<=>?@ABCDEFGHIJKL", 0, 32, 2);
    240   tft.drawString("MNOPQRSTUVWXYZ[\\]^_`", 0, 64, 2);
    241   tft.drawString("abcdefghijklmnopqrstuvw", 0, 96, 2);
    242   xpos = 0;
    243   xpos += tft.drawString("xyz{|}~", 0, 128, 2);
    244   tft.drawChar(127, xpos, 128, 2);
    245   delay(WAIT);
    246 
    247   tft.fillScreen(TFT_BROWN);
    248   tft.setTextColor(TFT_GREEN);
    249 
    250   tft.drawString(" !\"#$%&'()*+,-.", 0, 0, 4);
    251   tft.drawString("/0123456789:;", 0, 52, 4);
    252   tft.drawString("<=>?@ABCDE", 0, 104, 4);
    253   tft.drawString("FGHIJKLMNO", 0, 156, 4);
    254   tft.drawString("PQRSTUVWX", 0, 208, 4);
    255   delay(WAIT);
    256   tft.fillScreen(TFT_BROWN);
    257   tft.drawString("YZ[\\]^_`abc", 0, 0, 4);
    258   tft.drawString("defghijklmno", 0, 52, 4);
    259   tft.drawString("pqrstuvwxyz", 0, 104, 4);
    260   xpos = 0;
    261   xpos += tft.drawString("{|}~", 0, 156, 4);
    262   tft.drawChar(127, xpos, 156, 4);
    263   delay(WAIT);
    264 
    265   tft.fillScreen(TFT_BROWN);
    266   tft.setTextColor(TFT_BLUE);
    267 
    268   tft.drawString("01234", 0, 0, 6);
    269   tft.drawString("56789", 0, 80, 6);
    270   tft.drawString("apm-:.", 0, 160, 6);
    271   delay(WAIT);
    272 
    273   tft.fillScreen(TFT_BROWN);
    274   tft.setTextColor(TFT_RED);
    275 
    276   tft.drawString("0123", 0, 0, 7);
    277   tft.drawString("4567", 0, 120, 7);
    278   delay(WAIT);
    279 
    280   tft.fillScreen(TFT_BROWN);
    281   tft.drawString("890:.", 0, 0, 7);
    282   tft.drawString("", 0, 120, 7);
    283   delay(WAIT);
    284 
    285   tft.fillScreen(TFT_BROWN);
    286   tft.setTextColor(TFT_YELLOW);
    287 
    288   tft.drawString("0123", 0, 0, 8);
    289   tft.drawString("4567", 0, 144, 8);
    290   delay(WAIT);;
    291 
    292   tft.fillScreen(TFT_BROWN);
    293   tft.drawString("890:.", 0, 0, 8);
    294   tft.drawString("", 0, 144, 8);
    295   delay(WAIT);;
    296 
    297   tft.setTextColor(TFT_MAGENTA);
    298 
    299   tft.drawNumber(millis() - targetTime, 0, 180, 4);
    300   delay(4000);;
    301 }
    302