Adafruit_GFX has some nice text and font support, but occasionally you may want something minimalist and fast, like the text mode of old PC’s. PicoDVI offers a fixed-width pure character mode that uses far less RAM than even the 1-bit graphics modes, and conveniently scrolls upward when text reaches the bottom.
Looking at the display
declaration for this example:
DVItext1 display(DVI_RES_640x240p60, adafruit_feather_dvi_cfg);
The object type is now DVItext1
(optimistically named with the “1” in case we add color text mode(s) in the future). The arguments should be familiar by now, but the resolution setting — DVI_RES_640x240p60
— is a new one.
The character cells in this text mode are 8 by 8 pixels. A 640 pixel width will thus yield 80 columns of text. The peculiar 240 pixel height used here makes things vertically stretched; each character cell is tall and narrow, and this mode yields 80×30 characters overall.
The result looks incredibly similar to vintage 80 column PC text — in fact the shapes are based on the IBM VGA font. This is also known as the “Code Page 437” character set. Characters are 8 bits…0–255…there’s a variety of symbols and accented letters, but no Unicode support, nor any alternate fonts.
A 100-column wide mode is possible (following the same compilation rules as explained in prior examples), and up to 60 rows if one foregoes the vertical stretch:
DVItext1 display(DVI_RES_800x480p60, adafruit_feather_dvi_cfg);
There’s little to say here about use other than it supports the same print()
and println()
calls as Arduino Serial or Adafruit_GFX:
display.print("Hello World! ");
It’s pretty basic, there’s no word wrap at the right edge…but when text reaches the bottom of the screen, everything will scroll upward automatically.
// 1-bit (black, white) text mode for PicoDVI. #include <PicoDVI.h> // Here's how an 80x30 character display is declared. First argument, // resolution, is full display pixel count...character cells are 8x8 pixels, // yielding the 80x30 result. 640x240 uses "tall" pixels, the result of all // this is very reminiscent of IBM VGA mode. Second argument is a hardware // configuration -- examples are written for Adafruit Feather RP2040 DVI, // but that's easily switched out for boards like the Pimoroni Pico DV // (use 'pimoroni_demo_hdmi_cfg') or Pico DVI Sock ('pico_sock_cfg'). DVItext1 display(DVI_RES_640x240p60, adafruit_feather_dvi_cfg); // Wider and taller modes are possible. Wider pushes overclocking even // higher than 640x480 mode. SOME BOARDS MIGHT SIMPLY NOT BE COMPATIBLE // WITH THIS. May require selecting QSPI div4 clock (Tools menu) to slow // down flash accesses, may require over-volting the CPU to 1.25 or 1.3 V. // Here's how a 100x60 char display might be declared: //DVItext1 display(DVI_RES_800x480p60, adafruit_feather_dvi_cfg); // A reduced refresh rate display doesn't as aggressive an over-clock // This timing is verified to work on https://www.adafruit.com/product/2232 //DVItext1 display(DVI_RES_800x240p30, adafruit_feather_dvi_cfg); void setup() { // Runs once on startup if (!display.begin()) { // Blink LED if insufficient RAM pinMode(LED_BUILTIN, OUTPUT); for (;;) digitalWrite(LED_BUILTIN, (millis() / 500) & 1); } } void loop() { display.print("Hello World! "); delay(50); }
Text editor powered by tinymce.