Xively demo for cc3000

Dependencies:   NVIC_set_all_priorities cc3000_hostdriver_mbedsocket libxively mbed

Files at this revision

API Documentation at this revision

Comitter:
Kojto
Date:
Mon Oct 14 15:33:28 2013 +0000
Parent:
2:ed5cf21e63b4
Child:
4:cea07f0d1eeb
Commit message:
xively update with xi_user_config

Changed in this revision

libxively.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
main.h Show annotated file Show diff for this revision Revisions of this file
xi_user_config.h Show annotated file Show diff for this revision Revisions of this file
--- a/libxively.lib	Sun Oct 13 12:06:53 2013 +0000
+++ b/libxively.lib	Mon Oct 14 15:33:28 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/xively/code/libxively/#ec8b7d78ea10
+http://mbed.org/users/xively/code/libxively/#4ce6299f7535
--- a/main.cpp	Sun Oct 13 12:06:53 2013 +0000
+++ b/main.cpp	Mon Oct 14 15:33:28 2013 +0000
@@ -147,11 +147,9 @@
     strcpy(counter_datastream->datastream_id, "Uptime");
     xi_datapoint_t* counter = &counter_datastream->datapoints[0];
     
-    // create the cosm library context
     xi_context_t* xi_context = xi_create_context(XI_HTTP, XI_API_KEY, feed.feed_id);
 
-    // check if everything works
-    if(xi_context == NULL)
+    if (xi_context == NULL)
     {
         printf("Context failed to initialized. \r\n");
         return -1;
@@ -160,14 +158,14 @@
     flipper_seconds.attach(&update_timer, 1.0);
 
     while(1) {  
-      xi_set_value_f32(led_status, myled);  
-      xi_set_value_f32(counter, time_seconds);
+        xi_set_value_f32(led_status, myled);  
+        xi_set_value_f32(counter, time_seconds);
       
-      printf( "update...\r\n");
-      xi_feed_update(xi_context, &feed);
-      printf( "done...\r\n");
-      wait(10);
-      myled = myled ^ 0x1;
+        printf( "update...\r\n");
+        xi_feed_update(xi_context, &feed);
+        printf( "done...\r\n");
+        wait(10);
+        myled = myled ^ 0x1;
     }
 
 }
--- a/main.h	Sun Oct 13 12:06:53 2013 +0000
+++ b/main.h	Mon Oct 14 15:33:28 2013 +0000
@@ -36,8 +36,6 @@
 #define AP_SECURITY  WPA2            // WPA2 must be enabled for use with iPhone or Android phone hotspot!
 #define SSID         "test"
 
-#define XI_USER_CONFIG 1
-
 void init();
 
 #endif
--- a/xi_user_config.h	Sun Oct 13 12:06:53 2013 +0000
+++ b/xi_user_config.h	Mon Oct 14 15:33:28 2013 +0000
@@ -13,11 +13,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef XI_USER_CONFIG_H
-#define XI_USER_CONFIG_H
+#ifndef __XI_USER_CONFIG_H__
+#define __XI_USER_CONFIG_H__
+
+// The following settings should lower memory footprint.
+// The library currently allows one to send batch datapoint
+// and feed updates, but it's not needed in most use cases
+#define XI_MAX_DATAPOINTS         1
+// The number of channels can be increased if needed
+#define XI_MAX_DATASTREAMS        5
 
-// xively setup - less memory
-#define XI_MAX_DATAPOINTS                  1
-#define XI_MAX_DATASTREAMS                 2
+// Below are optimisations that reduce some minor functionality
+#define XI_OPT_NO_ERROR_STRINGS
 
-#endif
+// If you wish to enable assertions, set this to 1
+#define XI_DEBUG_ASSERT 0
+// If you wish to disable debug output, set this to 0
+#define XI_DEBUG_OUTPUT 0
+
+#endif /* __XI_USER_CONFIG_H__ */