Ian Hua / Quadcopter-mbedRTOS
Committer:
pHysiX
Date:
Mon May 19 14:16:47 2014 +0000
Revision:
50:8a0accb23007
Parent:
48:9dbdc4144f00
Child:
51:04c6af4319e1
Semaphores implemented, currently no hanging. Need to test flight

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pHysiX 22:ef8aa9728013 1 /* File: tasks.h
pHysiX 22:ef8aa9728013 2 * Author: Trung Tin Ian HUA
pHysiX 22:ef8aa9728013 3 * Date: May 2014
pHysiX 22:ef8aa9728013 4 * Purpose: Code to intialise and start all threads.
pHysiX 22:ef8aa9728013 5 */
pHysiX 1:43f8ac7ca6d7 6 #include "tasks.h"
pHysiX 1:43f8ac7ca6d7 7 #include "setup.h"
pHysiX 1:43f8ac7ca6d7 8
pHysiX 3:605fbcb54e75 9 void createThreads(void)
pHysiX 1:43f8ac7ca6d7 10 {
pHysiX 3:605fbcb54e75 11 /* Create threads */
pHysiX 50:8a0accb23007 12 Thread thread1(Task1, NULL, osPriorityIdle);
pHysiX 50:8a0accb23007 13 Thread thread2Master(Task2_Master, NULL, osPriorityHigh);
pHysiX 50:8a0accb23007 14 Thread thread2Slave(Task2_Slave, NULL, osPriorityRealtime);
pHysiX 50:8a0accb23007 15 //Thread thread4(Task4, NULL, osPriorityRealtime);
pHysiX 50:8a0accb23007 16
pHysiX 50:8a0accb23007 17 /* Create timer callbacks */
pHysiX 50:8a0accb23007 18 RtosTimer thread2Master_ISR(Task2_Master_ISR, osTimerPeriodic, NULL);
pHysiX 50:8a0accb23007 19 thread2Master_ISR.start(TASK2_MASTER_PERIOD);
pHysiX 50:8a0accb23007 20
pHysiX 50:8a0accb23007 21 RtosTimer thread2Slave_ISR(Task2_Slave_ISR, osTimerPeriodic, NULL);
pHysiX 50:8a0accb23007 22 thread2Slave_ISR.start(TASK2_SLAVE_PERIOD);
pHysiX 50:8a0accb23007 23
pHysiX 50:8a0accb23007 24 RtosTimer thread3_ISR(Task3, osTimerPeriodic, NULL);
pHysiX 50:8a0accb23007 25 thread3_ISR.start(TASK3_PERIOD);
pHysiX 50:8a0accb23007 26
pHysiX 46:b11655031d24 27 RtosTimer thread4(Task4, osTimerPeriodic, NULL);
pHysiX 3:605fbcb54e75 28 thread4.start(TASK4_PERIOD);
pHysiX 21:b642c18eccd1 29
pHysiX 3:605fbcb54e75 30 /* Execute state machine forever */
pHysiX 3:605fbcb54e75 31 Thread::wait(osWaitForever);
pHysiX 1:43f8ac7ca6d7 32 }