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

Dependents:   GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more

Fork of GSwifi 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/

/media/uploads/gsfan/gs_im_002.jpg /media/uploads/gsfan/gs1011m_2.jpg

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

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

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

Revision:
36:a70b11e1560f
Parent:
35:515ec79792d3
Child:
37:e61ea8267415
--- a/GSwifi.h	Fri Jun 21 06:08:37 2013 +0000
+++ b/GSwifi.h	Mon Jun 24 07:36:48 2013 +0000
@@ -30,17 +30,15 @@
 #include "host.h"
 #include "ipaddr.h"
 #include "GSwifi_conf.h"
+#include <ctype.h>
 #include <stdlib.h>
-#include <ctype.h>
+#include <string.h>
 
 
 #ifdef GS_UART_DIRECT
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-#define _gs_getc() LPC_UART1->RBR
-#define _gs_putc(c) while(!(LPC_UART1->LSR & (1<<5))); LPC_UART1->THR = c
-#elif defined(TARGET_LPC11U24)
-#define _gs_getc() LPC_USART->RBR
-#define _gs_putc(c) while(!(LPC_USART->LSR & (1<<5))); LPC_USART->THR = c
+#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC11U24)
+#define _gs_getc() _uart->RBR
+#define _gs_putc(c) while(!(_uart->LSR & (1<<5))); _uart->THR = c
 #elif defined(TARGET_KL25Z)
 #error "no support GS_UART_DIRECT"
 #endif
@@ -364,16 +362,16 @@
      * tcp/udp client
      * @return CID, -1:failure
      */
-    int open (Host &host, GSPROTOCOL pro);
+    int open (Host &host, GSPROTOCOL pro, int port = 0);
 
-    int open (Host &host, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive) {
-        int cid = open(host, pro);
+    int open (Host &host, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive, int port = 0) {
+        int cid = open(host, pro, port);
         if (cid >= 0) _gs_sock[cid].onGsReceive.attach(ponGsReceive);
         return cid;
     }
     template<typename T>
-    int open (Host &host, GSPROTOCOL pro, T *object, void (T::*member)(int, int)) {
-        int cid = open(host, pro);
+    int open (Host &host, GSPROTOCOL pro, T *object, void (T::*member)(int, int), int port = 0) {
+        int cid = open(host, pro, port);
         if (cid >= 0) _gs_sock[cid].onGsReceive.attach(object, member);
         return cid;
     }
@@ -512,6 +510,14 @@
 protected:
     void reset ();
     int autobaud (int flg);
+    int waitCts (int ms = GS_TIMEOUT);
+
+    inline void _gs_puts (char *s) {
+        int i;
+        for (i = 0; i < strlen(s); i++) {
+            _gs_putc(s[i]);
+        }
+    }
 
     void parseResponse ();
     void parseCmdResponse (char *buf);
@@ -551,6 +557,11 @@
     Serial _gs;
     int _baud;
     bool _rts;
+#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
+    LPC_UART1_TypeDef *_uart;
+#elif defined(TARGET_LPC11U24)
+    LPC_USART_Type *_uart;
+#endif
     DigitalInOut _reset;
     DigitalInOut *_alarm;
     volatile bool _connect;