Ian Hua / Quadcopter-mbedRTOS
Revision:
50:8a0accb23007
Parent:
48:9dbdc4144f00
Child:
51:04c6af4319e1
--- a/RTOS-Setup/src/tasks.cpp	Mon May 19 13:33:34 2014 +0000
+++ b/RTOS-Setup/src/tasks.cpp	Mon May 19 14:16:47 2014 +0000
@@ -9,17 +9,22 @@
 void createThreads(void)
 {
     /* Create threads */
-    RtosTimer thread2Master(Task2_Master, osTimerPeriodic, NULL);
-    RtosTimer thread2Slave(Task2_Slave, osTimerPeriodic, NULL);
-    RtosTimer thread3(Task3, osTimerPeriodic, NULL);
+    Thread thread1(Task1, NULL, osPriorityIdle);
+    Thread thread2Master(Task2_Master, NULL, osPriorityHigh);
+    Thread thread2Slave(Task2_Slave, NULL, osPriorityRealtime);
+    //Thread thread4(Task4, NULL, osPriorityRealtime);
+    
+    /* Create timer callbacks */
+    RtosTimer thread2Master_ISR(Task2_Master_ISR, osTimerPeriodic, NULL);
+    thread2Master_ISR.start(TASK2_MASTER_PERIOD);
+    
+    RtosTimer thread2Slave_ISR(Task2_Slave_ISR, osTimerPeriodic, NULL);
+    thread2Slave_ISR.start(TASK2_SLAVE_PERIOD);
+    
+    RtosTimer thread3_ISR(Task3, osTimerPeriodic, NULL);
+    thread3_ISR.start(TASK3_PERIOD);
+    
     RtosTimer thread4(Task4, osTimerPeriodic, NULL);
-
-    /* Start threads */
-    Thread thread1(Task1, NULL, osPriorityIdle);
-
-    thread2Master.start(TASK2_MASTER_PERIOD);
-    thread2Slave.start(TASK2_SLAVE_PERIOD);
-    thread3.start(TASK3_PERIOD);
     thread4.start(TASK4_PERIOD);
 
     /* Execute state machine forever */