Ian Hua / Quadcopter-mbedRTOS
Committer:
pHysiX
Date:
Mon May 12 05:12:19 2014 +0000
Revision:
31:3dde2201e54d
Parent:
27:18b6580eb0b1
Child:
46:b11655031d24
Rearranged threads and approach

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