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-Threads/inc/Task4.h@50:8a0accb23007, 2014-05-19 (annotated)
- Committer:
- pHysiX
- Date:
- Mon May 19 14:16:47 2014 +0000
- Revision:
- 50:8a0accb23007
- Parent:
- 44:4be5c01c6de2
- Child:
- 51:04c6af4319e1
Semaphores implemented, currently no hanging. Need to test flight
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pHysiX | 22:ef8aa9728013 | 1 | /* File: Task4.h |
| pHysiX | 22:ef8aa9728013 | 2 | * Author: Trung Tin Ian HUA |
| pHysiX | 22:ef8aa9728013 | 3 | * Date: May 2014 |
| pHysiX | 22:ef8aa9728013 | 4 | * Purpose: Thread4: ESC pulsewidth update. Note this is INDEPENDENT of the pulse frequency. |
| pHysiX | 22:ef8aa9728013 | 5 | * Settings: 200Hz |
| pHysiX | 22:ef8aa9728013 | 6 | * 200Hz <= PWM frequency <= 400Hz |
| pHysiX | 27:18b6580eb0b1 | 7 | * Refer to tasks.h to change PWM frequency |
| pHysiX | 22:ef8aa9728013 | 8 | */ |
| pHysiX | 1:43f8ac7ca6d7 | 9 | #include "mbed.h" |
| pHysiX | 1:43f8ac7ca6d7 | 10 | #include "rtos.h" |
| pHysiX | 1:43f8ac7ca6d7 | 11 | #include "tasks.h" |
| pHysiX | 1:43f8ac7ca6d7 | 12 | |
| pHysiX | 1:43f8ac7ca6d7 | 13 | #ifndef _TASK4_H_ |
| pHysiX | 1:43f8ac7ca6d7 | 14 | #define _TASK4_H_ |
| pHysiX | 1:43f8ac7ca6d7 | 15 | |
| pHysiX | 22:ef8aa9728013 | 16 | // ms timing: Refer to tasks.h to change frequency of Task4. |
| pHysiX | 1:43f8ac7ca6d7 | 17 | #define TASK4_PERIOD 1000/TASK4_FREQUENCY |
| pHysiX | 1:43f8ac7ca6d7 | 18 | |
| pHysiX | 44:4be5c01c6de2 | 19 | extern volatile int ESCpower[4]; |
| pHysiX | 2:ab967d7b4346 | 20 | |
| pHysiX | 14:267368c83b6a | 21 | extern bool armed; |
| pHysiX | 21:b642c18eccd1 | 22 | extern bool ESC_check; |
| pHysiX | 21:b642c18eccd1 | 23 | extern bool calibration_mode; |
| pHysiX | 14:267368c83b6a | 24 | |
| pHysiX | 50:8a0accb23007 | 25 | extern Semaphore sem_Task4; |
| pHysiX | 50:8a0accb23007 | 26 | |
| pHysiX | 22:ef8aa9728013 | 27 | /* Thread4: Update ESC pulsewidth */ |
| pHysiX | 1:43f8ac7ca6d7 | 28 | void Task4(void const *argument); |
| pHysiX | 1:43f8ac7ca6d7 | 29 | |
| pHysiX | 33:f88a6ee18103 | 30 | // ======================== |
| pHysiX | 33:f88a6ee18103 | 31 | // === Helper functions === |
| pHysiX | 33:f88a6ee18103 | 32 | // ======================== |
| pHysiX | 50:8a0accb23007 | 33 | void Task4_ISR(void const *argument); |
| pHysiX | 21:b642c18eccd1 | 34 | int constrainESC(float input); |
| pHysiX | 19:bd88749c8db4 | 35 | |
| pHysiX | 1:43f8ac7ca6d7 | 36 | #endif |