GSwifiInterface library (interface for GainSpan Wi-Fi GS1011 modules) Please see https://mbed.org/users/gsfan/notebook/GSwifiInterface/
Dependents: GSwifiInterface_HelloWorld GSwifiInterface_HelloServo GSwifiInterface_UDPEchoServer GSwifiInterface_UDPEchoClient ... more
Fork of WiflyInterface by
GainSpan Wi-Fi library
The GS1011/GS2100 is an ultra low power 802.11b wireless module from GainSpan.
mbed RTOS supported.
- about this library: http://mbed.org/users/gsfan/notebook/GSwifiInterface/
- about Wi-Fi module: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ゲインスパン Wi-Fi モジュール ライブラリ
ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011/GS2100 シリーズ用のライブラリです。
mbed RTOS に対応しています。(mbed2.0)
- このライブラリについて: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
- Wi-FIモジュールについて: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
- UARTコマンド、SPIデータインターフェースに対応しました。(2019/09)
Diff: GSwifi/GSwifi.cpp
- Revision:
- 22:d25a5a0d2497
- Parent:
- 21:6431364fc667
--- a/GSwifi/GSwifi.cpp Thu Jun 05 06:12:59 2014 +0000 +++ b/GSwifi/GSwifi.cpp Tue Sep 24 06:24:37 2019 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2013 gsfan, MIT License +/* Copyright (C) 2019 gsfan, MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -23,13 +23,21 @@ GSwifi * GSwifi::_inst; +#ifdef CFG_SPI_DATAINTERFACE +GSwifi::GSwifi(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, + PinName mosi, PinName miso, PinName sclk, PinName cs, PinName wake, + PinName alarm, int baud, int freq): + _gs(tx, rx), _spi(mosi, miso, sclk), _wake(wake), _reset(reset) +#else GSwifi::GSwifi(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud): _gs(tx, rx), _reset(reset) +#endif { _inst = this; memset(&_state, 0, sizeof(_state)); memset(&_con, 0, sizeof(_con)); _state.initialized = false; + _state.datainterface = false; _state.status = STAT_READY; _state.cid = -1; #ifdef CFG_EXTENDED_MEMORY1 @@ -57,6 +65,9 @@ setReset(true); initUart(cts, rts, alarm, baud); +#ifdef CFG_SPI_DATAINTERFACE + initSpi (cs, freq); +#endif setAlarm(true); wait_ms(10); setAlarm(false); @@ -75,7 +86,11 @@ if (!strlen(_state.name)) { strncpy(_state.name, CFG_DHCPNAME, sizeof(_state.name)); } +#ifdef CFG_SPI_DATAINTERFACE +// if (strstr( +#endif clearFlags(); + _state.buf->flush(); _state.mode = MODE_COMMAND; sendCommand(NULL, RES_NULL, 0); if (cmdE(false)) return -1; @@ -193,6 +208,7 @@ _state.wm = WM_ADHOCK; _state.initialized = true; clearFlags(); + _state.buf->flush(); _state.mode = MODE_COMMAND; sendCommand(NULL, RES_NULL, 0); if (cmdE(false)) return -1; @@ -243,6 +259,7 @@ strncpy(_state.name, CFG_DNSNAME, sizeof(_state.name)); } clearFlags(); + _state.buf->flush(); _state.mode = MODE_COMMAND; sendCommand(NULL, RES_NULL, 0); if (cmdE(false)) return -1;