telnet/demo_for_arm_board/inc/shell.h

77 lines
3.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** function comment
* @Author: 陈逸凡 1343619937@qq.com
* @Date: 2024-04-02 13:45:24
* @LastEditors: 陈逸凡 1343619937@qq.com
* @LastEditTime: 2024-04-23 09:52:30
* @FilePath: \com.quaero.soc.fluorescence\module\common\shell\inc\shell.h
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
/*- Coding With UTF-8 -*/
/*******************************************************************************
* File Name shell.h
* Description 此文件提供了shell的相关配置声明
* Atuhor Letter
* Date: 2018/4/20
*******************************************************************************/
#ifndef __SHELL_H__
#define __SHELL_H__
#include <config.h>
/*------------------------------宏定义----------------------------------------*/
#define SHELL_VERSION "v1.5" //版本
#define SHELL_USE_PARAMETER 1 //是否使用带参函数
#define SHELL_USE_HISTORY 1 //是否使用历史命令
//#define shellUart huart1 //shell使用的串口
#define SHELL_COMMAND_MAX_LENGTH 100 //shell命令最大长度
#define SHELL_PARAMETER_MAX_LENGTH 25 //shell命令参数最大长度
#define SHELL_PARAMETER_MAX_NUMBER 20 //shell命令参数最大数量
#define SHELL_HISTORY_MAX_NUMBER 5 //历史命令记录数量
#define SHELL_COMMAND "\r\n>>"
#define shellDisplay(x) _ShellDisplay((uint8_t *) (x));
/*---------------------------函数指针定义-------------------------------------*/
typedef void (*shellFunction)(char *args);
/*----------------------------结构体定义--------------------------------------*/
typedef struct
{
const char *name; //shell命令名称
shellFunction function; //shell命令函数
const char *desc; //shell命令描述
}SHELL_CommandTypeDef; //shell命令定义
typedef enum
{
CONTROL_FREE = 0,
CONTROL_STEP_ONE,
CONTROL_STEP_TWO,
}CONTROL_Status;
/*****************************internal function declare**********************/
#define isReadChar(a) ((a>='a'&& a<='z')||(a>='A'&&a<='Z')||(a>='0'&&a<='9'))
#define searchChar(a) {while(isReadChar(*a)==0){a++;}}
char *getArg(char *input, char *output);
float ana_float(char *arg);
#define PART_SIZE(a) (sizeof(a) / sizeof(a[0]))
void shellShowCommandList(char *args); //显示所有shell命令
void shellLetter(char *args); //显示shell信息
void shellReboot(char *args); //重启系统
void shellClear(char *args); //shell清屏
extern void user_print(char *format, ...);
void key_handle(char *c);
#endif