📄 tty.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: tty.h
*
* Purpose: TTY basic I/O functions
*
* Author: Jenda Jao
*
* Date: Jan 08, 2002
*
*/
#ifndef __TTY_H__
#define __TTY_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions ------------------------*/
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Macros -----------------------------*/
#define TTY_vClearScrn() TTY_vPutStr("\x1B[2J")
// Set printing chars into color-reversed mode
#define TTY_vRevChar() TTY_vPutStr("\x1B[7m")
// Set printing chars into non-reversed mode
#define TTY_vRstChar() TTY_vPutStr("\x1B[0m")
// Set printing chars into color-reversed mode
#define TTY_vUnderlineChar() TTY_vPutStr("\x1B[4m")
// back space
#define TTY_vBackspace() TTY_vPutStr("\x08 \x08")
//background color
#define TTY_vBG_Green() TTY_vPutStr("\x1B[42m")
#define TTY_vBG_Blue() TTY_vPutStr("\x1B[44m")
#define TTY_vBG_Purple() TTY_vPutStr("\x1B[45m")
#define TTY_vBG_Cyan() TTY_vPutStr("\x1B[46m")
//character color
#define TTY_vChar_LightGreen() TTY_vPutStr("\x1B[1;32m")
#define TTY_vChar_Red() TTY_vPutStr("\x1B[31m")
#define TTY_vChar_Green() TTY_vPutStr("\x1B[32m")
#define TTY_vChar_Yellow() TTY_vPutStr("\x1B[33m")
//background plus character color
#define TTY_vBG_Green_WhiteChar() TTY_vPutStr("\x1B[42;37m")
#define TTY_vBG_Blue_BlackChar() TTY_vPutStr("\x1B[44;30m")
#define TTY_vBG_Blue_RedChar() TTY_vPutStr("\x1B[44;31m")
#define TTY_vBG_Blue_LightRedChar() TTY_vPutStr("\x1B[1;44;31m")
#define TTY_vBG_Blue_GreenChar() TTY_vPutStr("\x1B[44;32m")
#define TTY_vBG_Blue_YellowChar() TTY_vPutStr("\x1B[44;33m")
#define TTY_vBG_Blue_WhiteChar() TTY_vPutStr("\x1B[44;37m")
#define TTY_vBG_Purple_WhiteChar() TTY_vPutStr("\x1B[45;37m")
#define TTY_vBG_Purple_YellowChar() TTY_vPutStr("\x1B[45;33m")
#define TTY_vBG_Purple_BlackChar() TTY_vPutStr("\x1B[45;30m")
#define TTY_vBG_Purple_GreenChar() TTY_vPutStr("\x1B[45;32m")
#define TTY_vBG_Black_WhiteChar() TTY_vPutStr("\x1B[40;37m")
#define TTY_vBG_White_BlackChar() TTY_vPutStr("\x1B[47;30m")
#define TTY_vBG_Blue_YellowChar_Line() TTY_vPutStr("\x1B[4;44;33m")
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
// Get a key and polling interrupt
char TTY_cGetChar(void);
// Get string
// byStrLen do not include '\0'
// bPutStar:1 -> replace input key by '*' for password input
void TTY_vGetStr(PSTR pstr, UINT8 byStrLen, UINT8 byMode);
// Print string
void TTY_vPutStr(char* strBuf);
// Print dec
void TTY_vPutDec(UINT16 u16Value);
void TTY_vPutU32Dec(UINT32 u32Value);
// Print hex
void TTY_vPutHex(UINT16 u16Value);
void TTY_vPutU32Hex(UINT32 u32Value);
void TTY_vPrintfHex(PSTR pszStr, UINT32 u32HexVal);
void TTY_vPrintf(const char * format, ...);
//
// ANSI screen control functions
//
// Set cursor to specific position
void TTY_vSetCurPos(UINT8 byRow, UINT8 byCol);
// Put string at specific position
void TTY_vPutStrOnPos(UINT8 byRow, UINT8 byCol, PSTR szOutput);
// Draw a line of specific char
void TTY_vDrawLine(UINT8 byRow, UINT8 byCol, char cDrawChar, UINT8 byLen);
#endif /* __TTY_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -