Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface PololuLedStripx mbed-rtos mbed nanoservice_client_1_12_X
Fork of LPC1768_LWM2M_Client by
Revision 14:25430e88728f, committed 2014-10-04
- Comitter:
- michaeljkoster
- Date:
- Sat Oct 04 05:12:45 2014 +0000
- Parent:
- 12:15829d1f9425
- Child:
- 15:2f2b3eaa51a6
- Commit message:
- Undo accidental fork and update
Changed in this revision
--- a/ArchPro_LWM2M_LED_Client.lib Sat Oct 04 04:58:32 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/teams/MBED_DEMOS/code/ArchPro_LWM2M_LED_Client/#5ecaf86d3936
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Sat Oct 04 05:12:45 2014 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/michaeljkoster/code/EthernetInterface/#6ca542f6c58d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IAP.lib Sat Oct 04 05:12:45 2014 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/sam_grove/code/IAP/#f794a51897b8
--- a/PololuLedStrip.lib Sat Oct 04 04:58:32 2014 +0000 +++ b/PololuLedStrip.lib Sat Oct 04 05:12:45 2014 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/michaeljkoster/code/PololuLedStrip_r8/#b0d66298f49c +http://developer.mbed.org/users/michaeljkoster/code/PololuLedStripx/#77e743378104
--- a/WiflyInterface.lib Sat Oct 04 04:58:32 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/teams/components/code/WiflyInterface/#fc3d86645d23
--- a/main.cpp Sat Oct 04 04:58:32 2014 +0000
+++ b/main.cpp Sat Oct 04 05:12:45 2014 +0000
@@ -1,13 +1,12 @@
#include "mbed.h"
-#include "WiflyInterface.h"
+#include "EthernetInterface.h"
#include "nsdl_support.h"
#include "dbg.h"
-
// Include resources
#include "light.h"
+#include "IAP.h"
#include "PololuLedStrip.h"
-
-PololuLedStrip ledStrip(D2);
+PololuLedStrip ledStrip(P0_4);
//#define LED_COUNT 60
#define LED_COUNT 120
rgb_color colors[LED_COUNT];
@@ -26,13 +25,36 @@
#define MASK "255.255.255.0"
#define GW "10.0.0.1"
+extern "C" void mbed_mac_address(char *mac)
+{
+ static char buf[64] = {0};
+ IAP iap;
+ int32_t *block = iap.read_serial();
+ uint32_t serial_number[5] = {0};
+
+ memset(buf, 0, sizeof(buf));
+ serial_number[0] = *(block);
+ serial_number[1] = *(block+1);
+ // we only want bottom 16 bits of word1 (MAC bits 32-47)
+ // and bit 9 forced to 1, bit 8 forced to 0
+ // Locally administered MAC, reduced conflicts
+ // http://en.wikipedia.org/wiki/MAC_address
+ //serial_number[0] |= 0x00000200;
+ //serial_number[0] &= 0x0000FEFF;
+ memcpy(mac, (uint8_t*) &serial_number[0], 6);
+ mac[0] |= 0x02;
+ mac[0] &= 0xFE;
+ mac[5] |= 0x02;
+ mac[5] &= 0xFE;
+
+ // snprintf(buf, 16, "%4X%08X", serial_number[0], serial_number[1]);
+}
// NSP configuration
/* Change this IP address to that of your NanoService Platform installation */
//static const char* NSP_ADDRESS = "217.140.101.20"; /* public mbed demo server */
-static const char* NSP_ADDRESS = "54.228.25.31"; //leshan sandbox
-//static const char* NSP_ADDRESS = "23.99.99.252"; // barista.cloudapp.net
+static const char* NSP_ADDRESS = "23.99.99.252"; // barista.cloudapp.net
//static const char* NSP_ADDRESS = "192.168.1.200";
static const int NSP_PORT = 5683;
char endpoint_name[24] = "LED-booth-";
@@ -42,9 +64,7 @@
// ****************************************************************************
// Ethernet initialization
-//EthernetInterface eth;
-WiflyInterface eth(D1, D0, D5, LED1, "demo", "ARMDEMO1", WPA);
-
+EthernetInterface eth;
static void ethernet_init()
{
/* Initialize network */
@@ -56,7 +76,7 @@
eth.init(IP, MASK, GW);
NSDL_DEBUG("eth.init\r\n");
#endif
- if(eth.connect() == 0)
+ if(eth.connect(30000) == 0)
pc.printf("Connect OK\n\r");
NSDL_DEBUG("IP Address:%s ", eth.getIPAddress());
--- a/nsdl_support.cpp Sat Oct 04 04:58:32 2014 +0000 +++ b/nsdl_support.cpp Sat Oct 04 05:12:45 2014 +0000 @@ -4,6 +4,7 @@ #include "nsdl_support.h" #include "mbed.h" #include "rtos.h" +#include "EthernetInterface.h" #include "UDPSocket.h" #include "Endpoint.h"
