NSP demo runnig over WiFi

Dependencies:   Beep C12832_lcd LM75B MMA7660 WiflyInterface mbed-rtos mbed nsdl_lib

Fork of NSDL_HelloWorld by Sensinode

Files at this revision

API Documentation at this revision

Comitter:
bogdanm
Date:
Thu Oct 24 14:10:19 2013 +0000
Parent:
7:6b068978be9a
Commit message:
NSP demo running over WiFi using a WiFly RN-171 module connected to the application board.

Changed in this revision

EthernetInterface.lib Show diff for this revision Revisions of this file
WiflyInterface.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
nsdl_support.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Tue Oct 22 10:50:05 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#dd9794ce1d64
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WiflyInterface.lib	Thu Oct 24 14:10:19 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/WiflyInterface/#9d18ac47d27f
--- a/main.cpp	Tue Oct 22 10:50:05 2013 +0000
+++ b/main.cpp	Thu Oct 24 14:10:19 2013 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "EthernetInterface.h"
+#include "WiflyInterface.h"
 #include "C12832_lcd.h"
 #include "nsdl_support.h"
 #include "dbg.h"
@@ -15,7 +15,11 @@
 // ****************************************************************************
 // Configuration section
 
-// Ethernet configuration
+// WiFi configuration (edit this)
+#define WIFI_SSID               ""
+#define WIFI_SECURITY           WPA    // NONE, WEP_128 or WPA
+#define WIFI_PASSWORD           ""
+             
 /* Define this to enable DHCP, otherwise manual address configuration is used */
 #define DHCP
 
@@ -33,22 +37,22 @@
 uint8_t lifetime_ptr[] = {"1200"};
 
 // ****************************************************************************
-// Ethernet initialization
+// WiFi initialization
 
-EthernetInterface eth;
+static WiflyInterface wifly(p9, p10, p30, p29, WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY);
 
-static void ethernet_init()
+static void wifi_init()
 {
     char mbed_uid[33]; // for creating unique name for the board
 
     /* Initialize network */
 #ifdef DHCP
     NSDL_DEBUG("DHCP in use\r\n");
-    eth.init();
+    wifly.init();
 #else
-    eth.init(IP, MASK, GW);
+    wifly.init(IP, MASK, GW);
 #endif
-    if(eth.connect(30000) == 0)
+    if(wifly.connect() == 0)
         pc.printf("Connect OK\n\r");
 
     mbed_interface_uid(mbed_uid);
@@ -56,9 +60,9 @@
     strncat(endpoint_name, mbed_uid + 27, 15 - strlen(endpoint_name));
 
     lcd.locate(0,11);
-    lcd.printf("IP:%s", eth.getIPAddress());
+    lcd.printf("IP:%s", wifly.getIPAddress());
 
-    NSDL_DEBUG("IP Address:%s ", eth.getIPAddress());
+    NSDL_DEBUG("IP Address:%s ", wifly.getIPAddress());
 }
 
 // ****************************************************************************
@@ -139,7 +143,7 @@
     NSDL_DEBUG("mbed NanoService Example App 0.1\n");
     
     // Initialize Ethernet interface first
-    ethernet_init();
+    wifi_init();
     
     // Initialize NSP node
     nsp_init();
--- a/mbed.bld	Tue Oct 22 10:50:05 2013 +0000
+++ b/mbed.bld	Thu Oct 24 14:10:19 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/f37f3b9c9f0b
\ No newline at end of file
--- a/nsdl_support.cpp	Tue Oct 22 10:50:05 2013 +0000
+++ b/nsdl_support.cpp	Thu Oct 24 14:10:19 2013 +0000
@@ -4,10 +4,10 @@
 #include "nsdl_support.h"
 #include "mbed.h"
 #include "rtos.h"
-#include "EthernetInterface.h"
+#include "Endpoint.h"
+#include "UDPSocket.h"
 
 extern Serial pc;
-extern EthernetInterface eth;
 extern Endpoint nsp;
 extern UDPSocket server;
 extern char endpoint_name[16];