GainSpan Wi-Fi library see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Fork of GSwifi_old by gs fan

GainSpan Wi-Fi library

The GS1011 is an ultra low power 802.11b wireless module from GainSpan.

see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Information

Please change the baud rate in advance.

  • ATB=115200
  • AT&W0

It may be better and sometimes faster.
GSwifi gs(p13, p14, baud);

Heavily modified new library: http://mbed.org/users/gsfan/code/GSwifi

ゲインスパン Wi-Fi モジュール ライブラリ

ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011 シリーズ用のライブラリです。

解説: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Information

モジュールはあらかじめ次のコマンドでボーレートを変更しておく。

  • ATB=115200
  • AT&W0

場合によってはもっと高速の方がいいかもしれない。クラス宣言時にレート設定をする。
GSwifi gs(p13, p14, baud);

大幅に更新された新しいライブラリ: http://mbed.org/users/gsfan/code/GSwifi

Revision:
14:9e89b922ace1
Parent:
13:03b420e152b7
Child:
15:5febfc399099
--- a/GSwifi.cpp	Tue Sep 11 04:01:49 2012 +0000
+++ b/GSwifi.cpp	Fri Oct 05 16:42:50 2012 +0000
@@ -209,9 +209,9 @@
                 _gs_sock[_cid].data->put(dat);
                 len ++;
                 if (len < GS_DATA_SIZE && _gs_sock[_cid].data->available() == 0) {
-                	// buffer full
-                	if (_gs_sock[_cid].onGsReceive != NULL) {
-                    	_gs_sock[_cid].onGsReceive(_cid, _gs_sock[_cid].data->use());
+                    // buffer full
+                    if (_gs_sock[_cid].onGsReceive != NULL) {
+                        _gs_sock[_cid].onGsReceive(_cid, _gs_sock[_cid].data->use());
                     }
                 }
             }
@@ -275,8 +275,8 @@
             }
             len  --;
             if (len && _gs_sock[_cid].data->available() == 0) {
-            	// buffer full
-            	if (_gs_sock[_cid].onGsReceive != NULL) {
+                // buffer full
+                if (_gs_sock[_cid].onGsReceive != NULL) {
                     _gs_sock[_cid].onGsReceive(_cid, _gs_sock[_cid].data->use());
                 }
             }
@@ -304,9 +304,9 @@
         // dummy CR+LF
         _gs.printf("\r\n");
         for (i = 0; i < 10; i ++) {
-        	wait_ms(10);
-        	poll();
-        	_buf_cmd.clear();
+            wait_ms(10);
+            poll();
+            _buf_cmd.clear();
         }
         return 0;
     }
@@ -866,7 +866,6 @@
         while (_buf_cmd.use() && i < sizeof(buf)) {
             _buf_cmd.get(&buf[i]);
             if (buf[i] == '\n') {
-                if (i == 0) continue;
                 break;
             }
             i ++;
@@ -874,6 +873,8 @@
         buf[i] = 0;
         DBG("poll: %s\r\n", buf);
 
+        if (i == 0) {
+        } else
         if (strncmp(buf, "CONNECT", 7) == 0 && buf[8] >= '0' && buf[8] <= 'F') {
             i = x2i(buf[8]);
             if (_gs_sock[i].type == GSTYPE_SERVER) {