Sebastián Pastor / EtheriosCloudConnector

Files at this revision

API Documentation at this revision

Comitter:
spastor
Date:
Tue Dec 03 14:10:48 2013 +0000
Parent:
0:1c358ea10753
Commit message:
Use internal Thread.h instead of Threads.h

Changed in this revision

mbed_platform/main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1c358ea10753 -r 908afea5a49d mbed_platform/main.cpp
--- a/mbed_platform/main.cpp	Tue Dec 03 13:34:02 2013 +0000
+++ b/mbed_platform/main.cpp	Tue Dec 03 14:10:48 2013 +0000
@@ -12,7 +12,7 @@
 
 #include "mbed.h"
 #include "EthernetInterface.h"
-#include "Threads.h"
+
 extern "C" {
 
 #include "connector_api.h"
@@ -67,48 +67,20 @@
     APP_DEBUG("Start Cloud Connector for Embedded\n");
     connector_handle = connector_init(app_connector_callback);
 
-    if (connector_handle != NULL)
-    {
-        ThreadList* my_threads=NULL; //List of all Initialized threads
-        ThreadList* connector_thread; //pointer to the last created ThreadList element
-        ThreadList* application_thread; //pointer to the last created ThreadList element
-        
-        APP_DEBUG("Initiating CC thread\n");
-        if(initThread(&my_threads,connector_run_thread, &connector_thread,2)==0)
-        {
-           APP_DEBUG("Thread creation failed. \n");
-          
-        }
-        else
-        {
-            //Start the thread and store the id
-            connector_thread->id=osThreadCreate(connector_thread->thread, connector_handle);
-        }
-        APP_DEBUG("Initiating application thread\n");
-        if(initThread(&my_threads,application_run_thread, &application_thread,2)==0)
-        {
-           APP_DEBUG("Thread creation failed. \n");
-          
-        }
-        else
-        {
-            //Start the thread and store the id
-            application_thread->id=osThreadCreate(application_thread->thread, connector_handle);
-        }
-    }
-    else
+    if (connector_handle == NULL)
     {
         APP_DEBUG("Unable to initialize the connector\n");
+        ASSERT(0);
     }
     
     {
+        Thread connector_thread(connector_run_thread, connector_handle, osPriorityNormal, DEFAULT_STACK_SIZE);
+        Thread application_thread(application_run_thread, connector_handle, osPriorityNormal, DEFAULT_STACK_SIZE);
         DigitalOut myled(LED1);
         for(;;)
         {
-            myled = 1;
-            wait(0.2);
-            myled = 0;
-            wait(0.2);
+            myled = !myled.read();
+            wait(0.5);
         }
     }