gs fan
/
GSwifi_accesspoint
Limited AP for GSwifi see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Revision 2:0fff24372b0b, committed 2013-02-26
- Comitter:
- gsfan
- Date:
- Tue Feb 26 07:51:51 2013 +0000
- Parent:
- 1:8787738dafcb
- Commit message:
- fix
Changed in this revision
GSwifi.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8787738dafcb -r 0fff24372b0b GSwifi.lib --- a/GSwifi.lib Wed Aug 22 00:49:34 2012 +0000 +++ b/GSwifi.lib Tue Feb 26 07:51:51 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/gsfan/code/GSwifi/#3b819ba34c6c +http://mbed.org/users/gsfan/code/GSwifi/#e19538c1f13d
diff -r 8787738dafcb -r 0fff24372b0b main.cpp --- a/main.cpp Wed Aug 22 00:49:34 2012 +0000 +++ b/main.cpp Tue Feb 26 07:51:51 2013 +0000 @@ -1,49 +1,50 @@ -#include "mbed.h" -#include "GSwifi.h" - -#define PORT 10464 - -#define SECURE GSSEC_WEP -#define SSID "SSID" -#define PASS "1234567890" // 10 or 26 hexadecimal digits - -GSwifi gs(p13, p14); // TX, RX (no flow control) -// GSwifi gs(p13, p14, p12, P0_22); // TX, RX, CTS, RTS -Serial pc(USBTX, USBRX); -DigitalOut led1(LED1), led2(LED2); - -void onGsReceive (int cid, int len) { - int i, j; - char buf[100]; - Host host; - - led2 = 1; - - i = gs.recv(cid, buf, sizeof(buf), host); - for (j = 0; j < i; j ++) { - pc.printf(" %02x", buf[j]); - } - pc.printf("\r\n"); -} - -int main () { - - led1 = 1; - pc.baud(115200); - - pc.printf("limitedap\r\n"); - if (gs.limitedap(SECURE, SSID, PASS, IpAddr(192,168,15,5), IpAddr(255,255,255,0))) { - return -1; - } - - pc.printf("listen\r\n"); - gs.listen(PORT, GSPROT_UDP, &onGsReceive); - - for (;;) { - gs.poll(); - - wait_ms(50); - led1 = !led1; - led2 = 0; - } -} +#include "mbed.h" +#include "GSwifi.h" + +#define PORT 10464 + +#define SECURE GSwifi::GSSEC_WEP +#define SSID "SSID" +#define PASS "1234567890" // 10 or 26 hexadecimal digits + +GSwifi gs(p13, p14, p20); // TX, RX, Reset (no flow control) +//GSwifi gs(p13, p14, p12, P0_22, p20, NC, 115200); // TX, RX, CTS, RTS, Reset, Alarm + +Serial pc(USBTX, USBRX); +DigitalOut led1(LED1), led2(LED2); + +void onGsReceive (int cid, int len) { + int i, j; + char buf[100]; + Host host; + + led2 = 1; + + i = gs.recv(cid, buf, sizeof(buf), host); + for (j = 0; j < i; j ++) { + pc.printf(" %02x", buf[j]); + } + pc.printf("\r\n"); +} + +int main () { + + led1 = 1; + pc.baud(115200); + + pc.printf("limitedap\r\n"); + if (gs.limitedap(SECURE, SSID, PASS, IpAddr(192,168,15,5), IpAddr(255,255,255,0))) { + return -1; + } + + pc.printf("listen\r\n"); + gs.listen(PORT, GSwifi::GSPROT_UDP, &onGsReceive); + + for (;;) { + gs.poll(); + + wait_ms(50); + led1 = !led1; + led2 = 0; + } +}