GainSpan Wi-Fi module, test for SPI interface.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gsfan
Date:
Thu Apr 03 14:05:40 2014 +0000
Child:
1:de94ad0f7925
Commit message:
1st build

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 03 14:05:40 2014 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX);
+
+// (GS1011MxxS / pin)
+SPI gs(p5, p6, p7); // mosi(DIN/5), miso(DOUT/8), sck(CLK/7)
+DigitalOut cs(p8); // cs(CS/6)
+DigitalIn hw(p9); // host wakeup(GPIO28/2)
+
+int main() {
+    char c;
+
+    pc.baud(115200);
+    gs.format(8, 0);
+    gs.frequency(3000000);
+    hw.mode(PullDown);
+    myled = 1;
+    cs = 1;
+
+    for (;;) {
+        if (pc.readable()) {
+            cs = 0;
+            c = gs.write(pc.getc());
+            if (c != 0xf5)
+                pc.printf("%02x_", c);
+            cs = 1;
+        }
+        if (hw == 1) {
+            cs = 0;
+            c = gs.write(0xf5);
+            cs = 1;
+            if ((c >= 0x20 && c < 0x7f) || c == 0x0d || c == 0x0a) {
+                pc.printf("%c", c);
+            } else
+            if (c != 0xf5) {
+                pc.printf("%02x ", c);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 03 14:05:40 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file