ajout module_mouvement

Dependencies:   mbed xbee_lib ADXL345_I2C IMUfilter ITG3200 Motor RangeFinder Servo mbos PID

Fork of Labo_TRSE_Drone by HERBERT Nicolas

Revision:
24:3462a304f9a0
Parent:
19:a05cd42f8e91
Child:
28:8b5ccd2f837e
diff -r 7f5681d8d5b5 -r 3462a304f9a0 Module_Communication/Module_Communication.cpp
--- a/Module_Communication/Module_Communication.cpp	Wed Apr 03 10:36:21 2013 +0000
+++ b/Module_Communication/Module_Communication.cpp	Wed Apr 03 12:16:14 2013 +0000
@@ -28,20 +28,56 @@
  C_ModuleCommunication::C_ModuleCommunication()
  {
     m_xbee = new xbee(p9, p10, p11);
+    m_trameRxBuffer = C_FrameBuffer();
+    m_trameTxBuffer = C_FrameBuffer();
+    m_charRxBuffer = new char[9];
+    m_charTxBuffer = new char[9];
  }
  
  /* DESTRUCTEUR */
  C_ModuleCommunication::~C_ModuleCommunication()
  {
- 
+    delete [] m_charRxBuffer;
+    delete [] m_charTxBuffer;
+    delete m_xbee;
  }
  
  /* Point d'entrée de la tache Module Video */
- void C_ModuleCommunication::receptionDeTrame(void)
+ void C_ModuleCommunication::moduleCommunicationTask(void)
  {
     while(1){
     // Code
     }
  }
  
- 
\ No newline at end of file
+ void C_ModuleCommunication::envoiDeTrame(void)
+ {
+    pc.scanf("%s",m_charTxBuffer); //Read data from serial console
+    m_xbee->SendData(m_charTxBuffer);
+    /*
+    frame newFrame = m_trameTxBuffer->frameBuffer();
+    m_charTxBuffer[0] = newFrame.identifier;
+    
+    for(int i = 0; i < 8; i++) {
+        m_charTxBuffer[i+1] = newFrame.data[i];
+    }
+    
+    m_xbee->SendData(m_charTxBuffer);
+    */
+ }
+ 
+ void C_ModuleCommunication::receptionDeTrame(void)
+ {
+    m_xbee->RecieveData(m_charRxBuffer, 0);
+    pc.printf("You said:%s",m_charRxBuffer);
+    /*
+    frame newFrame;
+    newFrame.identifier = m_charRxBuffer[0];
+    
+    for(int i = 0; i < 8; i++) {
+        newFrame.data[0] = m_charRxBuffer[i+1];
+    }
+    
+    m_trameRxBuffer->frameBuffer(newFrame);
+    */
+ }
\ No newline at end of file