Demo starter application to connect WiGo to NSP and expose on-board sensors

Dependencies:   NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed nsdl_lib TEMT6200 TSI Wi-Go_eCompass_Lib_V3 WiGo_BattCharger

This is the mbed project for the IoT World Hackathon event, June 17th and 18th in Palo Also.

The setup instructions for participants are at the Setup page of this wiki:

http://mbed.org/teams/MBED_DEMOS/code/IoT_World_Hackathon_WiGo_NSP_Demo/wiki/Setup-Guide-for-the-IoT-World-Hackathon

Revision:
16:d6812604cf92
Parent:
8:3926a80af3e0
Child:
18:11b9d98ecae2
--- a/nsdl_support.cpp	Tue Jun 17 11:05:13 2014 +0000
+++ b/nsdl_support.cpp	Wed Jun 18 03:29:01 2014 +0000
@@ -9,6 +9,17 @@
 #include "UDPSocket.h"
 #include "Endpoint.h"
 
+/*    __heapvalid((__heapprt)fprintf,stdout, 1);\*/
+#define MEM_VALID(x) \
+    int s##x=0;\
+    int *h##x = new int [1];\
+    std::printf("[stack]0x%08x\t[heap]0x%08x\t[memory avail]%d bytes \tLine: %d %s\r\n", &s##x, h##x, &s##x-h##x, __LINE__, __FILE__);\
+    if (h##x > &s##x)\
+    printf("collision\n");\
+    else\
+    delete [] h##x;\
+    __nop()
+
 extern Serial pc;
 extern cc3000 wifi;
 extern Endpoint nsp;
@@ -25,12 +36,17 @@
 
 void *nsdl_alloc(uint16_t size)
 {
-    return malloc(size);
+    void *buf = malloc(size);
+    printf("alloc\r\n");
+    MEM_VALID(0);
+    return buf;
 }
 
 void nsdl_free(void* ptr_to_free)
 {
     free(ptr_to_free);
+    printf("de-alloc\r\n");
+    MEM_VALID(0);
 }
 
 /*