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/Task2_Slave.h@50:8a0accb23007, 2014-05-19 (annotated)
- Committer:
- pHysiX
- Date:
- Mon May 19 14:16:47 2014 +0000
- Revision:
- 50:8a0accb23007
- Parent:
- 38:ef65533cca32
- 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 | 36:d95e3d6f2fc4 | 1 | /* File: Task2_Slave.cpp |
pHysiX | 22:ef8aa9728013 | 2 | * Author: Trung Tin Ian HUA |
pHysiX | 22:ef8aa9728013 | 3 | * Date: May 2014 |
pHysiX | 36:d95e3d6f2fc4 | 4 | * Purpose: Thread2S: Slave PID control loop (rate) |
pHysiX | 36:d95e3d6f2fc4 | 5 | * Functions: Gyro sample |
pHysiX | 36:d95e3d6f2fc4 | 6 | * Settings: 400Hz |
pHysiX | 36:d95e3d6f2fc4 | 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 | 27:18b6580eb0b1 | 12 | #ifndef _TASK2_SLAVE_H_ |
pHysiX | 27:18b6580eb0b1 | 13 | #define _TASK2_SLAVE_H_ |
pHysiX | 1:43f8ac7ca6d7 | 14 | |
pHysiX | 29:6c03b30b59ec | 15 | // ms timing: Refer to tasks.h to change frequency of Task2_Slave. |
pHysiX | 27:18b6580eb0b1 | 16 | #define TASK2_SLAVE_PERIOD 1000/TASK2_MASTER_FREQUENCY |
pHysiX | 1:43f8ac7ca6d7 | 17 | |
pHysiX | 21:b642c18eccd1 | 18 | extern volatile float adjust[3]; |
pHysiX | 38:ef65533cca32 | 19 | extern int16_t gz; |
pHysiX | 21:b642c18eccd1 | 20 | extern volatile int gyro[3]; |
pHysiX | 10:ef5fe86f67fe | 21 | extern bool counterESC; |
pHysiX | 10:ef5fe86f67fe | 22 | |
pHysiX | 50:8a0accb23007 | 23 | extern Semaphore sem_Task2_Slave; |
pHysiX | 50:8a0accb23007 | 24 | |
pHysiX | 27:18b6580eb0b1 | 25 | /* Thread2-Slave: Gyro sample and Rate PID Control */ |
pHysiX | 27:18b6580eb0b1 | 26 | void Task2_Slave(void const *argument); |
pHysiX | 50:8a0accb23007 | 27 | |
pHysiX | 50:8a0accb23007 | 28 | // ======================== |
pHysiX | 50:8a0accb23007 | 29 | // === Helper functions === |
pHysiX | 50:8a0accb23007 | 30 | // ======================== |
pHysiX | 50:8a0accb23007 | 31 | void Task2_Slave_ISR(void const *argument); |
pHysiX | 36:d95e3d6f2fc4 | 32 | void gyroSample(void); |
pHysiX | 1:43f8ac7ca6d7 | 33 | |
pHysiX | 1:43f8ac7ca6d7 | 34 | #endif |