Ian Hua / Quadcopter-mbedRTOS

RTOS-Setup/src/tasks.cpp

Committer:
pHysiX
Date:
2014-05-17
Revision:
46:b11655031d24
Parent:
31:3dde2201e54d
Child:
47:89a7077a70d3
Child:
48:9dbdc4144f00

File content as of revision 46:b11655031d24:

/* File:    tasks.h
 * Author:  Trung Tin Ian HUA
 * Date:    May 2014
 * Purpose: Code to intialise and start all threads.
 */
#include "tasks.h"
#include "setup.h"

void createThreads(void)
{
    /* Create threads */
    RtosTimer thread1(Task1, osTimerPeriodic, NULL);
    RtosTimer thread2Master(Task2_Master, osTimerPeriodic, NULL);
    RtosTimer thread2Slave(Task2_Slave, osTimerPeriodic, NULL);
    RtosTimer thread3(Task3, osTimerPeriodic, NULL);
    RtosTimer thread4(Task4, osTimerPeriodic, NULL);

    /* Start threads */
    thread1.start(TASK1_PERIOD);
    thread2Master.start(TASK2_MASTER_PERIOD);
    thread2Slave.start(TASK2_SLAVE_PERIOD);
    thread3.start(TASK3_PERIOD);
    thread4.start(TASK4_PERIOD);

    /* Execute state machine forever */
    Thread::wait(osWaitForever);
}