At boot the terminal shows version, screen and terminal size, keyboard layout, terminal type and serial parameters (this can be disabled with Show Info).
| Field | Values |
| Terminal Type | ANSI, ADM 3A, ADM 31, Hazeltine 1500, Osborne, Kaypro, VT52, ANSI Legacy |
| Keyboard Layout | DE, IT, UK, US, ES, FR, BE, NO, JP |
| Background / Foreground Color | Any of the 16 terminal colors |
| Baud Rate | 110 ... 2000000 |
| Data Length / Parity / Stop Bits | 5-8 bits / None, Even, Odd / 1, 1.5, 2, 3 |
| Flow Control | None, XON/XOFF, RTS/CTS, Combi (both) |
| Resolution | 1280x768 B&W, 1024x720 4 colors, 800x600 8 colors, 720x520 16 colors, 640x480 73 Hz or 60 Hz 16 colors, 640x350 16 colors, 512x384 64 colors, 400x300 64 colors |
| Font | Auto, or one of the 31 included fonts (from 4x6 to 10x20, plus decorative fonts) |
| Columns / Rows | Max (as many as fit), 80 or 132 / Max, 24 or 25 |
| Port | FabGL Terminal (TX=2, RX=34), USB (TX=1, RX=3: the USB-serial chip, so the terminal can be driven by a PC), PS/2 Mouse (TX=27, RX=26: uses the mouse port, the mouse is disabled) |
| Show Info | Shows the information screen at boot |
| RTS / CTS | RTS can be toggled by clicking it; CTS shows the input line state |
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
27
28
29
30
31
32
33
34#include "freertos/FreeRTOS.h"
35#include "freertos/task.h"
36#include "esp_system.h"
38
39
45
46
47
48#define UART_RTS 13
49#define UART_CTS 35
50
51
52
53
54
55
56
57
58#define RESET_PIN 39
59#define RESET_PIN_ACTIVE 0
60#define USERESETPIN 0
61
62
63#define SHOWBREAKS 0
64
65
66
67
68#include "confdialog.h"
69
70
71#if FABGLIB_TERMINAL_DEBUG_REPORT
73#endif
74
75
76void setup()
77{
78 #if FABGLIB_TERMINAL_DEBUG_REPORT
79 Console.
begin(); vTaskDelay(pdMS_TO_TICKS(500)); printf(
"\n\nReset\n\n");
80 #endif
81
82
83
85
87
88 preferences.begin("AnsiTerminal", false);
89
90 ConfDialogApp::checkVersion();
91
92 #if USERESETPIN
93 fabgl::configureGPIO((gpio_num_t)(RESET_PIN), GPIO_MODE_INPUT);
94 if (gpio_get_level((gpio_num_t)(RESET_PIN)) == RESET_PIN_ACTIVE)
95 preferences.clear();
96 #endif
97
98
100
101
102 if (UARTPORT_FLAGS[ConfDialogApp::getUARTPortIndex()] & UARTFLAG_USE_PS2PORT1)
103 PS2Controller.
begin(PS2Preset::KeyboardPort0);
104 else
105 PS2Controller.
begin(PS2Preset::KeyboardPort0_MousePort1);
106
107 ConfDialogApp::setupDisplay();
108
109 ConfDialogApp::loadConfiguration();
110
111 #if FABGLIB_TERMINAL_DEBUG_REPORT
113 #endif
114
117
118 if (ConfDialogApp::getBootInfo() == BOOTINFO_ENABLED) {
119 Terminal.
write(
"* * FabGL - Serial Terminal * *\r\n");
120 Terminal.
write(
"* * 2019-2026 by Fabrizio Di Vittorio - www.fabgl.com * *\r\n\n");
121 Terminal.printf("Version : %d.%d\r\n", TERMVERSION_MAJ, TERMVERSION_MIN);
123 Terminal.printf(
"Terminal Size : %d x %d\r\n", Terminal.
getColumns(), Terminal.
getRows());
124 Terminal.printf(
"Keyboard Layout : %s\r\n", PS2Controller.
keyboard()->
isKeyboardAvailable() ? SupportedLayouts::names()[ConfDialogApp::getKbdLayoutIndex()] :
"No Keyboard");
125
126 Terminal.printf("Terminal Type : %s\r\n", SupportedTerminals::names()[(int)ConfDialogApp::getTermType()]);
127
128 Terminal.printf("Serial Port : %s\r\n", UARTPORT_STR[ConfDialogApp::getUARTPortIndex()]);
129 Terminal.printf("Serial Parameters : %s\r\n", ConfDialogApp::getSerParamStr());
130
131 Terminal.
write(
"\r\nPress F12 to change terminal configuration and CTRL-ALT-F12 to reset settings\r\n\n");
132 } else if (ConfDialogApp::getBootInfo() == BOOTINFO_TEMPDISABLED) {
133 preferences.putInt(PREF_BOOTINFO, BOOTINFO_ENABLED);
134 }
135
136
138 if (vkItem->vk == VirtualKey::VK_F12) {
139
140
141 if (vkItem->CTRL && (vkItem->LALT || vkItem->RALT)) {
143 preferences.clear();
144
145 auto rebootApp = new RebootDialogApp;
146 rebootApp->run(DisplayController);
147 } else if (!vkItem->CTRL && !vkItem->LALT && !vkItem->RALT && !vkItem->down) {
148
150 if (PS2Controller.
mouse())
152 auto dlgApp = new ConfDialogApp;
153 dlgApp->run(DisplayController);
154 auto progToInstall = dlgApp->progToInstall;
155
159 delete dlgApp;
162
163 if (progToInstall > -1)
164 installProgram(progToInstall);
165 vkItem->vk = VirtualKey::VK_NONE;
166 }
167 } else if (vkItem->vk == VirtualKey::VK_BREAK && !vkItem->down) {
168
169
171 vTaskDelay((vkItem->SHIFT ? 3500 : 233) / portTICK_PERIOD_MS);
173 vkItem->vk = VirtualKey::VK_NONE;
174 }
175 };
176
177
179
180 for (int i = 0; i < RESOLUTIONS_COUNT; ++i)
181 if (strcmp(RESOLUTIONS_CMDSTR[i], seq) == 0) {
182
183 preferences.putInt(PREF_TEMPRESOLUTION, i);
184 if (ConfDialogApp::getBootInfo() == BOOTINFO_ENABLED)
185 preferences.putInt(PREF_BOOTINFO, BOOTINFO_TEMPDISABLED);
186 esp_restart();
187 }
188 };
189}
190
191
192void loop()
193{
194 #if SHOWBREAKS
196 Terminal.printf("BREAK\r\n");
197 }
198 vTaskDelay(50);
199 #else
200
201
202 vTaskDelete(NULL);
203
204 #endif
205}
206
207
208extern "C" void app_main()
209{
210 setup();
211 while (true)
212 loop();
213}
int getViewPortHeight()
Determines the height of the viewport.
int getViewPortWidth()
Determines the width of the viewport.
Represents the base abstract class for bitmapped display controllers.
void fillRectangle(int X1, int Y1, int X2, int Y2)
Fills a rectangle using the current brush color.
void setBrushColor(uint8_t red, uint8_t green, uint8_t blue)
Sets the brush (background) color from its color components.
void reset()
Resets the paint state and other display controller settings.
bool isKeyboardAvailable()
Checks whether the keyboard has been detected and correctly initialized.
void emptyVirtualKeyQueue()
Empties the virtual key queue.
void emptyQueue()
Empties the mouse status and event queues.
static void quickCheckHardware()
Disables retries when no mouse is found.
static Mouse * mouse()
Returns the Mouse object automatically created by PS2Controller.
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 sendBreak(bool value)
Activates or deactivates the break condition.
bool breakDetected()
Gets the break detected flag.
SerialPort handles UART configuration and communication.
SerialPortTerminalConnector is a helper class that connects a Terminal to a SerialPort.
int getRows()
Returns the number of lines.
void clear(bool moveCursor=true)
Clears the screen.
void setLogStream(Stream &stream)
Sets the stream that receives debug logs.
int getColumns()
Returns the number of columns.
static int keyboardReaderTaskStackSize
Stack size of the task that reads keys from the keyboard and sends the corresponding ANSI/VT codes to...
size_t write(const uint8_t *buffer, size_t size)
Sends the specified number of codes to the display.
Canvas * canvas()
Gets the associated canvas object.
void deactivate()
Deactivates this terminal.
Keyboard * keyboard()
Gets the associated keyboard object.
static int inputQueueSize
Number of characters the terminal can accept without blocking (increase it if characters are lost on ...
void activate(TerminalTransition transition=TerminalTransition::None)
Activates this terminal for input and output.
void enableCursor(bool value)
Enables or disables the cursor.
Delegate< VirtualKeyItem * > onVirtualKeyItem
Delegate called whenever a new virtual key is received from the keyboard, including shift states.
Delegate< char const * > onUserSequence
Delegate called whenever a new user sequence has been received.
An ANSI-VT100 compatible display terminal.
bool begin(int port=0, int baud=0, int rxPin=-1, int txPin=-1, int rxBufferSize=1024, int txBufferSize=0)
Initializes the UART.
A Stream implemented on top of the ESP-IDF UART driver.
Single include file of the FabGL library.
Contains a virtual key, its state and the associated scancode.