Nucleo STM32 F401RE , NodeMCU and TCP Conneciton
Dependencies: BufferedSerial mbed-rtos mbed
Fork of NucleoF401_ESP8622 by
esp8622.h
00001 /* --------------------------------------------------------------------------- 00002 ** This software is in the public domain, furnished "as is", without technical 00003 ** support, and with no warranty, express or implied, as to its usefulness for 00004 ** any purpose. 00005 ** 00006 ** esp8622.h 00007 ** NodeMCU serial comminication STM32F401RE Nucleo Board 00008 ** Author: <veyselka@hotmail.com> <v.karadag@gmail.com> Veysel KARADAG 00009 ** -------------------------------------------------------------------------*/ 00010 00011 00012 00013 #ifndef __ESP8622_H__ 00014 #define __ESP8622_H__ 00015 00016 #include "mbed.h" 00017 #include "BufferedSerial.h" 00018 00019 00020 #define DEFAULT_TIMEOUT 5 00021 00022 00023 00024 00025 00026 enum DataType { 00027 CMD = 0, 00028 DATA = 1, 00029 }; 00030 00031 /** Modem class. 00032 * Used for Modem communication. attention that Modem module communicate with MCU in serial protocol 00033 */ 00034 00035 class esp8622 00036 { 00037 00038 public: 00039 /** Create Modem Instance 00040 * @param tx uart transmit pin to communicate with Modem 00041 * @param rx uart receive pin to communicate with Modem 00042 * @param baudRate baud rate of uart communication 00043 */ 00044 esp8622(PinName tx, PinName rx, int baudRate) : esp8622_com(tx, rx) { 00045 esp8622_com.baud(baudRate); 00046 }; 00047 00048 BufferedSerial esp8622_com; 00049 00050 /** send AT command to Modem module 00051 * @param cmd command array which will be send to GPRS module 00052 */ 00053 void sendCmd(const char* cmd); 00054 00055 /**send "AT" to Modem module 00056 */ 00057 int sendATTest(void); 00058 00059 /** check Modem module response before time out 00060 * @param *resp correct response which Modem module will return 00061 * @param *timeout waiting seconds till timeout 00062 * @returns 00063 * 0 on success 00064 * -1 on error 00065 */ 00066 int readFromBuffer(char *resp, unsigned int timeout,unsigned int len); 00067 00068 Timer timeCnt; 00069 00070 00071 }; 00072 00073 00074 #endif
Generated on Thu Jul 14 2022 01:59:02 by 1.7.2