Projet_S5 / Mbed 2 deprecated Repo_Noeud_Mobile_refactor

Dependencies:   mbed-rtos mbed

Fork of Repo_Noeud_Mobile by Projet_S5

Revision:
39:558cd5780490
Parent:
36:e587950c288c
Child:
41:0cb286b1005e
--- a/Communication/Xbee.cpp	Mon Apr 06 19:52:29 2015 +0000
+++ b/Communication/Xbee.cpp	Mon Apr 06 20:18:02 2015 +0000
@@ -93,6 +93,25 @@
     EnvoyerDonnees(data, 8);
 }
 
+void Xbee::EnvoyerStructure(Mobile_Vers_Fixe* mvf)
+{
+    char data[8];
+
+    data[0] = mvf->gants;
+    data[1] = mvf->accelData.x >> 8;
+    data[2] = mvf->accelData.x & 0x00FF;
+    data[3] = mvf->accelData.y >> 8;
+    data[4] = mvf->accelData.y & 0x00FF;
+    data[5] = mvf->accelData.z >> 8;
+    data[6] = mvf->accelData.z & 0x00FF;
+
+    mvf->flexSensor.index == 1 ? data[7] = 0x04 : data[7] = 0;
+    mvf->flexSensor.majeur == 1 ? data[7] += 0x02 : data[7] += 0;
+    mvf->flexSensor.annulaire == 1 ? data[7] += 0x01 : data[7] += 0;
+
+    EnvoyerDonnees(data, 8);
+}
+
 //Le noeud mobile va recevoir certaines informations comme le type de jeux et les signaux de depart/fin de parties
 //Structure de reception sera Fixe_Vers_Mobile
 void Xbee::Recevoir()