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/src/Task2_Master.cpp
- Committer:
- pHysiX
- Date:
- 2014-05-12
- Revision:
- 31:3dde2201e54d
- Parent:
- 30:d9b988f8d84f
- Child:
- 33:f88a6ee18103
File content as of revision 31:3dde2201e54d:
/* File: Task2_Master.cpp * Author: Trung Tin Ian HUA * Date: May 2014 * Purpose: Thread2M: Master PID control loop (attitude) * Settings: 100Hz * Timing: 40us */ #include "Task2_Slave.h" #include "setup.h" #include "PID.h" /* YPR Adjust */ volatile float adjust_attitude[3] = {0.0, 0.0, 0.0}; //bool counterTask2Master = false; //Timer void Task2_Master(void const *argument) { //Timer if (armed) { switch (mode) { case RATE: break; case ATTITUDE: default: //Timer AHRSSample(); pitchPIDstable.setProcessValue((int) (ypr[1] - ypr_offset[1])); rollPIDstable.setProcessValue((int) (ypr[2] - ypr_offset[2])); pitchPIDstable.setSetPoint(inputYPR[1]); rollPIDstable.setSetPoint(inputYPR[2]); adjust_attitude[1] = pitchPIDstable.compute(); adjust_attitude[2] = rollPIDstable.compute(); adjust_attitude[2] *= -1; //counterTask2Master = true; //Timer break; } //Timer } }