「App:Library:FabGL:Class:Terminal」の版間の差分

提供: robot-jp wiki
ナビゲーションに移動検索に移動
 
(同じ利用者による、間の4版が非表示)
9行目: 9行目:
 
==Public Member Functions==
 
==Public Member Functions==
 
{| class="wikitable"
 
{| class="wikitable"
|void activate (TerminalTransition transition=TerminalTransition::None)
+
|
 
+
===== void activate (TerminalTransition transition=TerminalTransition::None) =====
:Activates this terminal for input and output.
+
:この端子を入出力用にアクティブにします。
 
|-
 
|-
|int available ()
+
|
 
+
===== int available () =====
:Gets the number of codes available in the keyboard queue.
+
:キーボードキューで使用可能なコードの数を取得します。
 
|-
 
|-
|int availableForWrite ()
+
|
 
+
===== int availableForWrite () =====
:Determines number of codes that the display input queue can still accept.
+
:表示入力キューが引き続き受け入れることができるコードの数を決定します。
 
|-
 
|-
|bool begin (BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)
+
|
 
+
===== bool begin (BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr) =====
:Initializes the terminal.
+
:端末を初期化します。
 
|-
 
|-
|Canvas * canvas ()
+
|
 
+
===== Canvas * canvas () =====
:Gets associated canvas object.
+
:関連するキャンバスオブジェクトを取得します。
 
|-
 
|-
|void clear (bool moveCursor=true)
+
|
 
+
===== void clear (bool moveCursor=true) =====
:Clears the screen.
+
:画面をクリアします。
 
|-
 
|-
|void connectLocally ()
+
|
 
+
===== void connectLocally () =====
:Permits using of terminal locally.
+
:ローカルでの端末の使用を許可します。
 
|-
 
|-
|void connectSerialPort (HardwareSerial &serialPort, bool autoXONXOFF=true)
+
|
 
+
===== void connectSerialPort (HardwareSerial &serialPort, bool autoXONXOFF=true) =====
:Connects a remote host using the specified serial port.
+
:指定されたシリアルポートを使用してリモートホストを接続します。
 
|-
 
|-
|void connectSerialPort (uint32_t baud, uint32_t config, int rxPin, int txPin, FlowControl flowControl, bool inverted=false, int rtsPin=-1, int ctsPin=-1)
+
|
 
+
===== void connectSerialPort (uint32_t baud, uint32_t config, int rxPin, int txPin, FlowControl flowControl, bool inverted=false, int rtsPin=-1, int ctsPin=-1) =====
:Connects a remote host using UART.
+
:UARTを使用してリモートホストを接続します。
 
|-
 
|-
|bool CTSStatus ()
+
|
 
+
===== bool CTSStatus () =====
:Reports current CTS signal status.
+
:現在のCTS信号ステータスを報告します。
 
|-
 
|-
|void deactivate ()
+
|
 
+
===== void deactivate () =====
:Deactivates this terminal.
+
:この端末を非アクティブにします。
 
|-
 
|-
|void disableSerialPortRX (bool value)
+
|
 
+
===== void disableSerialPortRX (bool value) =====
:Disables/Enables serial port RX.
+
:シリアルポートRXを無効/有効にします。
 
|-
 
|-
|void disconnectLocally ()
+
|
 
+
===== void disconnectLocally () =====
:Avoids using of terminal locally.
+
:ローカルでの端末の使用を回避します。
 
|-
 
|-
|void enableCursor (bool value)
+
|
 
+
===== void enableCursor (bool value) =====
:Enables or disables cursor.
+
:カーソルを有効または無効にします。
 
|-
 
|-
|void end ()
+
|
 
+
===== void end () =====
:Finalizes the terminal.
+
:ターミナルを完成させます。
 
|-
 
|-
|void flowControl (bool enableRX)
+
|
 
+
===== void flowControl (bool enableRX) =====
:Allows/disallows host to send data.
+
:ホストがデータを送信することを許可/禁止します。
 
|-
 
|-
|bool flowControl ()
+
|
 
+
===== bool flowControl () =====
:Checks whether host can receive data.
+
:ホストがデータを受信できるかどうかを確認します。
 
|-
 
|-
|void flush (bool waitVSync)
+
|
 
+
===== void flush (bool waitVSync) =====
:Waits for all codes sent to the display has been processed.
+
:ディスプレイに送信されたすべてのコードが処理されるのを待ちます。
 
|-
 
|-
|void flush ()
+
|
 
+
===== void flush () =====
:Waits for all codes sent to the display has been processed.
+
:ディスプレイに送信されたすべてのコードが処理されるのを待ちます。
 
|-
 
|-
|int getColumns ()
+
|
 
+
===== int getColumns () =====
:Returns the number of columns.
+
:列数を返します。
 
|-
 
|-
|int getRows ()
+
|
 
+
===== int getRows () =====
:Returns the number of lines.
+
:行数を返します。
 
|-
 
|-
|bool isActive ()
+
|
 
+
===== bool isActive () =====
:Determines if this terminal is active or not.
+
:この端末がアクティブかどうかを判別します。
 
|-
 
|-
|Keyboard * keyboard ()
+
|
 
+
===== Keyboard * keyboard () =====
:Gets associated keyboard object.
+
:関連するキーボードオブジェクトを取得します。
 
|-
 
|-
|void loadFont (FontInfo const *font)
+
|
 
+
===== void loadFont (FontInfo const *font) =====
:Sets the font to use.
+
:使用するフォントを設定します。
 
|-
 
|-
|void localInsert (uint8_t c)
+
|
 
+
===== void localInsert (uint8_t c) =====
:Injects keys into the keyboard queue.
+
:キーをキーボードキューに挿入します。
 
|-
 
|-
|void localWrite (uint8_t c)
+
|
 
+
===== void localWrite (uint8_t c) =====
:Injects keys into the keyboard queue.
+
:キーをキーボードキューに挿入します。
 
|-
 
|-
|void localWrite (char const *str)
+
|
 
+
===== void localWrite (char const *str) =====
:Injects a string of keys into the keyboard queue.
+
:キーの文字列をキーボードキューに挿入します。
 
|-
 
|-
|int peek ()
+
|
 
+
===== int peek () =====
:Reads a code from the keyboard without advancing to the next one.
+
:次のコードに進むことなく、キーボードからコードを読み取ります。
 
|-
 
|-
|void pollSerialPort ()
+
|
 
+
===== void pollSerialPort () =====
:Pools the serial port for incoming data.
+
:着信データ用にシリアルポートをプールします。
 
|-
 
|-
|int read ()
+
|
 
+
===== int read () =====
:Reads codes from keyboard.
+
:キーボードからコードを読み取ります。
 
|-
 
|-
|int read (int timeOutMS)
+
|
 
+
===== int read (int timeOutMS) =====
:Reads codes from keyboard specyfing timeout.
+
:キーボード指定タイムアウトからコードを読み取ります。
 
|-
 
|-
|bool RTSStatus ()
+
|
 
+
===== bool RTSStatus () =====
:Reports current RTS signal status.
+
:現在のRTS信号ステータスを報告します。
 
|-
 
|-
|void send (uint8_t c)
+
|
 
+
===== void send (uint8_t c) =====
:Like localWrite() but sends also to serial port if connected.
+
:localWrite()と同様ですが、接続されている場合はシリアルポートにも送信します。
 
|-
 
|-
|void send (char const *str)
+
|
 
+
===== void send (char const *str) =====
:Like localWrite() but sends also to serial port if connected.
+
:localWrite()と同様ですが、接続されている場合はシリアルポートにも送信します。
 
|-
 
|-
|void setBackgroundColor (Color color, bool setAsDefault=true)
+
|
 
+
===== void setBackgroundColor (Color color, bool setAsDefault=true) =====
:Sets the background color.
+
:背景色を設定します。
 
|-
 
|-
|void setColorForAttribute (CharStyle attribute, Color color, bool maintainStyle)
+
|
 
+
===== void setColorForAttribute (CharStyle attribute, Color color, bool maintainStyle) =====
:Selects a color for the specified attribute.
+
:指定した属性の色を選択します。
 
|-
 
|-
|void setColorForAttribute (CharStyle attribute)
+
|
 
+
===== void setColorForAttribute (CharStyle attribute) =====
:Disables color for the specified attribute.
+
:指定された属性の色を無効にします。
 
|-
 
|-
|void setForegroundColor (Color color, bool setAsDefault=true)
+
|
 
+
===== void setForegroundColor (Color color, bool setAsDefault=true) =====
:Sets the foreground color.
+
:前景色を設定します。
 
|-
 
|-
|void setLogStream (Stream &stream)
+
|
 
+
===== void setLogStream (Stream &stream) =====
:Sets the stream where to output debugging logs.
+
:デバッグログを出力するストリームを設定します。
 
|-
 
|-
|void setRTSStatus (bool value)
+
|
 
+
===== void setRTSStatus (bool value) =====
:Sets RTS signal status.
+
:RTS信号のステータスを設定します。
 
|-
 
|-
|void setTerminalType (TermType value)
+
|
 
+
===== oid setTerminalType (TermType value) =====
:Sets the terminal type to emulate.
+
:エミュレートする端末タイプを設定します。
 
|-
 
|-
|SoundGenerator * soundGenerator ()
+
|
 
+
===== SoundGenerator * soundGenerator () =====
:Gets embedded sound generator.
+
:埋め込まれたサウンドジェネレータを取得します。
 
|-
 
|-
|TermInfo const & terminalType ()
+
|
 
+
===== TermInfo const & terminalType () =====
:Determines current terminal type.
+
:現在の端末タイプを決定します。
 
|-
 
|-
|void unRead (uint8_t c)
+
|
 
+
===== void unRead (uint8_t c) =====
:Injects keys into the keyboard queue.
+
:キーをキーボードキューに挿入します。
 
|-
 
|-
|bool waitFor (int value, int timeOutMS=-1)
+
|
 
+
===== bool waitFor (int value, int timeOutMS=-1) =====
:Wait for a specific code from keyboard, discarding all previous codes.
+
:キーボードから特定のコードを待ち、以前のコードをすべて破棄します。
 
|-
 
|-
|size_t write (const uint8_t *buffer, size_t size)
+
|
 
+
===== size_t write (const uint8_t *buffer, size_t size) =====
:Sends specified number of codes to the display.
+
:指定された数のコードをディスプレイに送信します。
 
|-
 
|-
|size_t write (uint8_t c)
+
|
 
+
===== size_t write (uint8_t c) =====
:Sends a single code to the display.
+
:単一のコードをディスプレイに送信します。
 
|-
 
|-
|bool XOFFStatus ()
+
|
 
+
===== bool XOFFStatus () =====
:Reports whether TX is active.
+
:TXがアクティブかどうかを報告します。
 
|}
 
|}
  
 
==Public Attributes==
 
==Public Attributes==
 
{| class="wikitable"
 
{| class="wikitable"
|Delegate< char const * > onUserSequence
+
|
 
+
===== Delegate< char const * > [http://www.fabglib.org/classfabgl_1_1_terminal_af05ed15439143da3bc5b6b58d2e65daa.html#af05ed15439143da3bc5b6b58d2e65daa onUserSequence] =====
:Delegate called whenever a new user sequence has been received.
+
:新しいユーザーシーケンスが受信されるたびに、デリゲートが呼び出されます。
 
|-
 
|-
|Delegate< VirtualKey *, bool > onVirtualKey
+
|
 
+
===== Delegate< [[App:Library:FabGL:Enum:VirtualKey|VirtualKey]] *, bool > [http://www.fabglib.org/classfabgl_1_1_terminal_a41c6325db16da56b81f05e8d9dcabd0e.html#a41c6325db16da56b81f05e8d9dcabd0e onVirtualKey] =====
:Delegate called whenever a new virtual key is received from keyboard.
+
:キーボードから新しい仮想キーを受信するたびに、デリゲートが呼び出されます。
 
|-
 
|-
|Delegate< VirtualKeyItem * > onVirtualKeyItem
+
|
 
+
===== Delegate< [[App:Library:FabGL:Struct:VirtualKeyItem|VirtualKeyItem]] * > [http://www.fabglib.org/classfabgl_1_1_terminal_abeb3bffa27a71e1c6dbdba8ac88d14fe.html#abeb3bffa27a71e1c6dbdba8ac88d14fe onVirtualKeyItem] =====
:Delegate called whenever a new virtual key is received from keyboard, including shift states.
+
:シフト状態を含め、キーボードから新しい仮想キーを受信するたびに、デリゲートが呼び出されます。
 
|}
 
|}
  
 
==Static Public Attributes==
 
==Static Public Attributes==
 
{| class="wikitable"
 
{| class="wikitable"
|static int inputConsumerTaskStackSize = 2048
+
|
:Stack size of the task that processes Terminal input stream.
+
===== static int [http://www.fabglib.org/classfabgl_1_1_terminal_aade947364dc37ddbcd51607715332dd5.html#aade947364dc37ddbcd51607715332dd5 inputConsumerTaskStackSize] = 2048 =====
 +
:ターミナル入力ストリームを処理するタスクのスタックサイズ。
 
|-
 
|-
|static int inputQueueSize = 1024
+
|
:Number of characters the terminal can "write" without pause (increase if you have loss of characters in serial port).
+
===== static int [http://www.fabglib.org/classfabgl_1_1_terminal_a8508592f91c82a7a4a0c2edf4effce61.html#a8508592f91c82a7a4a0c2edf4effce61 inputQueueSize] = 1024 =====
 +
:端末が一時停止せずに「書き込む」ことができる文字数(シリアルポートで文字が失われた場合は増加します)。
 
|-
 
|-
|static int keyboardReaderTaskStackSize = 2048
+
|
:Stack size of the task that reads keys from keyboard and send ANSI/VT codes to output stream in Terminal.
+
===== static int [http://www.fabglib.org/classfabgl_1_1_terminal_a77b40b81c5e1ba039ed39891bf8c6a20.html#a77b40b81c5e1ba039ed39891bf8c6a20 keyboardReaderTaskStackSize] = 2048 =====
 +
:キーボードからキーを読み取り、ANSI/VTコードをTerminalの出力ストリームに送信するタスクのスタックサイズです。
 
|}
 
|}
  
 
==Detailed Description==
 
==Detailed Description==
Defines a cursor.
+
ANSI-VT100互換のディスプレイ端末。
 +
 
 +
非CSIコード(RIS、IND、DECID、DECDHLなど)など、一般的なANSI、VT52、VT100、VT200、VT300、VT420、およびVT500エスケープコードのほとんどを実装します。
 +
 
 +
CSIコード(プライベートモード、CUP、TBCなど)、CSI-SGRコード(太字、斜体、点滅など)、DCSコード(DECRQSSなど)のように。
 +
 
 +
PS / 2キーボード仮想キーからANSIまたはVTコード(キーパッド、カーソルキー、ファンクションキーなど)への変換をサポートします。
 +
 
 +
端末は、シリアルポートから表示するコードを受信することも、アプリケーションから直接制御することもできます。同様に、ターミナルはキーボードコードをシリアルポートまたはアプリケーションに直接送信できます。
 +
 
 +
デフォルトでは、640x350で80x25または132x25文字をサポートします。ただし、カスタムフォントを指定すると、任意のカスタム解像度とテキストバッファサイズがサポートされます。
  
'''Example1:
+
カーソルのスタイルには、点滅または非点滅の3つのスタイル(ブロック、下線、バー)があります。
 +
 
 +
ターミナルはStreamを継承するため、アプリケーションはすべてのStreamおよびPrint入力および出力メソッドを使用できます。
 +
 
 +
ターミナルは、VTTEST VT100/VT102互換性テストスコアシートの95/110に合格します。
 +
 
 +
=== '''Example1:''' ===
 
{| class="wikitable"
 
{| class="wikitable"
|
+
|fabgl::VGAController VGAController;
 +
 
 +
fabgl::PS2Controller PS2Controller;
 +
 
 +
fabgl::Terminal      Terminal;
 +
 
 +
// Setup 80x25 columns loop-back terminal (send what you type on keyboard to the display)
 +
 
 +
void setup() {
 +
 
 +
  PS2Controller.begin(PS2Preset::KeyboardPort0);
 +
 
 +
  VGAController.begin();
 +
 
 +
  VGAController.setResolution(VGA_640x350_70HzAlt1);
 +
 
 +
  Terminal.begin(&VGAController);
 +
 
 +
  Terminal.connectLocally();      // to use Terminal.read(), available(), etc..
 +
 
 +
  Terminal.enableCursor(true);
 +
 
 +
}
 +
 
 +
void loop() {
 +
 
 +
  if (Terminal.available()) {
 +
 
 +
    char c = Terminal.read();
 +
 
 +
    switch (c) {
 +
 
 +
      case 0x7F:       // DEL -> backspace + ESC[K
 +
 
 +
        Terminal.write("\b\e[K");
 +
 
 +
        break;
 +
 
 +
      case 0x0D:       // CR  -> CR + LF
 +
 
 +
        Terminal.write("\r\n");
 +
 
 +
        break;
 +
 
 +
      case 32 ... 126: // printable chars
 +
 
 +
        Terminal.write(c);
 +
 
 +
        break;
 +
 
 +
    }
 +
 
 +
  }
 +
 
 +
}
 
|}
 
|}
  
'''Example2:
+
=== '''Example2:''' ===
 
{| class="wikitable"
 
{| class="wikitable"
|
+
|fabgl::VGAController VGAController;
 +
 
 +
fabgl::PS2Controller PS2Controller;
 +
 
 +
fabgl::Terminal      Terminal;
 +
 
 +
// Setup 80x25 columns terminal using UART2 to communicate with the server,
 +
 
 +
// VGA to display output and PS2 device as keyboard input
 +
 
 +
void setup() {
 +
 
 +
  Serial2.begin(115200);
 +
 
 +
  PS2Controller.begin(PS2Preset::KeyboardPort0);
 +
 
 +
  VGAController.begin();
 +
 
 +
  VGAController.setResolution(VGA_640x350_70HzAlt1);
 +
 
 +
  Terminal.begin(&VGAController);
 +
 
 +
  Terminal.connectSerialPort(Serial2);
 +
 
 +
  Terminal.enableCursor(true);
 +
 
 +
}
 +
 
 +
void loop() {
 +
 
 +
  Terminal.pollSerialPort();
 +
 
 +
}
 
|}
 
|}
  
'''Examples:
+
=== '''Examples:''' ===
:Others/KeyboardScanCodes/KeyboardScanCodes.ino, Others/KeyboardVirtualKeys/KeyboardVirtualKeys.ino, SSD1306_OLED/128x32/SimpleTerminalOut/SimpleTerminalOut.ino, SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino, SSD1306_OLED/128x64/RTClock/RTClock.ino, SSD1306_OLED/128x64/SimpleTerminalOut/SimpleTerminalOut.ino, ST7789_TFT/240x240/SimpleTerminalOut/SimpleTerminalOut.ino, VGA/Altair8800/Altair8800.ino, VGA/AnsiTerminal/AnsiTerminal.ino, VGA/LoopbackTerminal/LoopbackTerminal.ino, VGA/MultitaskingCPM/MultitaskingCPM.ino, VGA/NetworkTerminal/NetworkTerminal.ino, VGA/SimpleTerminalOut/SimpleTerminalOut.ino, VGA/SimpleTextTerminalOut/SimpleTextTerminalOut.ino, and VGA/Songs/Songs.ino.
+
:[http://www.fabglib.org/_others_2_keyboard_scan_codes_2_keyboard_scan_codes_8ino-example.html#_a1 Others/KeyboardScanCodes/KeyboardScanCodes.ino], [http://www.fabglib.org/_others_2_keyboard_virtual_keys_2_keyboard_virtual_keys_8ino-example.html#_a1 Others/KeyboardVirtualKeys/KeyboardVirtualKeys.ino], [http://www.fabglib.org/_s_s_d1306__o_l_e_d_2128x32_2_simple_terminal_out_2_simple_terminal_out_8ino-example.html#_a2 SSD1306_OLED/128x32/SimpleTerminalOut/SimpleTerminalOut.ino], [http://www.fabglib.org/_s_s_d1306__o_l_e_d_2128x64_2_network_terminal_2_network_terminal_8ino-example.html#_a3 SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino], [http://www.fabglib.org/_s_s_d1306__o_l_e_d_2128x64_2_r_t_clock_2_r_t_clock_8ino-example.html#_a4 SSD1306_OLED/128x64/RTClock/RTClock.ino], [http://www.fabglib.org/_s_s_d1306__o_l_e_d_2128x64_2_simple_terminal_out_2_simple_terminal_out_8ino-example.html#_a2 SSD1306_OLED/128x64/SimpleTerminalOut/SimpleTerminalOut.ino], [http://www.fabglib.org/_s_t7789__t_f_t_2240x240_2_simple_terminal_out_2_simple_terminal_out_8ino-example.html#_a1 ST7789_TFT/240x240/SimpleTerminalOut/SimpleTerminalOut.ino], [http://www.fabglib.org/_v_g_a_2_altair8800_2_altair8800_8ino-example.html#_a9 VGA/Altair8800/Altair8800.ino], [http://www.fabglib.org/_v_g_a_2_ansi_terminal_2_ansi_terminal_8ino-example.html#_a2 VGA/AnsiTerminal/AnsiTerminal.ino], [http://www.fabglib.org/_v_g_a_2_loopback_terminal_2_loopback_terminal_8ino-example.html#_a2 VGA/LoopbackTerminal/LoopbackTerminal.ino], [http://www.fabglib.org/_v_g_a_2_multitasking_c_p_m_2_multitasking_c_p_m_8ino-example.html#_a12 VGA/MultitaskingCPM/MultitaskingCPM.ino], [http://www.fabglib.org/_v_g_a_2_network_terminal_2_network_terminal_8ino-example.html#_a2 VGA/NetworkTerminal/NetworkTerminal.ino], [http://www.fabglib.org/_v_g_a_2_simple_terminal_out_2_simple_terminal_out_8ino-example.html#_a1 VGA/SimpleTerminalOut/SimpleTerminalOut.ino], [http://www.fabglib.org/_v_g_a_2_simple_text_terminal_out_2_simple_text_terminal_out_8ino-example.html#_a1 VGA/SimpleTextTerminalOut/SimpleTextTerminalOut.ino], and [http://www.fabglib.org/_v_g_a_2_songs_2_songs_8ino-example.html#_a3 VGA/Songs/Songs.ino].
  
Definition at line 953 of file terminal.h.
+
[http://www.fabglib.org/terminal_8h_source.html#l00953 Definition at line 953 of file terminal.h].
  
  

2022年3月23日 (水) 12:14時点における最新版

class Terminal

ANSI-VT100互換のディスプレイ端末。

#include <terminal.h>

ストリームを継承します。

Public Member Functions

void activate (TerminalTransition transition=TerminalTransition::None)
この端子を入出力用にアクティブにします。
int available ()
キーボードキューで使用可能なコードの数を取得します。
int availableForWrite ()
表示入力キューが引き続き受け入れることができるコードの数を決定します。
bool begin (BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)
端末を初期化します。
Canvas * canvas ()
関連するキャンバスオブジェクトを取得します。
void clear (bool moveCursor=true)
画面をクリアします。
void connectLocally ()
ローカルでの端末の使用を許可します。
void connectSerialPort (HardwareSerial &serialPort, bool autoXONXOFF=true)
指定されたシリアルポートを使用してリモートホストを接続します。
void connectSerialPort (uint32_t baud, uint32_t config, int rxPin, int txPin, FlowControl flowControl, bool inverted=false, int rtsPin=-1, int ctsPin=-1)
UARTを使用してリモートホストを接続します。
bool CTSStatus ()
現在のCTS信号ステータスを報告します。
void deactivate ()
この端末を非アクティブにします。
void disableSerialPortRX (bool value)
シリアルポートRXを無効/有効にします。
void disconnectLocally ()
ローカルでの端末の使用を回避します。
void enableCursor (bool value)
カーソルを有効または無効にします。
void end ()
ターミナルを完成させます。
void flowControl (bool enableRX)
ホストがデータを送信することを許可/禁止します。
bool flowControl ()
ホストがデータを受信できるかどうかを確認します。
void flush (bool waitVSync)
ディスプレイに送信されたすべてのコードが処理されるのを待ちます。
void flush ()
ディスプレイに送信されたすべてのコードが処理されるのを待ちます。
int getColumns ()
列数を返します。
int getRows ()
行数を返します。
bool isActive ()
この端末がアクティブかどうかを判別します。
Keyboard * keyboard ()
関連するキーボードオブジェクトを取得します。
void loadFont (FontInfo const *font)
使用するフォントを設定します。
void localInsert (uint8_t c)
キーをキーボードキューに挿入します。
void localWrite (uint8_t c)
キーをキーボードキューに挿入します。
void localWrite (char const *str)
キーの文字列をキーボードキューに挿入します。
int peek ()
次のコードに進むことなく、キーボードからコードを読み取ります。
void pollSerialPort ()
着信データ用にシリアルポートをプールします。
int read ()
キーボードからコードを読み取ります。
int read (int timeOutMS)
キーボード指定タイムアウトからコードを読み取ります。
bool RTSStatus ()
現在のRTS信号ステータスを報告します。
void send (uint8_t c)
localWrite()と同様ですが、接続されている場合はシリアルポートにも送信します。
void send (char const *str)
localWrite()と同様ですが、接続されている場合はシリアルポートにも送信します。
void setBackgroundColor (Color color, bool setAsDefault=true)
背景色を設定します。
void setColorForAttribute (CharStyle attribute, Color color, bool maintainStyle)
指定した属性の色を選択します。
void setColorForAttribute (CharStyle attribute)
指定された属性の色を無効にします。
void setForegroundColor (Color color, bool setAsDefault=true)
前景色を設定します。
void setLogStream (Stream &stream)
デバッグログを出力するストリームを設定します。
void setRTSStatus (bool value)
RTS信号のステータスを設定します。
oid setTerminalType (TermType value)
エミュレートする端末タイプを設定します。
SoundGenerator * soundGenerator ()
埋め込まれたサウンドジェネレータを取得します。
TermInfo const & terminalType ()
現在の端末タイプを決定します。
void unRead (uint8_t c)
キーをキーボードキューに挿入します。
bool waitFor (int value, int timeOutMS=-1)
キーボードから特定のコードを待ち、以前のコードをすべて破棄します。
size_t write (const uint8_t *buffer, size_t size)
指定された数のコードをディスプレイに送信します。
size_t write (uint8_t c)
単一のコードをディスプレイに送信します。
bool XOFFStatus ()
TXがアクティブかどうかを報告します。

Public Attributes

Delegate< char const * > onUserSequence
新しいユーザーシーケンスが受信されるたびに、デリゲートが呼び出されます。
Delegate< VirtualKey *, bool > onVirtualKey
キーボードから新しい仮想キーを受信するたびに、デリゲートが呼び出されます。
Delegate< VirtualKeyItem * > onVirtualKeyItem
シフト状態を含め、キーボードから新しい仮想キーを受信するたびに、デリゲートが呼び出されます。

Static Public Attributes

static int inputConsumerTaskStackSize = 2048
ターミナル入力ストリームを処理するタスクのスタックサイズ。
static int inputQueueSize = 1024
端末が一時停止せずに「書き込む」ことができる文字数(シリアルポートで文字が失われた場合は増加します)。
static int keyboardReaderTaskStackSize = 2048
キーボードからキーを読み取り、ANSI/VTコードをTerminalの出力ストリームに送信するタスクのスタックサイズです。

Detailed Description

ANSI-VT100互換のディスプレイ端末。

非CSIコード(RIS、IND、DECID、DECDHLなど)など、一般的なANSI、VT52、VT100、VT200、VT300、VT420、およびVT500エスケープコードのほとんどを実装します。

CSIコード(プライベートモード、CUP、TBCなど)、CSI-SGRコード(太字、斜体、点滅など)、DCSコード(DECRQSSなど)のように。

PS / 2キーボード仮想キーからANSIまたはVTコード(キーパッド、カーソルキー、ファンクションキーなど)への変換をサポートします。

端末は、シリアルポートから表示するコードを受信することも、アプリケーションから直接制御することもできます。同様に、ターミナルはキーボードコードをシリアルポートまたはアプリケーションに直接送信できます。

デフォルトでは、640x350で80x25または132x25文字をサポートします。ただし、カスタムフォントを指定すると、任意のカスタム解像度とテキストバッファサイズがサポートされます。

カーソルのスタイルには、点滅または非点滅の3つのスタイル(ブロック、下線、バー)があります。

ターミナルはStreamを継承するため、アプリケーションはすべてのStreamおよびPrint入力および出力メソッドを使用できます。

ターミナルは、VTTEST VT100/VT102互換性テストスコアシートの95/110に合格します。

Example1:

fabgl::VGAController VGAController;

fabgl::PS2Controller PS2Controller;

fabgl::Terminal      Terminal;

// Setup 80x25 columns loop-back terminal (send what you type on keyboard to the display)

void setup() {

  PS2Controller.begin(PS2Preset::KeyboardPort0);

  VGAController.begin();

  VGAController.setResolution(VGA_640x350_70HzAlt1);

  Terminal.begin(&VGAController);

  Terminal.connectLocally();      // to use Terminal.read(), available(), etc..

  Terminal.enableCursor(true);

}

void loop() {

  if (Terminal.available()) {

    char c = Terminal.read();

    switch (c) {

      case 0x7F:       // DEL -> backspace + ESC[K

        Terminal.write("\b\e[K");

        break;

      case 0x0D:       // CR  -> CR + LF

        Terminal.write("\r\n");

        break;

      case 32 ... 126: // printable chars

        Terminal.write(c);

        break;

    }

  }

}

Example2:

fabgl::VGAController VGAController;

fabgl::PS2Controller PS2Controller;

fabgl::Terminal      Terminal;

// Setup 80x25 columns terminal using UART2 to communicate with the server,

// VGA to display output and PS2 device as keyboard input

void setup() {

  Serial2.begin(115200);

  PS2Controller.begin(PS2Preset::KeyboardPort0);

  VGAController.begin();

  VGAController.setResolution(VGA_640x350_70HzAlt1);

  Terminal.begin(&VGAController);

  Terminal.connectSerialPort(Serial2);

  Terminal.enableCursor(true);

}

void loop() {

  Terminal.pollSerialPort();

}

Examples:

Others/KeyboardScanCodes/KeyboardScanCodes.ino, Others/KeyboardVirtualKeys/KeyboardVirtualKeys.ino, SSD1306_OLED/128x32/SimpleTerminalOut/SimpleTerminalOut.ino, SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino, SSD1306_OLED/128x64/RTClock/RTClock.ino, SSD1306_OLED/128x64/SimpleTerminalOut/SimpleTerminalOut.ino, ST7789_TFT/240x240/SimpleTerminalOut/SimpleTerminalOut.ino, VGA/Altair8800/Altair8800.ino, VGA/AnsiTerminal/AnsiTerminal.ino, VGA/LoopbackTerminal/LoopbackTerminal.ino, VGA/MultitaskingCPM/MultitaskingCPM.ino, VGA/NetworkTerminal/NetworkTerminal.ino, VGA/SimpleTerminalOut/SimpleTerminalOut.ino, VGA/SimpleTextTerminalOut/SimpleTextTerminalOut.ino, and VGA/Songs/Songs.ino.

Definition at line 953 of file terminal.h.



The documentation for this struct was generated from the following file:

  • terminal.h
  • terminal.cpp



戻る