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 |
U8g2FontHelloWorld.ino (3220B)
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 <U8g2lib.h> 22 #include <Arduino_GFX_Library.h> 23 24 #define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin 25 26 /* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */ 27 #if defined(DISPLAY_DEV_KIT) 28 Arduino_GFX *gfx = create_default_Arduino_GFX(); 29 #else /* !defined(DISPLAY_DEV_KIT) */ 30 31 /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */ 32 Arduino_DataBus *bus = create_default_Arduino_DataBus(); 33 34 /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */ 35 Arduino_GFX *gfx = new Arduino_ILI9341(bus, DF_GFX_RST, 0 /* rotation */, false /* IPS */); 36 37 #endif /* !defined(DISPLAY_DEV_KIT) */ 38 /******************************************************************************* 39 * End of Arduino_GFX setting 40 ******************************************************************************/ 41 42 /* more fonts at: https://github.com/moononournation/ArduinoFreeFontFile.git */ 43 44 void setup(void) 45 { 46 gfx->begin(); 47 gfx->fillScreen(BLACK); 48 49 #ifdef GFX_BL 50 pinMode(GFX_BL, OUTPUT); 51 digitalWrite(GFX_BL, HIGH); 52 #endif 53 54 gfx->setCursor(10, 40); 55 /* U8g2 font list: https://github.com/olikraus/u8g2/wiki/fntlistall */ 56 gfx->setFont(u8g2_font_maniac_tr); 57 gfx->setTextColor(RED); 58 gfx->println("Hello World!"); 59 60 delay(5000); // 5 seconds 61 } 62 63 void loop() 64 { 65 gfx->setCursor(random(gfx->width()), random(gfx->height())); 66 gfx->setTextColor(random(0xffff)); 67 68 gfx->println("Hello World!"); 69 70 delay(1000); // 1 second 71 }