Ian Hua / Quadcopter-mbedRTOS

RTOS-Threads/inc/Task2_Slave.h

Committer:
pHysiX
Date:
2014-05-19
Revision:
51:04c6af4319e1
Parent:
50:8a0accb23007

File content as of revision 51:04c6af4319e1:

/* File:        Task2_Slave.cpp
 * Author:      Trung Tin Ian HUA
 * Date:        May 2014
 * Purpose:     Thread2S: Slave PID control loop (rate)
 * Functions:   Gyro sample
 * Settings:    400Hz
 */
#include "mbed.h"
#include "rtos.h"
#include "tasks.h"

#ifndef _TASK2_SLAVE_H_
#define _TASK2_SLAVE_H_

// ms timing: Refer to tasks.h to change frequency of Task2_Slave.
#define TASK2_SLAVE_PERIOD 1000/TASK2_MASTER_FREQUENCY

extern volatile float adjust[3];
extern int16_t gz;
extern volatile int gyro[3];

extern Semaphore sem_Task2_Slave;

/* Thread2-Slave: Gyro sample and Rate PID Control */
void Task2_Slave(void const *argument);

// ========================
// === Helper functions ===
// ========================
void Task2_Slave_ISR(void const *argument);
void gyroSample(void);

#endif