IBM IoT Client WiFi example using Murata Type-YD WiFi module

Dependencies:   C12832_fix LM75B MMA7660 MQTT PowerControl SNICInterface mbed-rtos mbed

Fork of IBMIoTClientEthernetExample by Toyomasa Watarai

/media/uploads/MACRUM/ibm_iotkit.jpg

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Wed Mar 25 10:35:23 2015 +0000
Parent:
16:c57dac84da92
Child:
18:ff8b191de621
Commit message:
Some refactoring

Changed in this revision

MQTT.lib Show annotated file Show diff for this revision Revisions of this file
MQTTWifi.h Show annotated file Show diff for this revision Revisions of this file
PowerControl.lib Show annotated file Show diff for this revision Revisions of this file
RZA1H.h Show annotated file Show diff for this revision Revisions of this file
WiFi_Config.h Show annotated file Show diff for this revision Revisions of this file
--- a/MQTT.lib	Mon Mar 23 01:08:47 2015 +0000
+++ b/MQTT.lib	Wed Mar 25 10:35:23 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/MACRUM/code/MQTT/#1a81f5821b0c
+http://developer.mbed.org/users/MACRUM/code/MQTT/#f229f6df5cc7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MQTTWifi.h	Wed Mar 25 10:35:23 2015 +0000
@@ -0,0 +1,53 @@
+
+#if !defined(MQTTWIFI_H)
+#define MQTTWIFI_H
+
+#include "MQTTmbed.h"
+#include "SNIC_WifiInterface.h"
+#include "MQTTSocket.h"
+#include "WiFi_Config.h"
+
+class MQTTWifi : public MQTTSocket
+{
+public:
+    MQTTWifi()
+    {
+        wifi.create(WIFI_TX, WIFI_RX, WIFI_CTS, WIFI_RTS, WIFI_RESET);
+        wifi.init();
+        wait(0.5);
+        wifi.disconnect();
+        wait(0.3);
+        wifi.connect( DEMO_AP_SSID
+                    , strlen(DEMO_AP_SSID)
+                    , DEMO_AP_SECURITY_TYPE
+                    , DEMO_AP_SECUTIRY_KEY
+                    , strlen(DEMO_AP_SECUTIRY_KEY) );
+        wait(0.5);
+        wifi.setIPConfig(true);
+    }
+    
+    C_SNIC_WifiInterface& getEth()
+    {
+        return wifi;
+    }
+    
+    void reconnect()
+    {
+        wifi.init();
+        wait(0.5);
+        wifi.disconnect();
+        wait(0.3);
+        wifi.connect( DEMO_AP_SSID
+                    , strlen(DEMO_AP_SSID)
+                    , DEMO_AP_SECURITY_TYPE
+                    , DEMO_AP_SECUTIRY_KEY
+                    , strlen(DEMO_AP_SECUTIRY_KEY) );
+        wait(0.5);
+        wifi.setIPConfig(true);
+    }
+
+private:
+    C_SNIC_WifiInterface wifi;
+};
+
+#endif
--- a/PowerControl.lib	Mon Mar 23 01:08:47 2015 +0000
+++ b/PowerControl.lib	Wed Mar 25 10:35:23 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/JST2011/code/PowerControl/#d0fa2aeb02a4
+http://mbed.org/users/JST2011/code/PowerControl/#9bcf87e81217
--- a/RZA1H.h	Mon Mar 23 01:08:47 2015 +0000
+++ b/RZA1H.h	Wed Mar 25 10:35:23 2015 +0000
@@ -33,8 +33,6 @@
 
 #define DEFAULT_TYPE_NAME "iotsample-mbed-gr-peach"
 
-//#include "lpc_phy.h"
-// need a wrapper since K64F and LPC1768 wont have the same name for mii read methods
 static uint32_t linkStatus(void)
 {
     return (1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WiFi_Config.h	Wed Mar 25 10:35:23 2015 +0000
@@ -0,0 +1,33 @@
+
+#if !defined(WIFI_CONFIG_H)
+#define WIFI_CONFIG_H
+
+#include "mbed.h"
+
+#define DEMO_AP_SSID                  "toyowata-nad11"
+#define DEMO_AP_SECURITY_TYPE         e_SEC_WPA2_AES
+#define DEMO_AP_SECUTIRY_KEY          "mbed.org"
+
+#if defined(TARGET_ARCH_PRO) || defined(TARGET_RZ_A1H)
+// for mbed Application Shield
+#define WIFI_TX    D1
+#define WIFI_RX    D0
+#define WIFI_CTS   NC
+#define WIFI_RTS   NC
+#define WIFI_RESET D3
+#define WIFI_ALARM NC
+
+#elif defined(TARGET_LPC1768)
+// for mbed Application board
+#define WIFI_TX    p9
+#define WIFI_RX    p10
+#define WIFI_CTS   NC
+#define WIFI_RTS   NC
+#define WIFI_RESET p30
+#define WIFI_ALARM NC
+
+#endif
+
+#define WIFI_BAUD  115200
+
+#endif