Ian Hua / Quadcopter-mbedRTOS

RTOS-Threads/inc/Task4.h

Committer:
pHysiX
Date:
2014-05-19
Revision:
54:a36d39a90c21
Parent:
51:04c6af4319e1

File content as of revision 54:a36d39a90c21:

/* File:        Task4.h
 * Author:      Trung Tin Ian HUA
 * Date:        May 2014
 * Purpose:     Thread4: ESC pulsewidth update. Note this is INDEPENDENT of the pulse frequency.
 * Settings:    200Hz
 * 200Hz <= PWM frequency <= 400Hz
 * Refer to tasks.h to change PWM frequency 
 */ 
#include "mbed.h"
#include "rtos.h"
#include "tasks.h"

#ifndef _TASK4_H_
#define _TASK4_H_

// ms timing: Refer to tasks.h to change frequency of Task4.
#define TASK4_PERIOD 1000/TASK4_FREQUENCY

extern volatile int ESCpower[4];

extern bool armed;
extern bool ESC_check;
extern bool calibration_mode;

extern Semaphore sem_Task4;

/* Thread4: Update ESC pulsewidth */
void Task4(void const *argument);

// ========================
// === Helper functions ===
// ========================
int constrainESC(float input);

#endif