Ian Hua / Quadcopter-mbedRTOS

RTOS-Setup/inc/setup.h

Committer:
pHysiX
Date:
2014-05-19
Revision:
48:9dbdc4144f00
Parent:
39:02782ad251db
Child:
49:c882f9135033

File content as of revision 48:9dbdc4144f00:

/* File:    setup.h
 * Author:  Trung Tin Ian HUA
 * Date:    May 2014
 * Purpose: Setup code to initialise all devices.
 */
//#define TIME_TASK1
//#define TIME_TASK2M
//#define TIME_TASK2S
//#define TIME_TASK3
//#define TIME_TASK4

#include "mbed.h"
#include "MPU6050_6Axis_MotionApps20.h"
#include "MPU6050_6Axis_MotionApps20_NB.h"
#include "PID.h"
#include "MPL3115A2.h"

#include "config.h"

#ifdef ENABLE_COMPASS
#include "HMC5883L.h"
#endif

#ifndef _SETUP_H_
#define _SETUP_H_

/* PID Gains: */
extern float KP_YAW_RATE;
extern float KP_PITCH_RATE;
extern float KP_ROLL_RATE;
extern float TI_YAW_RATE;
extern float TI_PITCH_RATE;
extern float TI_ROLL_RATE;

extern float KP_PITCH_ATTITUDE;
extern float KP_ROLL_ATTITUDE;
extern float TI_PITCH_ATTITUDE;
extern float TI_ROLL_ATTITUDE;

/* Sensors and devices: */
extern Serial BT;
extern DigitalOut BT_CMD;
extern AnalogIn voltageSense;
//extern MPU6050 imu;
extern MPU6050_NB imu_nb;
extern uint16_t packetSize;
extern MPL3115A2 altimeter;
extern PwmOut ESC[4];

/* PID Devices: */
extern PID pitchPIDattitude;
extern PID rollPIDattitude;
extern PID yawPIDrate;
extern PID pitchPIDrate;
extern PID rollPIDrate;

/* Setup routines: */
bool setupALLdevices(void);
bool setup_ESC(void);
bool setup_bt(void);
bool setup_PID(void);
bool setup_mpu6050(void);
bool setup_altimeter(void);

#ifdef ENABLE_COMPASS
extern HMC5883L compass;
bool setup_compass(void);
#endif

#endif