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/Task3.h@27:18b6580eb0b1, 2014-05-10 (annotated)
- Committer:
- pHysiX
- Date:
- Sat May 10 01:39:02 2014 +0000
- Revision:
- 27:18b6580eb0b1
- Parent:
- 25:a7cfe421cb4a
- Child:
- 30:d9b988f8d84f
Alternative1: Run Master only when YPR is updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pHysiX | 22:ef8aa9728013 | 1 | /* File: Task3.h |
pHysiX | 22:ef8aa9728013 | 2 | * Author: Trung Tin Ian HUA |
pHysiX | 22:ef8aa9728013 | 3 | * Date: May 2014 |
pHysiX | 22:ef8aa9728013 | 4 | * Purpose: Thread3: RC & BT Command, and Telemetry |
pHysiX | 22:ef8aa9728013 | 5 | * Settings: 50Hz |
pHysiX | 22:ef8aa9728013 | 6 | */ |
pHysiX | 22:ef8aa9728013 | 7 | |
pHysiX | 1:43f8ac7ca6d7 | 8 | #include "mbed.h" |
pHysiX | 1:43f8ac7ca6d7 | 9 | #include "rtos.h" |
pHysiX | 1:43f8ac7ca6d7 | 10 | #include "tasks.h" |
pHysiX | 1:43f8ac7ca6d7 | 11 | |
pHysiX | 1:43f8ac7ca6d7 | 12 | #ifndef _TASK3_H_ |
pHysiX | 1:43f8ac7ca6d7 | 13 | #define _TASKS3_H_ |
pHysiX | 1:43f8ac7ca6d7 | 14 | |
pHysiX | 22:ef8aa9728013 | 15 | // ms timing: Refer to tasks.h to change frequency of Task3. |
pHysiX | 1:43f8ac7ca6d7 | 16 | #define TASK3_PERIOD 1000/TASK3_FREQUENCY |
pHysiX | 1:43f8ac7ca6d7 | 17 | |
pHysiX | 12:953d25061417 | 18 | /* Scale: |
pHysiX | 12:953d25061417 | 19 | Vin = ADC * Vread * scale |
pHysiX | 12:953d25061417 | 20 | Vin = (2^n-1)/3.3 * k*Vin * scale * ADJUST |
pHysiX | 12:953d25061417 | 21 | */ |
pHysiX | 12:953d25061417 | 22 | #define VOLTAGE_SCALE 49.60248447 |
pHysiX | 12:953d25061417 | 23 | |
pHysiX | 25:a7cfe421cb4a | 24 | //typedef enum { |
pHysiX | 25:a7cfe421cb4a | 25 | enum FLIGHT_MODE { |
pHysiX | 25:a7cfe421cb4a | 26 | RATE, |
pHysiX | 27:18b6580eb0b1 | 27 | ATTITUDE |
pHysiX | 25:a7cfe421cb4a | 28 | }; |
pHysiX | 25:a7cfe421cb4a | 29 | |
pHysiX | 1:43f8ac7ca6d7 | 30 | extern float ypr_offset[3]; |
pHysiX | 1:43f8ac7ca6d7 | 31 | |
pHysiX | 3:605fbcb54e75 | 32 | extern bool box_demo; |
pHysiX | 5:4879ef0e6d41 | 33 | extern bool rc_out; |
pHysiX | 5:4879ef0e6d41 | 34 | extern bool gyro_out; |
pHysiX | 21:b642c18eccd1 | 35 | extern bool command_check; |
pHysiX | 21:b642c18eccd1 | 36 | extern bool adjust_check; |
pHysiX | 3:605fbcb54e75 | 37 | |
pHysiX | 3:605fbcb54e75 | 38 | extern int RCCommand[5]; |
pHysiX | 21:b642c18eccd1 | 39 | extern int inputYPR[3]; |
pHysiX | 3:605fbcb54e75 | 40 | |
pHysiX | 25:a7cfe421cb4a | 41 | extern FLIGHT_MODE mode; |
pHysiX | 25:a7cfe421cb4a | 42 | |
pHysiX | 22:ef8aa9728013 | 43 | /* Thread3: RC & BT Command, and Telemetry */ |
pHysiX | 1:43f8ac7ca6d7 | 44 | void Task3(void const *argument); |
pHysiX | 1:43f8ac7ca6d7 | 45 | |
pHysiX | 17:18c3bd016e49 | 46 | int constrainRCCommand(int input); |
pHysiX | 17:18c3bd016e49 | 47 | |
pHysiX | 1:43f8ac7ca6d7 | 48 | #endif |