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 |
HelloWorldGfxfont.ino (3498B)
1 /******************************************************************************* 2 * Start of Arduino_GFX setting 3 * 4 * Arduino_GFX try to find the settings depends on selected board in Arduino IDE 5 * Or you can define the display dev kit not in the board list 6 * Defalult pin list for non display dev kit: 7 * Arduino Nano, Micro and more: CS: 9, DC: 8, RST: 7, BL: 6, SCK: 13, MOSI: 11, MISO: 12 8 * ESP32 various dev board : CS: 5, DC: 27, RST: 33, BL: 22, SCK: 18, MOSI: 23, MISO: nil 9 * ESP32-C3 various dev board : CS: 7, DC: 2, RST: 1, BL: 3, SCK: 4, MOSI: 6, MISO: nil 10 * ESP32-S2 various dev board : CS: 34, DC: 38, RST: 33, BL: 21, SCK: 36, MOSI: 35, MISO: nil 11 * ESP32-S3 various dev board : CS: 40, DC: 41, RST: 42, BL: 48, SCK: 36, MOSI: 35, MISO: nil 12 * ESP8266 various dev board : CS: 15, DC: 4, RST: 2, BL: 5, SCK: 14, MOSI: 13, MISO: 12 13 * Raspberry Pi Pico dev board : CS: 17, DC: 27, RST: 26, BL: 28, SCK: 18, MOSI: 19, MISO: 16 14 * RTL8720 BW16 old patch core : CS: 18, DC: 17, RST: 2, BL: 23, SCK: 19, MOSI: 21, MISO: 20 15 * RTL8720_BW16 Official core : CS: 9, DC: 8, RST: 6, BL: 3, SCK: 10, MOSI: 12, MISO: 11 16 * RTL8722 dev board : CS: 18, DC: 17, RST: 22, BL: 23, SCK: 13, MOSI: 11, MISO: 12 17 * RTL8722_mini dev board : CS: 12, DC: 14, RST: 15, BL: 13, SCK: 11, MOSI: 9, MISO: 10 18 * Seeeduino XIAO dev board : CS: 3, DC: 2, RST: 1, BL: 0, SCK: 8, MOSI: 10, MISO: 9 19 * Teensy 4.1 dev board : CS: 39, DC: 41, RST: 40, BL: 22, SCK: 13, MOSI: 11, MISO: 12 20 ******************************************************************************/ 21 #include <Arduino_GFX_Library.h> 22 23 #define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin 24 25 /* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */ 26 #if defined(DISPLAY_DEV_KIT) 27 Arduino_GFX *gfx = create_default_Arduino_GFX(); 28 #else /* !defined(DISPLAY_DEV_KIT) */ 29 30 /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */ 31 Arduino_DataBus *bus = create_default_Arduino_DataBus(); 32 33 /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */ 34 Arduino_GFX *gfx = new Arduino_ILI9341(bus, DF_GFX_RST, 0 /* rotation */, false /* IPS */); 35 36 #endif /* !defined(DISPLAY_DEV_KIT) */ 37 /******************************************************************************* 38 * End of Arduino_GFX setting 39 ******************************************************************************/ 40 41 /* more fonts at: https://github.com/moononournation/ArduinoFreeFontFile.git */ 42 #include "FreeMono8pt7b.h" 43 #include "FreeSansBold10pt7b.h" 44 #include "FreeSerifBoldItalic12pt7b.h" 45 46 void setup(void) 47 { 48 gfx->begin(); 49 gfx->fillScreen(BLACK); 50 51 #ifdef GFX_BL 52 pinMode(GFX_BL, OUTPUT); 53 digitalWrite(GFX_BL, HIGH); 54 #endif 55 56 gfx->setCursor(10, 10); 57 gfx->setFont(&FreeMono8pt7b); 58 gfx->setTextColor(RED); 59 gfx->println("Hello World!"); 60 61 delay(5000); // 5 seconds 62 } 63 64 void loop() 65 { 66 gfx->setCursor(random(gfx->width()), random(gfx->height())); 67 gfx->setTextColor(random(0xffff)); 68 uint8_t textSize = random(3); 69 switch (textSize) 70 { 71 case 1: 72 gfx->setFont(&FreeMono8pt7b); 73 break; 74 case 2: 75 gfx->setFont(&FreeSansBold10pt7b); 76 break; 77 default: 78 gfx->setFont(&FreeSerifBoldItalic12pt7b); 79 break; 80 } 81 82 gfx->println("Hello World!"); 83 84 delay(1000); // 1 second 85 }