Paul Sainrat / Mbed 2 deprecated App4_Projet

Dependencies:   mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
Sainratp
Date:
Mon Oct 23 21:24:39 2017 +0000
Parent:
4:e0ca69606fdf
Commit message:
encore;

Changed in this revision

DO/DO.cpp Show annotated file Show diff for this revision Revisions of this file
DO/DO.h Show annotated file Show diff for this revision Revisions of this file
MO/MO.cpp 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
--- a/DO/DO.cpp	Mon Oct 23 20:39:18 2017 +0000
+++ b/DO/DO.cpp	Mon Oct 23 21:24:39 2017 +0000
@@ -20,7 +20,6 @@
                 res = res | (((char)evt.value.p)<<i);
             }
         }
-        
         queueCharReception.put((char*)res);
     }
 
@@ -30,12 +29,10 @@
 {
     timer.start();
     int oldTime;
-    bool bitType=true;
+    bool bitType=false;
     oldTime = timer.read_ms();
-    printf("\n %d \n ",oldTime);
     while(1) {
         Thread::signal_wait(0x01);
-        //printf("\n %d",timer.read_ms()-oldTime);
         if(timer.read_ms()-oldTime<(T-(T*0.15))*1000){
             Thread::signal_wait(0x01);  
         } 
@@ -43,11 +40,11 @@
             bitType=!bitType;
         }
         if(bitType) {
+            pc.putc(0x31);
             queueBitReception.put((void*)0x01);
-            pc.putc(0x31);
         } else {
+            pc.putc(0x30);
             queueBitReception.put((void*)0x00);
-            pc.putc(0x30);
         }
         oldTime=timer.read_ms();
     }
@@ -72,7 +69,7 @@
 }
 
 
-void recieveData()
+void receiveData()
 {
     osEvent evt;
     char reception;
--- a/DO/DO.h	Mon Oct 23 20:39:18 2017 +0000
+++ b/DO/DO.h	Mon Oct 23 21:24:39 2017 +0000
@@ -9,6 +9,6 @@
 
 void receiveBit();
 
-void recieveData();
+void receiveData();
 
 #endif
--- a/MO/MO.cpp	Mon Oct 23 20:39:18 2017 +0000
+++ b/MO/MO.cpp	Mon Oct 23 21:24:39 2017 +0000
@@ -51,6 +51,7 @@
             }
             queueEnvoi.put((char*)trame->ctrl);
             queueEnvoi.put((char*)STOP);
+            trame_box.free(trame);
         }
     }
 }
--- a/main.cpp	Mon Oct 23 20:39:18 2017 +0000
+++ b/main.cpp	Mon Oct 23 21:24:39 2017 +0000
@@ -22,6 +22,7 @@
 
 Thread receiveBitThread;
 Thread receiveCharThread;
+Thread receiveDataThread;
 
 
 
@@ -46,20 +47,28 @@
 
 int main()
 {
+ 
+       
+    led1=1;
     
-    led1=1;
     sendCharThread.start(&sendChar);
     sendCharThread.set_priority(osPriorityHigh);
+    
     receiveBitThread.start(&receiveBit);
+    receiveBitThread.set_priority(osPriorityHigh);
     receiveCharThread.start(&receiveChar);
+    receiveDataThread.start(&receiveData);
+    
     sendDataThread.start(&sendData);
     ticker.attach(&wake,T/2.0);
     wait(1);
     in.rise(&interruptRise);
     in.fall(&interruptFall);
-    createTrame(test,5);
-    while(1) {
-        
+    wait(1);
+    int i =0;
+    while(i<5) {
+        createTrame(test,5);
+        i++;
         }
     
 }