Ian Hua / Quadcopter-mbedRTOS
Committer:
pHysiX
Date:
Sat May 10 01:39:02 2014 +0000
Revision:
27:18b6580eb0b1
Parent:
22:ef8aa9728013
Child:
31:3dde2201e54d
Alternative1: Run Master only when YPR is updated

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 22:ef8aa9728013 6
pHysiX 1:43f8ac7ca6d7 7 #include "tasks.h"
pHysiX 1:43f8ac7ca6d7 8 #include "setup.h"
pHysiX 1:43f8ac7ca6d7 9
pHysiX 3:605fbcb54e75 10 void createThreads(void)
pHysiX 1:43f8ac7ca6d7 11 {
pHysiX 3:605fbcb54e75 12 /* Create threads */
pHysiX 3:605fbcb54e75 13 RtosTimer thread1(Task1, osTimerPeriodic, NULL);
pHysiX 27:18b6580eb0b1 14 RtosTimer thread2Master(Task2_Master, osTimerPeriodic, NULL);
pHysiX 27:18b6580eb0b1 15 RtosTimer thread2Slave(Task2_Slave, osTimerPeriodic, NULL);
pHysiX 3:605fbcb54e75 16 RtosTimer thread3(Task3, osTimerPeriodic, (void *)0);
pHysiX 3:605fbcb54e75 17 RtosTimer thread4(Task4, osTimerPeriodic, (void *)0);
pHysiX 3:605fbcb54e75 18
pHysiX 3:605fbcb54e75 19 /* Start threads */
pHysiX 3:605fbcb54e75 20 thread1.start(TASK1_PERIOD);
pHysiX 27:18b6580eb0b1 21 thread2Master.start(TASK2_MASTER_PERIOD);
pHysiX 27:18b6580eb0b1 22 thread2Slave.start(TASK2_SLAVE_PERIOD);
pHysiX 3:605fbcb54e75 23 thread3.start(TASK3_PERIOD);
pHysiX 3:605fbcb54e75 24 thread4.start(TASK4_PERIOD);
pHysiX 21:b642c18eccd1 25
pHysiX 3:605fbcb54e75 26 /* Execute state machine forever */
pHysiX 3:605fbcb54e75 27 Thread::wait(osWaitForever);
pHysiX 1:43f8ac7ca6d7 28 }