threads

Dependencies:   IHM_V2

Revision:
28:a0164609dcc0
Parent:
27:998da0f731ad
Child:
30:0791059decff
diff -r 998da0f731ad -r a0164609dcc0 main.cpp
--- a/main.cpp	Sat Feb 10 20:38:07 2018 +0000
+++ b/main.cpp	Wed Jan 09 12:22:17 2019 +0000
@@ -14,39 +14,40 @@
 void led1_thread();
 void led2_thread();
 
-Thread thread1;
-Thread thread2;
+Thread thread1 (osPriorityNormal,2*OS_STACK_SIZE );
+Thread thread2 (osPriorityNormal,2*OS_STACK_SIZE );
 
 // main is the 1st thread
 int main(void) 
 {   ihm.LCD_clear();
     ihm.LCD_printf("3-threads-%s %s",__DATE__,__TIME__);
     printf("mbed-os-3-threads-%s %s\n\r",__DATE__,__TIME__);
-    printf("DEFAULT_STACK_SIZE:%d\n\r", DEFAULT_STACK_SIZE); 
+    printf("DEFAULT_STACK_SIZE:%d\n\r", OS_STACK_SIZE); 
 
     thread1.start(led1_thread);   
     thread2.start(led2_thread);
  
     while(1){
         L0=!L0;
-        printf("*     [pid-%d]Main \n\r",Thread::gettid());
-        Thread::wait(200);  
+        printf("*     [pid-%d]Main \n\r",osThreadGetId());
+        wait(0.0200);  
     }
 }
 
 void led1_thread(){
     while (1) {
         L1 = ! L1;
-        printf("  *   [pid-%d]led1_thread \n\r",Thread::gettid());
-        Thread::wait(500);  
+        printf("  *   [pid-%d]led1_thread \n\r",osThreadGetId());
+        wait(0.500);  
   }
 }
 
 void led2_thread(){
     while (1) {
         L2 = ! L2;
-        printf("     *[pid-%d]led2_thread \n\r",Thread::gettid());
-        Thread::wait(2500);  
+        printf("     *[pid-%d]led2_thread \n\r",osThreadGetId());
+        wait(2.500);  
    }
 }
 
+    
\ No newline at end of file