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

AsciiTable.ino (3412B)

      1 /*
      2    ASCII Table
      3    Arduino_GFX using the 'classic' fixed-space bitmap font for Adafruit_GFX
      4    This font using CP437 encoding (Extended ASCII)
      5    https://en.wikipedia.org/wiki/Extended_ASCII
      6 */
      7 /*******************************************************************************
      8  * Start of Arduino_GFX setting
      9  * 
     10  * Arduino_GFX try to find the settings depends on selected board in Arduino IDE
     11  * Or you can define the display dev kit not in the board list
     12  * Defalult pin list for non display dev kit:
     13  * Arduino Nano, Micro and more: CS:  9, DC:  8, RST:  7, BL:  6, SCK: 13, MOSI: 11, MISO: 12
     14  * ESP32 various dev board     : CS:  5, DC: 27, RST: 33, BL: 22, SCK: 18, MOSI: 23, MISO: nil
     15  * ESP32-C3 various dev board  : CS:  7, DC:  2, RST:  1, BL:  3, SCK:  4, MOSI:  6, MISO: nil
     16  * ESP32-S2 various dev board  : CS: 34, DC: 38, RST: 33, BL: 21, SCK: 36, MOSI: 35, MISO: nil
     17  * ESP32-S3 various dev board  : CS: 40, DC: 41, RST: 42, BL: 48, SCK: 36, MOSI: 35, MISO: nil
     18  * ESP8266 various dev board   : CS: 15, DC:  4, RST:  2, BL:  5, SCK: 14, MOSI: 13, MISO: 12
     19  * Raspberry Pi Pico dev board : CS: 17, DC: 27, RST: 26, BL: 28, SCK: 18, MOSI: 19, MISO: 16
     20  * RTL8720 BW16 old patch core : CS: 18, DC: 17, RST:  2, BL: 23, SCK: 19, MOSI: 21, MISO: 20
     21  * RTL8720_BW16 Official core  : CS:  9, DC:  8, RST:  6, BL:  3, SCK: 10, MOSI: 12, MISO: 11
     22  * RTL8722 dev board           : CS: 18, DC: 17, RST: 22, BL: 23, SCK: 13, MOSI: 11, MISO: 12
     23  * RTL8722_mini dev board      : CS: 12, DC: 14, RST: 15, BL: 13, SCK: 11, MOSI:  9, MISO: 10
     24  * Seeeduino XIAO dev board    : CS:  3, DC:  2, RST:  1, BL:  0, SCK:  8, MOSI: 10, MISO:  9
     25  * Teensy 4.1 dev board        : CS: 39, DC: 41, RST: 40, BL: 22, SCK: 13, MOSI: 11, MISO: 12
     26  ******************************************************************************/
     27 #include <Arduino_GFX_Library.h>
     28 
     29 #define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin
     30 
     31 /* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
     32 #if defined(DISPLAY_DEV_KIT)
     33 Arduino_GFX *gfx = create_default_Arduino_GFX();
     34 #else /* !defined(DISPLAY_DEV_KIT) */
     35 
     36 /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
     37 Arduino_DataBus *bus = create_default_Arduino_DataBus();
     38 
     39 /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
     40 Arduino_GFX *gfx = new Arduino_ILI9341(bus, DF_GFX_RST, 0 /* rotation */, false /* IPS */);
     41 
     42 #endif /* !defined(DISPLAY_DEV_KIT) */
     43 /*******************************************************************************
     44  * End of Arduino_GFX setting
     45  ******************************************************************************/
     46 
     47 void setup(void)
     48 {
     49     gfx->begin();
     50     gfx->fillScreen(BLACK);
     51 
     52 #ifdef GFX_BL
     53     pinMode(GFX_BL, OUTPUT);
     54     digitalWrite(GFX_BL, HIGH);
     55 #endif
     56 
     57     gfx->setTextColor(GREEN);
     58     for (int x = 0; x < 16; x++)
     59     {
     60         gfx->setCursor(10 + x * 8, 2);
     61         gfx->print(x, 16);
     62     }
     63     gfx->setTextColor(BLUE);
     64     for (int y = 0; y < 16; y++)
     65     {
     66         gfx->setCursor(2, 12 + y * 10);
     67         gfx->print(y, 16);
     68     }
     69 
     70     char c = 0;
     71     for (int y = 0; y < 16; y++)
     72     {
     73         for (int x = 0; x < 16; x++)
     74         {
     75             gfx->drawChar(10 + x * 8, 12 + y * 10, c++, WHITE, BLACK);
     76         }
     77     }
     78 
     79     delay(5000); // 5 seconds
     80 }
     81 
     82 void loop()
     83 {
     84 }