Skip to content

Commit

Permalink
add deep sleep, add update interface, add header, fix traning print bug
Browse files Browse the repository at this point in the history
  • Loading branch information
atdeveloper committed Nov 28, 2014
1 parent 4649f10 commit 0b042c5
Show file tree
Hide file tree
Showing 16 changed files with 337 additions and 51 deletions.
22 changes: 14 additions & 8 deletions at/driver/uart.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
/******************************************************************************
* Copyright 2013-2014 Espressif Systems (Wuxi)
/*
* File : uart.c
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* FileName: uart.c
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* Description: Two UART mode configration and interrupt handler.
* Check your hardware connection while use this mode.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Modification history:
* 2014/3/12, v1.0 create this file.
*******************************************************************************/
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ets_sys.h"
#include "osapi.h"
#include "driver/uart.h"
Expand Down
17 changes: 17 additions & 0 deletions at/include/at.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* File : at.h
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __AT_H
#define __AT_H

Expand Down
19 changes: 18 additions & 1 deletion at/include/at_version.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
/*
* File : at_version.h
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __AT_VERSION_H__
#define __AT_VERSION_H__

#define AT_VERSION_main 0x00
#define AT_VERSION_sub 0x19

//#define AT_VERSION (AT_VERSION_main << 8 | AT_VERSION_sub)
#define AT_VERSION "AT 0020"
#define AT_VERSION "0020"

#endif
17 changes: 17 additions & 0 deletions at/include/driver/uart.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* File : uart.h
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UART_APP_H
#define UART_APP_H

Expand Down
17 changes: 14 additions & 3 deletions at/include/driver/uart_register.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
//Generated at 2012-07-03 18:44:06
/*
* Copyright (c) 2010 - 2011 Espressif System
* File : uart_register.h
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef UART_REGISTER_H_INCLUDED
#define UART_REGISTER_H_INCLUDED
#define REG_UART_BASE( i ) (0x60000000+(i)*0xf00)
Expand Down
17 changes: 17 additions & 0 deletions at/include/user_config.h
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
/*
* File : user_config.h
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

28 changes: 28 additions & 0 deletions at/user/at_baseCmd.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* File : at_baseCmd.c
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include "osapi.h"
#include "c_types.h"
Expand Down Expand Up @@ -245,6 +262,17 @@ at_setupCmdIpr(uint8_t id, char *pPara)
// // spi_flash_read(60 * 4096, (uint32 *)&upFlag, sizeof(updateFlagType));
at_backOk;
}

void ICACHE_FLASH_ATTR
at_setupCmdGslp(uint8_t id, char *pPara)
{
uint32_t n;
pPara++;

n = atoi(pPara);
at_backOk;
system_deep_sleep(n*1000);
}
/**
* @}
*/
Expand Down
20 changes: 20 additions & 0 deletions at/user/at_baseCmd.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* File : at_baseCmd.h
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __AT_BASECMD_H
#define __AT_BASECMD_H

Expand All @@ -12,4 +29,7 @@ void at_setupCmdIpr(uint8_t id, char *pPara);
#ifdef ali
void at_setupCmdMpinfo(uint8_t id, char *pPara);
#endif

void at_setupCmdGslp(uint8_t id, char *pPara);

#endif
28 changes: 23 additions & 5 deletions at/user/at_cmd.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* File : at_cmd.c
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "at_cmd.h"
#include "user_interface.h"
#include "osapi.h"
Expand Down Expand Up @@ -105,7 +122,7 @@ at_cmdProcess(uint8_t *pAtRcvData)
}
else
{
uart0_sendStr("no this fun\r\n");
at_backError;
}
}
else if(*pAtRcvData == '?' && (pAtRcvData[1] == '\r'))
Expand All @@ -116,7 +133,7 @@ at_cmdProcess(uint8_t *pAtRcvData)
}
else
{
uart0_sendStr("no this fun\r\n");
at_backError;
}
}
else if((*pAtRcvData == '=') && (pAtRcvData[1] == '?') && (pAtRcvData[2] == '\r'))
Expand All @@ -127,7 +144,7 @@ at_cmdProcess(uint8_t *pAtRcvData)
}
else
{
uart0_sendStr("no this fun\r\n");
at_backError;
}
}
else if((*pAtRcvData >= '0') && (*pAtRcvData <= '9') || (*pAtRcvData == '='))
Expand All @@ -138,12 +155,13 @@ at_cmdProcess(uint8_t *pAtRcvData)
}
else
{
uart0_sendStr("no this fun\r\n");
// uart0_sendStr("no this fun\r\n"); //Relax, it's just a code.
at_backError;
}
}
else
{
uart0_sendStr("enter error\r\n");
at_backError;
}
}
else
Expand Down
21 changes: 20 additions & 1 deletion at/user/at_cmd.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* File : at_cmd.h
* This file is part of Espressif's AT+ command set program.
* Copyright (C) 2013 - 2016, Espressif Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __AT_CMD_H
#define __AT_CMD_H

Expand All @@ -6,13 +23,14 @@
#include "at_ipCmd.h"
#include "at_baseCmd.h"

#define at_cmdNum 30
#define at_cmdNum 32

at_funcationType at_fun[at_cmdNum]={
{NULL, 0, NULL, NULL, NULL, at_exeCmdNull},
{"E", 1, NULL, NULL, at_setupCmdE, NULL},
{"+RST", 4, NULL, NULL, NULL, at_exeCmdRst},
{"+GMR", 4, NULL, NULL, NULL, at_exeCmdGmr},
{"+GSLP", 5, NULL, NULL, at_setupCmdGslp, NULL},
{"+IPR", 4, NULL, NULL, at_setupCmdIpr, NULL},
#ifdef ali
{"+UPDATE", 7, NULL, NULL, NULL, at_exeCmdUpdate},
Expand All @@ -39,6 +57,7 @@ at_funcationType at_fun[at_cmdNum]={
{"+CIPSTO", 7, NULL, at_queryCmdCipsto, at_setupCmdCipsto, NULL},
{"+CIUPDATE", 9, NULL, NULL, NULL, at_exeCmdCiupdate},
{"+CIPING", 7, NULL, NULL, NULL, at_exeCmdCiping},
{"+CIPAPPUP", 9, NULL, NULL, NULL, at_exeCmdCipappup},
#ifdef ali
{"+MPINFO", 7, NULL, NULL, at_setupCmdMpinfo, NULL}
#endif
Expand Down
Loading

0 comments on commit 0b042c5

Please sign in to comment.