📄 consol.h
字号:
/*------------------------------------------------------------------------------------------------------------------
* consol.h --
*
*
*
------------------------------------------------------------------------------------------------------------------*/
#ifndef __H_CONSOL__
#define __H_CONSOL__
//为了C++语言中兼容。
#ifdef __cplusplus
extern "C" {
#endif
#include "type.h" // 包含基本类型和基本宏定义
/*---------------------------------------------------------------------------------------------------------------
* Interface Function Definition
---------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_select
* Description : This routine selects the consol port for active usage.
* Note(s) : The consol port must be UART1 or UART2.
---------------------------------------------------------------------------------------------------------------*/
void consol_select(int port);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_init
* Description : This routine initializes the consol port by setting its baud rate & FIFO buffer.
* Note(s) : Before calling this, consol_select needs to be called for selecting the consol port.
---------------------------------------------------------------------------------------------------------------*/
void consol_init(int wBaud, u8 bFifoFlag);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_getch
* Description : This routine waits for a character from the consol port & returns it.
---------------------------------------------------------------------------------------------------------------*/
char consol_getch(void);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_getchar
* Description : This routine reads a character from the consol port if available.
---------------------------------------------------------------------------------------------------------------*/
char consol_getchar(char * pbData);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_getstring
* Description : This routine waits for a string from the consol por & returns it.
---------------------------------------------------------------------------------------------------------------*/
void consol_getstring(char *pbString);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_getinteger
* Description : This routine waits for a Integer from the consol por & returns it.
---------------------------------------------------------------------------------------------------------------*/
int consol_getinteger(void);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_sendch
* Description : This routine waits till the character is sent. It also sends an extra carriage return character
* when sending a new line character
---------------------------------------------------------------------------------------------------------------*/
void consol_sendch(char bData);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_sendchar
* Description : This routine waits till the character is sent.
---------------------------------------------------------------------------------------------------------------*/
void consol_sendchar(char bData);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_sendstring
* Description : This routine waits till the string is sent.
---------------------------------------------------------------------------------------------------------------*/
void consol_sendstring(char *pbString);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_scanf
* Description : Reads input from the consol stream, under control of the string pointed to by format that specifies
* the admissible(可容许的) input sequences and how they are to be converted for assignment, using
* subsequent(接下去的,后来的) arguments as pointers to the object to receive the converted input.
* If there are insufficient(不足的,不充分的) arguments for the format, the behavior is undefined.
* If the format is exhausted(尽; 耗尽;用完地) while arguments remain(剩余), the excess arguments
* are ignored.
---------------------------------------------------------------------------------------------------------------*/
void consol_scanf(char *pcFmt,...);
/*---------------------------------------------------------------------------------------------------------------
* Routine : consol_printf
* Description : Writes outopt to the consol stream, under control of the string pointed to by format that
* specifies how subsequent arguments are converted for output. If there are insufficient argument
* for the format, the behavior is undefined. If the format is exhausted while arguments remain.
* the excess(过量的, 额外的) arguments are ignored.
---------------------------------------------------------------------------------------------------------------*/
void consol_printf(char *pcFmt,...);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -