|
@ -10,7 +10,7 @@ volatile uint16_t s_at_cmd_uart_rx_off = 0; |
|
|
volatile bool s_at_cmd_uart_rx_buf_is_processing = false; |
|
|
volatile bool s_at_cmd_uart_rx_buf_is_processing = false; |
|
|
|
|
|
|
|
|
static uint8_t at_rx_buf[at_processer_rx_buf_size]; |
|
|
static uint8_t at_rx_buf[at_processer_rx_buf_size]; |
|
|
//static uint8_t at_tx_buf[at_processer_tx_buf_size]; |
|
|
|
|
|
|
|
|
// static uint8_t at_tx_buf[at_processer_tx_buf_size]; |
|
|
|
|
|
|
|
|
/* AT指令表 */ |
|
|
/* AT指令表 */ |
|
|
const AT_cmd_func at_cmd_func[] = { |
|
|
const AT_cmd_func at_cmd_func[] = { |
|
@ -52,14 +52,14 @@ int mstrncmp(const char *s1, const char *s2, int n) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 指令执行函数 */ |
|
|
/* 指令执行函数 */ |
|
|
unsigned char at_cmd_test(unsigned char *p, unsigned char len) |
|
|
|
|
|
|
|
|
AT_STATUS at_cmd_test(unsigned char *p, unsigned char len) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
printf("AT+OK\r\n"); |
|
|
printf("AT+OK\r\n"); |
|
|
return 0; |
|
|
|
|
|
|
|
|
return AT_SUCCESS; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
unsigned char at_cmd_ip(unsigned char *p, unsigned char len) |
|
|
|
|
|
|
|
|
AT_STATUS at_cmd_ip(unsigned char *p, unsigned char len) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if (*p == '?') |
|
|
if (*p == '?') |
|
@ -72,7 +72,7 @@ unsigned char at_cmd_ip(unsigned char *p, unsigned char len) |
|
|
|
|
|
|
|
|
printf("AT+OK\r\n"); |
|
|
printf("AT+OK\r\n"); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
|
|
|
|
|
|
return AT_SUCCESS; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 查找指令表中对应的指令 */ |
|
|
/* 查找指令表中对应的指令 */ |
|
@ -98,10 +98,9 @@ unsigned char AT_cmd_search(unsigned char *p, unsigned char len) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* AT指令解析 */ |
|
|
/* AT指令解析 */ |
|
|
unsigned char at_cmd_parse(unsigned char *p, unsigned char len) |
|
|
|
|
|
|
|
|
AT_STATUS at_cmd_parse(unsigned char *p, unsigned char len) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
unsigned char ret = AT_SUCCESS; |
|
|
|
|
|
|
|
|
AT_STATUS ret = AT_SUCCESS; |
|
|
unsigned char index = 0; |
|
|
unsigned char index = 0; |
|
|
|
|
|
|
|
|
if (len < 4) |
|
|
if (len < 4) |
|
@ -178,7 +177,10 @@ void at_cmd_processer_try_process_data(void) |
|
|
|
|
|
|
|
|
if (s_at_cmd_uart_rx_buf_is_processing) |
|
|
if (s_at_cmd_uart_rx_buf_is_processing) |
|
|
{ |
|
|
{ |
|
|
at_cmd_parse(at_rx_buf, s_at_cmd_uart_rx_off); |
|
|
|
|
|
|
|
|
if (at_cmd_parse(at_rx_buf, s_at_cmd_uart_rx_off) != AT_SUCCESS) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("at cmd parse error\r\n"); |
|
|
|
|
|
} |
|
|
sys_critical_enter(); |
|
|
sys_critical_enter(); |
|
|
s_at_cmd_uart_rx_off = 0; |
|
|
s_at_cmd_uart_rx_off = 0; |
|
|
s_at_cmd_uart_rx_buf_is_processing = false; |
|
|
s_at_cmd_uart_rx_buf_is_processing = false; |
|
|