【AT 指令开发】软件框架与接口

发布时间:2024-01-12 11:33:40

本文主要用于记录纯MCU无OS下,AT 指令开发软件框架

1 软件逻辑

在这里插入图片描述

2.代码

2.1 at_command.h

#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

2.2 at_command.c

#include "ch58x_AT_command.h"
#include 
文章来源:https://blog.csdn.net/qq_39217004/article/details/135547769
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。