Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial mbed-rtos mbed
Fork of NucleoF401_ESP8622 by
Diff: esp8622.cpp
- Revision:
- 1:4a50b910342c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/esp8622.cpp Wed Feb 18 13:41:07 2015 +0000
@@ -0,0 +1,64 @@
+/* ---------------------------------------------------------------------------
+** This software is in the public domain, furnished "as is", without technical
+** support, and with no warranty, express or implied, as to its usefulness for
+** any purpose.
+**
+** esp8622.ccp
+** NodeMCU serial comminication STM32F401RE Nucleo Board
+** Author: <veyselka@hotmail.com> <v.karadag@gmail.com> Veysel KARADAG
+** -------------------------------------------------------------------------*/
+
+#include "esp8622.h"
+#include "mbed.h"
+
+
+char rx_buffer[255];
+
+int esp8622::sendATTest(void)
+{
+ char resp[32];
+
+ sendCmd("AT\r\n");
+ memset(resp,0,32);
+ readFromBuffer(resp,DEFAULT_TIMEOUT,10);
+
+ if(strncmp(resp,"AT\r\r\n\r\nOK",9)==0)
+ return 1;
+ else
+ return 0;
+
+
+}
+
+void esp8622::sendCmd(const char* cmd)
+{
+ esp8622_com.clear();
+ esp8622_com.puts(cmd);
+}
+
+
+int esp8622::readFromBuffer(char *resp,unsigned int timeout,unsigned int len )
+{
+
+ timeCnt.start();
+ int i=0;
+
+ while(1) {
+
+ if(esp8622_com.readable()) {
+ char c = esp8622_com.getc();
+ resp[i]=c;
+ i++;
+ if(i>=len)
+ break;
+ }
+
+ if(timeCnt.read() > timeout) {
+ break;
+ }
+ }
+ timeCnt.stop();
+ timeCnt.reset();
+ // printf("RESP:%s:\r\n",resp);
+ return 0;
+}
