At startup the screen (VGA text mode, 80x25) shows the screen and terminal size, the keyboard status and the free memory.
Just type. To send an escape sequence, press ESC and then type the rest of the sequence. Examples:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
30
31
33
34
35
36
40
41
42void print_info()
43{
44 Terminal.
write(
"\e[37m* * FabGL - Loopback VT/ANSI Terminal\r\n");
45 Terminal.
write(
"\e[34m* * 2019-2026 by Fabrizio Di Vittorio - www.fabgl.com\e[32m\r\n\n");
47 Terminal.printf(
"\e[32mTerminal Size :\e[33m %d x %d\r\n", Terminal.
getColumns(), Terminal.
getRows());
49 Terminal.printf("\e[32mFree DMA Memory :\e[33m %d\r\n", heap_caps_get_free_size(MALLOC_CAP_DMA));
50 Terminal.printf("\e[32mFree 32 bit Memory :\e[33m %d\r\n\n", heap_caps_get_free_size(MALLOC_CAP_32BIT));
51 Terminal.
write(
"\e[32mFree typing test - press ESC to introduce escape VT/ANSI codes\r\n\n");
52}
53
54
55void setup()
56{
57
58 PS2Controller.
begin(PS2Preset::KeyboardPort0);
59
60 DisplayController.
begin();
62
63 Terminal.
begin(&DisplayController);
65
69
70 print_info();
71
73
74
75
76
77
78
79
80
81
82}
83
84
85void loop()
86{
88 char c = Terminal.
read();
89 switch (c) {
90 case 0x7F:
91 Terminal.
write(
"\b\e[K");
92 break;
93 case 0x0D:
94 Terminal.
write(
"\r\n");
95 break;
96 default:
98 break;
99 }
100 }
101}
102
103
104extern "C" void app_main()
105{
106 setup();
107 while (true)
108 loop();
109}
int getViewPortHeight()
Determines the height of the viewport.
int getViewPortWidth()
Determines the width of the viewport.
bool isKeyboardAvailable()
Checks whether the keyboard has been detected and correctly initialized.
static Keyboard * keyboard()
Returns the Keyboard object automatically created by PS2Controller.
static void begin(gpio_num_t port0_clkGPIO, gpio_num_t port0_datGPIO, gpio_num_t port1_clkGPIO=GPIO_UNUSED, gpio_num_t port1_datGPIO=GPIO_UNUSED)
Initializes the PS/2 device controller.
void connectLocally()
Allows the terminal to be used locally.
int getRows()
Returns the number of lines.
void clear(bool moveCursor=true)
Clears the screen.
int available()
Gets the number of codes available in the keyboard queue.
int getColumns()
Returns the number of columns.
size_t write(const uint8_t *buffer, size_t size)
Sends the specified number of codes to the display.
int read()
Reads codes from keyboard.
void enableCursor(bool value)
Enables or disables the cursor.
void setBackgroundColor(Color color, bool setAsDefault=true)
Sets the background color.
bool begin(BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)
Initializes the terminal.
void setForegroundColor(Color color, bool setAsDefault=true)
Sets the foreground color.
An ANSI-VT100 compatible display terminal.
void begin(gpio_num_t redGPIO, gpio_num_t greenGPIO, gpio_num_t blueGPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO)
Initializer for 8 colors (5 GPIOs).
void setResolution(char const *modeline=nullptr, int viewPortWidth=-1, int viewPortHeight=-1, bool doubleBuffered=false)
Sets the fixed resolution.
VGA text-only display controller.
Single include file of the FabGL library.