Example node for Yodiwo's Plegma API

Dependencies:   EthernetInterface FXOS8700Q HTTPClient HTTPD MQTTS SDFileSystem YodiwoPlegma mbed-rpc mbed-rtos mbed wolfSSL

Revision:
5:1ef168357347
Parent:
4:cc4c5b6d9730
Child:
7:11ff316c37ba
--- a/main.cpp	Mon Sep 21 06:56:11 2015 +0000
+++ b/main.cpp	Mon Sep 28 08:55:29 2015 +0000
@@ -2,18 +2,16 @@
 #include "rtos.h"
 #include "EthernetInterface.h"
 #include "HTTPD.h"
-//#include "HTTPServer.h"
-//#include "LocalFileSystem.h"
+
 #include "SDFileSystem.h"                  // SD File System functions
 
-//#include "FsHandler.h"
-//#include "RpcHandler.h"
 #include "pairing_backend.h"
 #include "pairing_http_handler.h"
 #include "config.h"
 #include "yodiwo_functions.h"
-#include "nodas.h"
-#include "yodiwo_extra.h"
+#include "nodas_things.h"
+#include "mqtt_helpers.h"
+#include "yodiwo_helpers.h"
 
 #define DAT0 PTE3                          // MOSI
 #define CMD  PTE1                          // MISO
@@ -32,10 +30,8 @@
 InterruptIn sw2(SW2);
 uint32_t button_pressed;
 Thread *thread2;
-//HTTPServer server;
 extern HTTPD *httpd;
-//  Instantiate a local file system handler named 'local' which will be used later to access files on the mbed.
-//LocalFileSystem local("local");
+
  
  
 SDFileSystem sd(DAT0, CMD, CLK, CD, "sd"); // MOSI, MISO, SCLK, CS
@@ -50,13 +46,11 @@
 
 void sw2_press(void)
 {
-//    button_event(1, true);
     thread2->signal_set(0x1);
 }
 
 void sw2_release(void)
 {
-//    button_event(1, false);
     thread2->signal_set(0x2);    
 }
 
@@ -75,7 +69,6 @@
     blueled = 0;
     while (true) {
         osEvent evt = Thread::signal_wait(0x1 | 0x02);
-//        button_event(1, true);
         if (evt.value.signals & 0x01) {
             button_event(1, true);
         }
@@ -87,8 +80,6 @@
     }
 }
 
-//void callback_pairing (int id);
-
 int launch_mqtt();
 
 int main()
@@ -120,7 +111,6 @@
     sw2.rise(&sw2_release);
     while (true) {
         Thread::wait(5000);
-//        printf("SW2 was pressed (last 5 seconds): %d \n", button_pressed);
         fflush(stdout);
         button_pressed = 0;
     }