Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RTOS-Setup/src/tasks.cpp@21:b642c18eccd1, 2014-05-08 (annotated)
- Committer:
- pHysiX
- Date:
- Thu May 08 09:39:12 2014 +0000
- Revision:
- 21:b642c18eccd1
- Parent:
- 3:605fbcb54e75
- Child:
- 22:ef8aa9728013
Primary PID disabled. Secondary (rate) PID enabled. P gain tuned
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pHysiX | 1:43f8ac7ca6d7 | 1 | #include "tasks.h" |
pHysiX | 1:43f8ac7ca6d7 | 2 | #include "setup.h" |
pHysiX | 1:43f8ac7ca6d7 | 3 | |
pHysiX | 3:605fbcb54e75 | 4 | void createThreads(void) |
pHysiX | 1:43f8ac7ca6d7 | 5 | { |
pHysiX | 3:605fbcb54e75 | 6 | /* Create threads */ |
pHysiX | 3:605fbcb54e75 | 7 | RtosTimer thread1(Task1, osTimerPeriodic, NULL); |
pHysiX | 3:605fbcb54e75 | 8 | RtosTimer thread2(Task2, osTimerPeriodic, NULL); |
pHysiX | 3:605fbcb54e75 | 9 | RtosTimer thread3(Task3, osTimerPeriodic, (void *)0); |
pHysiX | 3:605fbcb54e75 | 10 | RtosTimer thread4(Task4, osTimerPeriodic, (void *)0); |
pHysiX | 3:605fbcb54e75 | 11 | |
pHysiX | 3:605fbcb54e75 | 12 | /* Start threads */ |
pHysiX | 3:605fbcb54e75 | 13 | thread1.start(TASK1_PERIOD); |
pHysiX | 3:605fbcb54e75 | 14 | thread2.start(TASK2_PERIOD); |
pHysiX | 3:605fbcb54e75 | 15 | thread3.start(TASK3_PERIOD); |
pHysiX | 3:605fbcb54e75 | 16 | thread4.start(TASK4_PERIOD); |
pHysiX | 21:b642c18eccd1 | 17 | |
pHysiX | 3:605fbcb54e75 | 18 | /* Execute state machine forever */ |
pHysiX | 3:605fbcb54e75 | 19 | Thread::wait(osWaitForever); |
pHysiX | 1:43f8ac7ca6d7 | 20 | } |
pHysiX | 21:b642c18eccd1 | 21 | |
pHysiX | 21:b642c18eccd1 | 22 | /* |
pHysiX | 21:b642c18eccd1 | 23 | int abs(float input) |
pHysiX | 21:b642c18eccd1 | 24 | { |
pHysiX | 21:b642c18eccd1 | 25 | if (input < 0.0) |
pHysiX | 21:b642c18eccd1 | 26 | return -1* (int) input; |
pHysiX | 21:b642c18eccd1 | 27 | else |
pHysiX | 21:b642c18eccd1 | 28 | return input; |
pHysiX | 21:b642c18eccd1 | 29 | } |
pHysiX | 21:b642c18eccd1 | 30 | */ |
pHysiX | 21:b642c18eccd1 | 31 |