v1
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* \file shell.h
|
||||
*
|
||||
* \brief The head file of shell.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SHELL_H__
|
||||
#define __SHELL_H__
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
#include "shell_handler.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define XC_DATA_LEN 64U
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
TypeDef
|
||||
-------------------------------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
XC_SHELL_CMD_RECV = 0,
|
||||
XC_SHELL_CMD_PROC
|
||||
} eXC_Shell_Proc_state;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *cmd;
|
||||
eXC_Cmd_State (*fn)(eCMD_Type opt, int srgc, char *srgv[]);
|
||||
} XC_Cmd_Table_t;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void xc_shell_test_case(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SHELL_H__ */
|
||||
@@ -0,0 +1,93 @@
|
||||
/*!
|
||||
* \file shell.h
|
||||
*
|
||||
* \brief The head file of shell_handler.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SHELL_HANDLER_H__
|
||||
#define __SHELL_HANDLER_H__
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define XC_CMD_SIZE 255U
|
||||
|
||||
// XC Command
|
||||
#define XC_OK "OK"
|
||||
#define XC_ERROR "+CME ERROR:"
|
||||
|
||||
#define XC_CMD_TEST "+TEST"
|
||||
#define XC_CMD_BLE_MAC "+BMACADDR"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
TypeDef
|
||||
-------------------------------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
XC_CMD_ERROR = -1,
|
||||
XC_CMD_SUCCESS = 0
|
||||
} eXC_Cmd_State;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QUERY_CMD = 0x00,
|
||||
SET_CMD
|
||||
} eCMD_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t byte0;
|
||||
uint8_t byte1;
|
||||
uint8_t byte2;
|
||||
uint8_t byte3;
|
||||
uint8_t byte4;
|
||||
uint8_t byte5;
|
||||
} BLE_Mac_Addr_t;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
extern uint8_t XC_Cmd[XC_CMD_SIZE];
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
eXC_Cmd_State xc_test_handler(eCMD_Type opt, int srgc, char *srgv[]);
|
||||
eXC_Cmd_State xc_ble_mac_addr_handler(eCMD_Type opt, int srgc, char *srgv[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SHELL_HANDLER_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user