Projet_S5 / Mbed 2 deprecated Repo_Noeud_Mobile_refactor

Dependencies:   mbed-rtos mbed

Fork of Repo_Noeud_Mobile by Projet_S5

Revision:
1:601d2922ff06
Child:
3:a77d02cb5694
Child:
6:fd1bf5563299
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 04 19:42:35 2015 +0000
@@ -0,0 +1,83 @@
+/* S5 Projet - Conception d'un systeme embarque reseaute
+ * main.cpp
+ * 
+ * @author Equipe de projet 2
+ * 
+ */
+#include "mbed.h"
+#include "rtos.h"
+#include "FlexSensor.h"
+#include "CountDown.h"
+
+#define GO 0x01
+
+enum GameMode { GUNNER, RPS, AirGuitar};
+
+//PROTOTYPES DE FONCTION 
+void gunner(void const* args);
+void rps(void const* args);
+void airGuitar(void const* args);
+
+FlexSensor index(DIGITAL, p15);       // flex sensor 1.
+FlexSensor majeur(DIGITAL, p16);      // flex sensor 2.
+FlexSensor annulaire(DIGITAL, p17);   // flex sensor 3.
+CountDown countDown;
+
+Thread* gunner_thread_ptr = NULL;
+Thread* rps_thread_ptr = NULL;
+Thread* airguitar_thread_ptr = NULL;
+
+int main(void const* args)
+{
+    GameMode mode = GUNNER;
+    countDown.run();
+    switch(mode)
+    {
+        case GUNNER:
+            gunner_thread_ptr =  new Thread(gunner);
+            break;
+        case RPS:
+            rps_thread_ptr =  new Thread(rps);
+            break;
+        case AirGuitar:
+            airguitar_thread_ptr = new Thread(airGuitar);
+            break;
+        default:
+            break;
+    }
+}
+
+void gunner(void const* args)
+{ 
+    // local variables 
+    
+    while(true)
+    {
+        Thread::signal_wait(GO);
+        // code...
+    }
+}
+
+void rps(void const* args)
+{
+    // local variables 
+    
+    while(true)
+    {
+        Thread::signal_wait(GO);
+        // code...
+    }
+}
+
+void airGuitar(void const* args)
+{
+    // local variables 
+    
+    while(true)
+    {
+        Thread::signal_wait(GO);
+        // code...
+    }
+}
+
+