📄 ttyio.h
字号:
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This software is copyrighted by and is the sole property of
* VIA Networking Technologies, Inc. This software may only be used
* in accordance with the corresponding license agreement. Any unauthorized
* use, duplication, transmission, distribution, or disclosure of this
* software is expressly forbidden.
*
* This software is provided by VIA Networking Technologies, Inc. "as is"
* and any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose
* are disclaimed. In no event shall VIA Networking Technologies, Inc.
* be liable for any direct, indirect, incidental, special, exemplary, or
* consequential damages.
*
*
* File: ttyio.h
*
* Purpose: Terminal basic I/O functions
*
* Author: Jenda Jao
*
* Date: Jan 08, 2002
*
*/
#ifndef __TTYIO_H__
#define __TTYIO_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions ------------------------*/
// key define
#define KEY_ENTER 0x0D
#define KEY_SPACE 0x20
#define KEY_TAB 0x09
#define KEY_BKSPC 0x08
#define KEY_ESC 0x1B
// virtual key (control key): not really defined in ASCII
#define KEY_DISCONNECT 0xFF
#define KEY_REFRESH 0xFE
#define KEY_ARROW_UP 0xE0 // ^^[A
#define KEY_ARROW_DOWN 0xE1 // ^^[B
#define KEY_ARROW_RIGHT 0xE2 // ^^[C
#define KEY_ARROW_LEFT 0xE3 // ^^[D
#define KEY_PAGE_UP 0xE4
#define KEY_PAGE_DOWN 0xE5
#define KEY_HOME 0xE6
#define KEY_END 0xE7
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Macros -----------------------------*/
// sprint dec
#define TTYvPutDec(val) TTYvSPutDec(NULL, val)
//sprint hex
#define TTYvPutHex(val) TTYvSPutHex(NULL, val)
// Clear screen
#define TTYvClearScrn() TTYvPutString("\x1B[2J")
// Set printing chars into color-reversed mode
#define TTYvRevChar() TTYvPutString("\x1B[7m")
// Set printing chars into non-reversed mode
#define TTYvRstChar() TTYvPutString("\x1B[0m")
// Set printing chars into color-reversed mode
#define TTYvUnderlineChar() TTYvPutString("\x1B[4m")
// back space
#define TTYvBackspace() TTYvPutString("\x08 \x08")
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
//
// Basic UART IO functions
//
// Get a key and polling interrupt
char TTYcGetChar(void) DIRECT_FUNTYPE_REENT;
// get string
// byStrLen do not include '\0'
// bPutStar:1 -> replace input key by '*' for password input
void TTYvGetString(PSTR pstr, UINT8 byStrLen, BOOL bPutStar) DIRECT_FUNTYPE_REENT;
// print a char
void TTYvPutChar(char c) DIRECT_FUNTYPE_REENT;
//// print string dec hex, share with sprintf
// Print string
void TTYvPutString(char* strBuf) DIRECT_FUNTYPE_REENT;
// print dec
void TTYvSPutDec(char* strBuf, UINT16 u16Value) DIRECT_FUNTYPE_REENT;
// print hex
void TTYvSPutHex(char* strBuf, UINT16 u16Value) DIRECT_FUNTYPE_REENT;
//
// ANSI screen control functions
//
// Set cursor to specific position
void TTYvSetCurPos(UINT8 byRow, UINT8 byCol) DIRECT_FUNTYPE_REENT;
// Put string at specific position
void TTYvPutPosStr(UINT8 byRow, UINT8 byCol, PSTR szOutput) DIRECT_FUNTYPE_REENT;
// Draw a line of specific char
void TTYvDrawLine(UINT8 byRow, UINT8 byCol, char cDrawChar, UINT8 byLen) DIRECT_FUNTYPE_REENT;
#endif /* __TTYIO_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -