本文主要用于记录纯MCU无OS下,AT 指令开发软件框架
#ifndef AT_COMMAND_H
#define AT_COMMAND_H
void AT_CMD_Process(uint8_t *uartBuffer, uint8_t dataLen);
/*描述AT指令返回值的错误原因*/
typedef enum eATEerror
{
AT_OK = 0,
AT_ERROR,
AT_PARAM_ERROR,
AT_BUSY_ERROR,
AT_TEST_PARAM_OVERFLOW,
AT_NO_NET_JOINED,
AT_RX_ERROR,
AT_NO_CLASS_B_ENABLE,
AT_DUTYCYCLE_RESTRICTED,
AT_CRYPTO_ERROR,
AT_MAX,
} ATEerror_t;
/** @brief Structure defining an AT Command */
struct ATCommand_s
{
const char *string; /*< command string, after the "AT" */
const int32_t size_string; /*< size of the command string, not including the final \0 */
ATEerror_t (*get)(const char *param); /*< =? after the string to get the current value*/
ATEerror_t (*set)(const char *param); /*< = (but not =?\0) after the string to set a value */
ATEerror_t (*run)(const char *param); /*< \0 after the string - run the command */
const char *help_string; /*< to be printed when ? after the string */
};
/* AT Command strings. Commands start with AT */
/* General commands */
#define AT_RESET "Z" // soft reset
#define AT_SOFT_VERSON "+GVER" // read soft version
#define AT_UART_BAUD "+BAUD" // get or set uart baud rate
#endif
#include "ch58x_AT_command.h"
#include