Ian Hua / Quadcopter-mbedRTOS

RTOS-Setup/inc/setup.h

Committer:
pHysiX
Date:
2014-05-08
Revision:
22:ef8aa9728013
Parent:
21:b642c18eccd1
Child:
27:18b6580eb0b1

File content as of revision 22:ef8aa9728013:

/* File:    setup.h
 * Author:  Trung Tin Ian HUA
 * Date:    May 2014
 * Purpose: Setup code to initialise all devices.
 */ 

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

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

#ifndef _SETUP_H_
#define _SETUP_H_

/* PID Gains: */
extern float KP_PITCH_STABLE;
extern float KP_ROLL_STABLE;
extern float KP_YAW_RATE;
extern float KP_PITCH_RATE;
extern float KP_ROLL_RATE;
extern float PID_TI_RATE;
extern float PID_TI_STABLE;

#define ESC_FREQUENCY 200
#define ESC_PERIOD_US 1000000/ESC_FREQUENCY

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

/* PID Devices: */
extern PID pitchPIDstable;
extern PID rollPIDstable;
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