ThingPlug GMMP library Ethernet Example on Nucleo and W5500

Dependencies:   GMMP_mbed NTPClient WIZnet_Library mbed

Fork of ThingPlug_Ethernet_Example by Sangmin Lee

Files at this revision

API Documentation at this revision

Comitter:
lesmin
Date:
Sun Aug 09 15:02:40 2015 +0000
Parent:
0:fdbd2c6947ea
Child:
2:1fa48463bb58
Commit message:
ThingPlug W5500 Ethernet Example

Changed in this revision

GMMP_2.lib Show annotated file Show diff for this revision Revisions of this file
SNICInterface.lib Show diff for this revision Revisions of this file
WIZnet_Library.lib Show annotated file Show diff for this revision Revisions of this file
config.h 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-rtos.lib Show diff for this revision Revisions of this file
--- a/GMMP_2.lib	Sun Aug 09 14:24:15 2015 +0000
+++ b/GMMP_2.lib	Sun Aug 09 15:02:40 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/lesmin/code/GMMP_2/#7e575e5f88ec
+https://developer.mbed.org/users/lesmin/code/GMMP_2/#0c4e3edf2918
--- a/SNICInterface.lib	Sun Aug 09 14:24:15 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/teams/murata/code/SNICInterface/#b53ccb9989c4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WIZnet_Library.lib	Sun Aug 09 15:02:40 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/WIZnet/code/WIZnet_Library/#cb8808b47e69
--- a/config.h	Sun Aug 09 14:24:15 2015 +0000
+++ b/config.h	Sun Aug 09 15:02:40 2015 +0000
@@ -4,8 +4,8 @@
 /*
  *  Communication Module configuration starts here
  */
-#define USE_SNIC_WIFI //Murata Type YD Wi-Fi
-//#define USE_WIZNET_W5500
+//#define USE_SNIC_WIFI //Murata Type YD Wi-Fi
+#define USE_WIZNET_W5500 //WIZnet W5500 Ethernet
 
 
 /*
@@ -13,7 +13,7 @@
  */
 #ifdef USE_SNIC_WIFI
 
-    #define MBED_AP_SSID                  "FON"//"TIDE867"//"tide855" 
+    #define MBED_AP_SSID                  "TIDE867"//"tide855" 
     /** Securiry Options
     e_SEC_OPEN       = 0x00, //Open
     e_SEC_WEP        = 0x01, // WEP
@@ -21,9 +21,8 @@
     e_SEC_WPA2_AES   = 0x04, // WPA2-PSK(AES)
     e_SEC_WPA2_MIXED = 0x06, // WPA2-PSK(TKIP/AES)
     e_SEC_WPA_AES    = 0x07  // WPA-PSK(AES) **/
-    #define MBED_AP_SECURITY_TYPE         e_SEC_OPEN//e_SEC_WPA2_AES//e_SEC_OPEN
-    #define MBED_AP_SECUTIRY_KEY          ""//"tidetide"
-    //unsigned char g_mac[] = {0x98, 0xF1, 0x70, 0x67, 0x4D, 0xC3}; //MURATA WIFI
+    #define MBED_AP_SECURITY_TYPE         e_SEC_WPA2_AES//e_SEC_OPEN
+    #define MBED_AP_SECUTIRY_KEY          "tidetide"
 
 #endif//USE_SNIC_WIFI
 
@@ -37,15 +36,12 @@
 #define THINGPLUG_GMMP_IP_ADDR      {61, 250, 21, 211}  //ThingPlug GMMP 서버 IP주소
 #define THINGPLUG_GMMP_PORT_NUM     31002               //마이페이지 > 서비스 정보 수정 > 서비스 기본 정보 > TCP Listen Port
 #define THINGPLUG_GMMP_SERVICE_NAME "ThingPlug"         //마이페이지 > 서비스 정보 수정 > 서비스 기본 정보 > 서비스 아이디
-//unsigned char serverIp[] = {61, 250, 21, 211};
-//const int nServerPort = 31002;
-//const char* pszDomainCode = "ThingPlug";
 
 /*
  *  Gateway/Device configuration starts here
  */
-#define THINGPLUG_GMMP_DEVICE_SERIAL_NUM            "01234567890"//"0002f7f1ce5a"
-#define THINGPLUG_GMMP_DEVICE_MANUFACTURER_ID       "STMicro"//"DEV_lesmin"
+#define THINGPLUG_GMMP_DEVICE_SERIAL_NUM            "01012345678"
+#define THINGPLUG_GMMP_DEVICE_MANUFACTURER_ID       "STMicro"
 #define THINGPLUG_GMMP_SUB_DEVICE_MANUFACTURER_ID   "STM32"
 
 #endif /* CONFIG_H_ */
--- a/main.cpp	Sun Aug 09 14:24:15 2015 +0000
+++ b/main.cpp	Sun Aug 09 15:02:40 2015 +0000
@@ -1,19 +1,6 @@
 #include "mbed.h"
 
-#if defined(TARGET_LPC1768)
-#include "C12832.h" //for LCD
-#include "LM75B.h" //for Temperature Sensor
-#elif defined(TARGET_NUCLEO_F411RE) || defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F334R8) || defined(TARGET_NUCLEO_L152RE)
-//Sensor N/A for Nucleo
-#endif
-
 DigitalOut myled(LED1);
-
-#if defined(TARGET_LPC1768)
-C12832 lcd(p5, p7, p6, p8, p11);
-LM75B sensor(p28,p27);
-#endif
-
 Serial pc(USBTX, USBRX);
 
 #include "config.h"
@@ -29,7 +16,7 @@
 #define HIGH 0x1
 #define LOW  0x0
 
-byte serverIp[] = THINGPLUG_GMMP_IP_ADDR;
+byte serverIp[4] = THINGPLUG_GMMP_IP_ADDR;
 const int nServerPort = THINGPLUG_GMMP_PORT_NUM;
 const char* pszDomainCode = THINGPLUG_GMMP_SERVICE_NAME;
 const char* pszGWAuthID = THINGPLUG_GMMP_DEVICE_SERIAL_NUM;
@@ -299,16 +286,8 @@
 
 void startSensingTemp()
 {
-#if defined(TARGET_LPC1768)
-    if (sensor.open()) {
         printf("Sensing started!\r\n");
         isSensing = 1;
-    }
-    else
-#endif 
-	{
-        isSensing = 1; //emulate sensor
-    }
 }
 
 #define BUF_SIZE 10
@@ -328,12 +307,6 @@
 
     startSensingTemp(); //lesmin
 
-#if defined(TARGET_LPC1768)
-	char mac_addr[19];
-	mbed_mac_address((char *)mac); //Use mbed mac addres
-	snprintf(mac_addr, 19, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-	printf("MAC: %s\n", mac_addr);
-#endif
   if ( Initialize(serverIp, nServerPort, pszDomainCode, pszGWAuthID, g_mac) ) {
       infoln("Initialize failed!");
       return -1; //lesmin
@@ -358,18 +331,7 @@
 }
 
 float getTemperature(void) {
-#if defined(TARGET_LPC1768)
-    float Temp = sensor;
-
-    lcd.cls();
-    lcd.locate(0,3);
-    lcd.printf("Temp = %.3f\n", (float)Temp);
-
-    wait(1.0);
-    return Temp;
-#else
 	return 33.3;
-#endif
 }
 
 void delay(int d) {
--- a/mbed-rtos.lib	Sun Aug 09 14:24:15 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#5aed8bae1001