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:
- 29:9a932d354ae3
- Parent:
- 28:6f9c5af9e272
- Child:
- 32:7bdaac2c4cbf
- Child:
- 33:ab4ff35d27ea
--- a/main.cpp Mon Apr 06 18:00:34 2015 +0000 +++ b/main.cpp Mon Apr 06 18:32:34 2015 +0000 @@ -50,7 +50,7 @@ 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* rps_read = NULL; Thread* flex_thread_ptr = NULL; // Lecture des entrées analogiques Mail<flex_t, 32> mailbox_flex; @@ -61,7 +61,7 @@ /*Flag du decodage - s'execute a chaque fronts, descendants et montants*/ if ((LPC_TIM2->IR & 0x20) == 0x20) { LPC_TIM2->IR |= 0x20; // clear Timer2 interrupt register - threads[1]->signal_set(0x02); + threads[mode]->signal_set(0x02); } } @@ -98,11 +98,11 @@ default: break; } - threads[0] = gunner_thread_ptr; - threads[1] = rps_thread_ptr; - threads[2] = airguitar_thread_ptr; - -rps_read = new Thread(flex_read); + threads[GUNNER] = gunner_thread_ptr; + threads[RPS] = rps_thread_ptr; + threads[AirGuitar] = airguitar_thread_ptr; + + rps_read = new Thread(flex_read); while(true) { } @@ -129,27 +129,18 @@ void gunner(void const* args) { // local variables - Cible* cible = new Cible(); - CountDown countDown(500); - countDown.run(); - while(true) { - // Thread::signal_wait(GO); - cible->reset(); - int target = rand() % 3; - cible->set(target); - countDown.run(); - - flex_t data = flexSensors.get_flex_values(); - m_pc.printf("index: %u, majeur: %u, annulaire: %u\n\r", data.index, data.majeur, data.annulaire); - char data_test[3] = {data.index, data.majeur, data.annulaire}; - xbee->EnvoyerDonnees(data_test,3); + Thread::signal_wait(0x02); + flex_data = flexSensors.get_flex_values(); + flex_t *mail = mailbox_flex.alloc(); + mail = &flex_data; + mailbox_flex.put(mail); } } void configure_GUNNER() { - accel.set_TRANSIENT_MODE(0x18, 0x05, 0x08); + accel.set_TRANSIENT_MODE(0x18, 0x05, 0x08); // z plan transient motion detection } void rps(void const* args) @@ -186,7 +177,7 @@ m_pc.printf("Valeur des flex : %d, %d, %d\r\n" , mail->index, mail->majeur, mail->annulaire); mailbox_flex.free(mail); } - } + } } void configure_RPS()