vtterm
Show a VT100 terminal with ANSI colors on a board’s display.
Terminal fits a grid of character cells to a display, reads escape codes
from whatever you feed it, and draws the rows that changed. Use it two ways:
As the board’s own console:
Consolehands it toos.dupterm, so the REPL appears on the display.As a terminal for another device:
runjoins it to a link (another board’s REPL over Bluetooth LE, a TCP socket, a UART).
Example
>>> from board_config import display_drv
>>> from vtterm import Terminal
>>> term = Terminal(display_drv)
>>> term.write(b"\x1b[1;32mhello\x1b[0m world\r\n")
- class vtterm.Terminal(display, font_height=16, cols=None, rows=None, fg=7, bg=0, palette=None, hardware_scroll=None, scrollback=16384)[source]
Bases:
objectA screen, its parser and its renderer, sized to a display.
- Parameters:
display – A 16-bit display driver (
board_config.display_drv).font_height (int) –
8,14or16; the font is 8 pixels wide.cols (int) – Columns; default as many as fit.
rows (int) – Rows; default as many as fit.
fg (int) – Default foreground, an ANSI palette index.
bg (int) – Default background, an ANSI palette index.
palette (Palette) – 16-bit colors for the 256 ANSI indices.
hardware_scroll (bool) – Scroll with the display’s scroll registers;
None(default) uses them when the driver has them.scrollback (int) – Bytes to keep of rows that scrolled off the top, four per cell (a 40-column screen keeps about 100 rows in 16 KB).
0keeps none.