Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Repo_Noeud_Mobile by
Diff: main.cpp
- Revision:
- 39:558cd5780490
- Parent:
- 38:0196baea1d35
- Child:
- 40:cf5a55961d8c
--- a/main.cpp Mon Apr 06 19:52:29 2015 +0000 +++ b/main.cpp Mon Apr 06 20:18:02 2015 +0000 @@ -34,7 +34,7 @@ void configure_GUITAR(); void ReadConfig(); void timer2_init(void); -void flex_read(void const* args); +void Send_Data_To_Fixe(void const* args); uint8_t play = 0; @@ -44,14 +44,14 @@ RtosTimer *sync; GameMode_e mode = RPS; short PanId; -Xbee* xbee = NULL; +Xbee xbee; Thread *threads[3]; Thread* gunner_thread_ptr = NULL; // Possiblement mettre dans un tableau Thread* rps_thread_ptr = NULL; // avec des position codees Thread* airguitar_thread_ptr = NULL; // dans des define. guillaume -Thread* rps_read = NULL; Thread* flex_thread_ptr = NULL; // Lecture des entrées analogiques +Thread* Thread_Send_Data_To_Fixe = NULL;// Thread pour envoyer les données des sensors au fixe Mail<Mobile_Vers_Fixe, 32> mailbox_Mobile_Vers_Fixe; @@ -72,7 +72,7 @@ ReadConfig(); //read config file m_pc.printf("PANID %x\r\n", PanId); - xbee = new Xbee(PanId, p13, p14); //set PAN ID + xbee = Xbee(PanId, p13, p14); //set PAN ID #if ACTIVATE_ACCEL accel = Accel(); @@ -101,17 +101,8 @@ threads[RPS] = rps_thread_ptr; threads[AirGuitar] = airguitar_thread_ptr; - rps_read = new Thread(flex_read); + Thread_Send_Data_To_Fixe = new Thread(Send_Data_To_Fixe); -/* #if ACTIVATE_ACCEL - Thread thread0(reception_coord); - Thread thread1(etat_de_jeu); - Thread thread2(analyze_sensor_data); - threads[0] = &thread0; - threads[1] = &thread1; - threads[2] = &thread2; - #endif -*/ while(true) { } @@ -183,7 +174,7 @@ } } -void flex_read(void const* args) +void Send_Data_To_Fixe(void const* args) { while (true) { // attente et lecture d'un événement digital @@ -191,7 +182,10 @@ if (evtD.status == osEventMail) { Mobile_Vers_Fixe *mail = (Mobile_Vers_Fixe*)evtD.value.p; // écriture de l'événement en sortie (port série) - m_pc.printf("Valeur des flex : %d, %d, %d\r\n" , mail->flexSensor.index, mail->flexSensor.majeur, mail->flexSensor.annulaire); + //m_pc.printf("Valeur des flex : %d, %d, %d\r\n" , mail->flexSensor.index, mail->flexSensor.majeur, mail->flexSensor.annulaire); + + // Envoyer la structure + xbee.EnvoyerStructure(mail); mailbox_Mobile_Vers_Fixe.free(mail); } }