ajout module_mouvement
Dependencies: mbed xbee_lib ADXL345_I2C IMUfilter ITG3200 Motor RangeFinder Servo mbos PID
Fork of Labo_TRSE_Drone by
Revision 31:a0800d3da787, committed 2013-04-17
- Comitter:
- IngesupMbed01
- Date:
- Wed Apr 17 10:16:19 2013 +0000
- Parent:
- 28:8b5ccd2f837e
- Child:
- 32:119e060b45b3
- Commit message:
- Define et structures ajout?s.
Changed in this revision
--- a/Module_Communication/Module_Communication.cpp Wed Apr 03 13:48:30 2013 +0000 +++ b/Module_Communication/Module_Communication.cpp Wed Apr 17 10:16:19 2013 +0000 @@ -52,7 +52,6 @@ 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(); @@ -68,14 +67,15 @@ void C_ModuleCommunication::receptionDeTrame(void) { + Serial pc(USBTX, USBRX); m_xbee->RecieveData(m_charRxBuffer, 0); - pc.printf("You said:%s",m_charRxBuffer); + pc.printf("You said:%s \n",m_charRxBuffer); /* frame newFrame; newFrame.identifier = m_charRxBuffer[0]; for(int i = 0; i < 8; i++) { - newFrame.data[0] = m_charRxBuffer[i+1]; + newFrame.data[i] = m_charRxBuffer[i+1]; } m_trameRxBuffer->frameBuffer(newFrame);
--- a/Module_Communication/Module_Communication.h Wed Apr 03 13:48:30 2013 +0000 +++ b/Module_Communication/Module_Communication.h Wed Apr 17 10:16:19 2013 +0000 @@ -25,8 +25,6 @@ #include "xbee.h" #include "Buffer_Trame.h" - Serial pc(USBTX, USBRX); //Initalise PC serial comms - class C_ModuleCommunication { private :
--- a/Service/Service.h Wed Apr 03 13:48:30 2013 +0000 +++ b/Service/Service.h Wed Apr 17 10:16:19 2013 +0000 @@ -22,6 +22,38 @@ #include "mbos.h" + //Define de type de mouvement + #define GAUCHE 1 + #define DROITE 2 + #define AVANT 3 + #define ARRIERE 4 + #define HAUT 5 + #define BAS 6 + #define LATERAL_GAUCHE 7 + #define LATERAL_DROITE 8 + + //Define de type d'ordre spécifique + #define ORDRE_RETOUR_BASE 1 + #define ORDRE_POSER 2 + + union conversionCharFloat { + float f; + char ch[4]; + }; + + typedef struct { + float x; + float y; + float z; + }position; + + unsigned int COMMANDE_TRAJECTOIRE; + unsigned int NIVEAU_BATTERIE; + position DONNEE_GYROSCOPE; + position DONNEE_ACCELEROMETRE; + + + class C_Service { private : /* ATTRIBUTS */
--- a/main.cpp Wed Apr 03 13:48:30 2013 +0000 +++ b/main.cpp Wed Apr 17 10:16:19 2013 +0000 @@ -34,6 +34,7 @@ }*/ #include "mbed.h" #include "mbos.h" +#include "Module_Communication.h" #define TASK1_ID 1 // Id for task 1 (idle task is 0) #define TASK1_PRIO 50 // priority for task 1 @@ -55,6 +56,7 @@ int main(void) { +/* // Configure tasks and timers os.CreateTask(TASK1_ID, TASK1_PRIO, TASK1_STACK_SZ, task1); os.CreateTask(TASK2_ID, TASK2_PRIO, TASK2_STACK_SZ, task2); @@ -62,6 +64,9 @@ // Start mbos os.Start(); // never return! + */ + C_ModuleCommunication com = C_ModuleCommunication(); + com.receptionDeTrame(); } void task1(void)