37 #include "freertos/FreeRTOS.h" 38 #include "freertos/task.h" 39 #include "freertos/timers.h" 40 #include "freertos/semphr.h" 222 struct TerminalCursorState {
223 TerminalCursorState * next;
227 bool cursorPastLastCol;
229 GlyphOptions glyphOptions;
230 uint8_t characterSetIndex;
231 uint8_t characterSet[4];
244 uint8_t characterSetIndex;
247 uint8_t characterSet[4];
249 Color foregroundColor;
250 Color backgroundColor;
256 bool cursorPastLastCol;
263 int scrollingRegionTop;
264 int scrollingRegionDown;
269 bool cursorBlinkingEnabled;
291 KeypadMode keypadMode;
297 int conformanceLevel;
304 bool allow132ColumnMode;
306 bool reverseWraparoundMode;
309 bool backarrowKeyMode;
315 bool VT52GraphicsMode;
500 void logFmt(
const char * format, ...);
501 void log(
const char * txt);
513 void loadFont(FontInfo
const * font);
564 void flush(
bool waitVSync);
677 int write(
const uint8_t * buffer,
int size);
688 size_t write(uint8_t c);
697 void clearMap(uint32_t * map);
701 void freeGlyphsMap();
703 void set132ColumnMode(
bool value);
707 void setCursorPos(
int X,
int Y);
708 int getAbsoluteRow(
int Y);
710 void int_setBackgroundColor(
Color color);
711 void int_setForegroundColor(
Color color);
715 void setTabStop(
int column,
bool set);
716 void resetTabStops();
720 void scrollDownAt(
int startingRow);
722 void scrollUpAt(
int startingRow);
723 void setScrollingRegion(
int top,
int down,
bool resetCursorPos =
true);
724 void updateCanvasScrollingRegion();
727 void saveCursorState();
728 void restoreCursorState();
729 void clearSavedCursorStates();
731 void erase(
int X1,
int Y1,
int X2,
int Y2,
char c,
bool maintainDoubleWidth,
bool selective);
733 void consumeInputQueue();
736 void consumeCSIQUOT(
int * params,
int paramsCount);
737 void consumeCSISPC(
int * params,
int paramsCount);
738 char consumeParamsAndGetCode(
int * params,
int * paramsCount,
bool * questionMarkFound);
739 void consumeDECPrivateModes(
int const * params,
int paramsCount,
char c);
741 void execSGRParameters(
int const * params,
int paramsCount);
742 void consumeESCVT52();
744 void execCtrlCode(
char c);
746 static void charsConsumerTask(
void * pvParameters);
747 static void keyboardReaderTask(
void * pvParameters);
749 static void blinkTimerFunc(TimerHandle_t xTimer);
751 bool enableBlinkingText(
bool value);
753 bool int_enableCursor(
bool value);
755 char getNextCode(
bool processCtrlCodes);
757 void setChar(
char c);
760 void insertAt(
int column,
int row,
int count);
761 void deleteAt(
int column,
int row,
int count);
763 void reverseVideo(
bool value);
766 void refresh(
int X,
int Y);
767 void refresh(
int X1,
int Y1,
int X2,
int Y2);
771 void setLineDoubleWidth(
int row,
int value);
772 int getCharWidthAt(
int row);
773 int getColumnsAt(
int row);
775 void useAlternateScreenBuffer(
bool value);
778 void send(
char const * str);
782 void sendCursorKeyCode(
char c);
783 void sendKeypadCursorKeyCode(
char applicationCode,
const char * numericCode);
788 void convHandleTranslation(uint8_t c);
789 void convSendCtrl(ConvCtrl ctrl);
790 void convQueue(
const char * str =
nullptr);
794 Stream * m_logStream;
798 GlyphsBuffer m_glyphsBuffer;
801 uint32_t * m_alternateMap;
804 bool m_alternateScreenBuffer;
807 int m_alternateCursorX;
808 int m_alternateCursorY;
817 Color m_defaultForegroundColor;
818 Color m_defaultBackgroundColor;
821 bool m_prevCursorEnabled;
822 bool m_prevBlinkingTextEnabled;
825 TaskHandle_t m_charsConsumerTaskHandle;
828 TaskHandle_t m_keyboardReaderTaskHandle;
831 volatile bool m_cursorState;
834 TimerHandle_t m_blinkTimer;
835 volatile SemaphoreHandle_t m_blinkTimerMutex;
837 volatile bool m_blinkingTextVisible;
838 volatile bool m_blinkingTextEnabled;
840 volatile int m_columns;
846 HardwareSerial * m_serialPort;
849 QueueHandle_t m_inputQueue;
852 QueueHandle_t m_outputQueue;
855 TerminalCursorState * m_savedCursorStateList;
858 bool m_resetRequested;
866 uint8_t m_convMatchedCount;
867 char m_convMatchedChars[EmuTerminalMaxChars];
868 TermInfoVideoConv
const * m_convMatchedItem;
869 TermInfo
const * m_termInfo;
void connectSerialPort(HardwareSerial &serialPort, bool autoXONXOFF=true)
Connects a remove host using the specified serial port.
Definition: terminal.cpp:135
void flush()
Waits for all codes sent to the display has been processed.
Definition: terminal.cpp:968
void pollSerialPort()
Pools the serial port for incoming data.
Definition: terminal.cpp:974
void setTerminalType(TermInfo const *value)
Sets the terminal type to emulate specifying conversion tables.
Definition: terminal.cpp:1088
void clear()
Clears the screen.
Definition: terminal.cpp:418
Color
This enum defines named colors.
Definition: vgacontroller.h:212
This file contains terminal emulation definitions.
This file contains fabgl::KeyboardClass definition and the Keyboard instance.
void localWrite(uint8_t c)
Injects keys into the keyboard queue.
Definition: terminal.cpp:921
An ANSI-VT100 compatible display terminal.
Definition: terminal.h:400
int available()
Gets the number of codes available in the keyboard queue.
Definition: terminal.cpp:944
void setForegroundColor(Color color, bool setAsDefault=true)
Sets the foreground color.
Definition: terminal.cpp:392
This file contains fabgl::CanvasClass definition and the related Canvas instance. ...
int getRows()
Returns the number of lines.
Definition: terminal.h:578
int availableForWrite()
Determines number of codes that the display input queue can still accept.
Definition: terminal.cpp:1059
VirtualKey
Represents each possible real or derived (SHIFT + real) key.
Definition: fabutils.h:366
void enableCursor(bool value)
Enables or disables cursor.
Definition: terminal.cpp:499
Definition: canvas.cpp:47
void begin()
Initializes the terminal.
Definition: terminal.cpp:85
Specifies various glyph painting options.
Definition: vgacontroller.h:284
void end()
Finalizes the terminal.
Definition: terminal.cpp:224
int getColumns()
Returns the number of columns.
Definition: terminal.h:571
TermType
This enum defines supported terminals.
Definition: terminfo.h:103
TermInfo const & terminalType()
Determines current terminal type.
Definition: terminal.h:617
void setBackgroundColor(Color color, bool setAsDefault=true)
Sets the background color.
Definition: terminal.cpp:377
This file contains FabGL library configuration settings, like number of supported colors...
int peek()
Reads a code from the keyboard without advancing to the next one.
Definition: terminal.cpp:962
int read()
Reads codes from keyboard.
Definition: terminal.cpp:950
void loadFont(FontInfo const *font)
Sets the font to use.
Definition: terminal.cpp:316
void setLogStream(Stream &stream)
Sets the stream where to output debugging logs.
Definition: terminal.h:498
void connectLocally()
Permits using of terminal locally.
Definition: terminal.cpp:153
int write(const uint8_t *buffer, int size)
Sends specified number of codes to the display.
Definition: terminal.cpp:1080
Specifies general paint options.
Definition: vgacontroller.h:483