Projet_S5 / Mbed 2 deprecated Repo_Noeud_Mobile_refactor

Dependencies:   mbed-rtos mbed

Fork of Repo_Noeud_Mobile by Projet_S5

Revision:
57:ce80fbd67161
Parent:
55:adde1b6081b8
Child:
58:4cdc85ed04a9
--- a/main.cpp	Sun Apr 12 02:06:58 2015 +0000
+++ b/main.cpp	Sun Apr 12 03:02:21 2015 +0000
@@ -61,6 +61,7 @@
 Thread* Thread_Send_Data_To_Fixe = NULL;// Thread pour envoyer les données des sensors au fixe
 Thread* transmit_xbee_data_thread_ptr = NULL;
 
+Thread* xbeeAnalyzer = NULL;
 Thread* xbeeReceive = NULL;
 Thread* threadGetGameMode = NULL;
 
@@ -77,9 +78,15 @@
 //Fonction qui part le thread
 void startXbeeReceive(void const* args)
 {
-    xbee.Recevoir();
+    xbee.GetData();
 }
 
+void startXbeeAnalyzer(void const* args)
+{
+    xbee.OutputData();
+}
+
+
 int main(void const* args)
 {
     m_pc.printf("\r\n==== PROGRAM START MOBILE ====\r\n");
@@ -90,6 +97,7 @@
     m_pc.printf("PANID %x\r\n", PanId);
     m_pc.printf("opMode %u\r\n", opMode);
     xbee = Xbee(PanId, p13, p14); //set PAN ID
+    xbeeAnalyzer = new Thread(startXbeeAnalyzer);
     xbeeReceive = new Thread(startXbeeReceive);
     threadGetGameMode = new Thread(GetGameMode);
 
@@ -136,12 +144,12 @@
 {
     while (true) {
         // attente et lecture d'un événement digital
-        osEvent evtD = xbee.mailbox_TypeDeJeu.get(25);
+        osEvent evtD = xbee.fvm_mailbox.get();
         if (evtD.status == osEventMail) {
             Fixe_Vers_Mobile *mail = (Fixe_Vers_Mobile*)evtD.value.p;
             mode = mail->game;
             // Envoyer la structure
-            xbee.mailbox_TypeDeJeu.free(mail);
+            xbee.fvm_mailbox.free(mail);
             switch(mode) {
                 case 0:
                     m_pc.printf("Led Gunner Start! \n\r");
@@ -176,9 +184,6 @@
         }
         mail_mvf.flexSensor = flex_data;
         mail_mvf.gants = 'D';
-        mail_mvf.accelData.x = 0x00;
-        mail_mvf.accelData.y = 0x00;
-        mail_mvf.accelData.z = 0x01;
         threads[XBEE_TRANSMIT]->signal_set(0x01);
     }
 }
@@ -204,9 +209,6 @@
     mailGauche.flexSensor.annulaire = true;
     mailGauche.flexSensor.majeur = true;
     mailGauche.gants = 'G'; // Gauche ou Droit
-    mailGauche.accelData.x = 0x01;
-    mailGauche.accelData.y = 0x00;
-    mailGauche.accelData.z = 0x01;
 
     // local variables
 
@@ -222,9 +224,6 @@
             mail_mvf.flexSensor.annulaire = false;
             mail_mvf.flexSensor.majeur = false;
             mail_mvf.gants = 'D'; // Gauche ou Droit
-            mail_mvf.accelData.x = 0x01;
-            mail_mvf.accelData.y = 0x00;
-            mail_mvf.accelData.z = 0x00;
             m_pc.printf("Envoie de mail");
             threads[XBEE_TRANSMIT]->signal_set(0x01);
             mail_mvf = mailGauche;
@@ -252,9 +251,6 @@
     } else if(opMode == FRET) {
         mail_mvf.gants = 'F'; // Gauche
     }
-    mail_mvf.accelData.x = 0x01;
-    mail_mvf.accelData.y = 0x01;
-    mail_mvf.accelData.z = 0x01;
 
     flex_t flex_data;
     while(true) {