Ian Hua / Quadcopter-mbedRTOS
Committer:
pHysiX
Date:
Mon May 19 13:21:17 2014 +0000
Revision:
48:9dbdc4144f00
Parent:
39:02782ad251db
Child:
49:c882f9135033
Altimeter and IMU changed to non-blocking I2C

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pHysiX 22:ef8aa9728013 1 /* File: setup.h
pHysiX 22:ef8aa9728013 2 * Author: Trung Tin Ian HUA
pHysiX 22:ef8aa9728013 3 * Date: May 2014
pHysiX 22:ef8aa9728013 4 * Purpose: Setup code to initialise all devices.
pHysiX 48:9dbdc4144f00 5 */
pHysiX 30:d9b988f8d84f 6 //#define TIME_TASK1
pHysiX 30:d9b988f8d84f 7 //#define TIME_TASK2M
pHysiX 30:d9b988f8d84f 8 //#define TIME_TASK2S
pHysiX 30:d9b988f8d84f 9 //#define TIME_TASK3
pHysiX 30:d9b988f8d84f 10 //#define TIME_TASK4
pHysiX 22:ef8aa9728013 11
pHysiX 1:43f8ac7ca6d7 12 #include "mbed.h"
pHysiX 1:43f8ac7ca6d7 13 #include "MPU6050_6Axis_MotionApps20.h"
pHysiX 48:9dbdc4144f00 14 #include "MPU6050_6Axis_MotionApps20_NB.h"
pHysiX 3:605fbcb54e75 15 #include "PID.h"
pHysiX 12:953d25061417 16 #include "MPL3115A2.h"
pHysiX 12:953d25061417 17
pHysiX 39:02782ad251db 18 #include "config.h"
pHysiX 39:02782ad251db 19
pHysiX 12:953d25061417 20 #ifdef ENABLE_COMPASS
pHysiX 12:953d25061417 21 #include "HMC5883L.h"
pHysiX 12:953d25061417 22 #endif
pHysiX 1:43f8ac7ca6d7 23
pHysiX 1:43f8ac7ca6d7 24 #ifndef _SETUP_H_
pHysiX 1:43f8ac7ca6d7 25 #define _SETUP_H_
pHysiX 1:43f8ac7ca6d7 26
pHysiX 22:ef8aa9728013 27 /* PID Gains: */
pHysiX 20:b193a50a2ba3 28 extern float KP_YAW_RATE;
pHysiX 20:b193a50a2ba3 29 extern float KP_PITCH_RATE;
pHysiX 20:b193a50a2ba3 30 extern float KP_ROLL_RATE;
pHysiX 32:7a9be7761c46 31 extern float TI_YAW_RATE;
pHysiX 32:7a9be7761c46 32 extern float TI_PITCH_RATE;
pHysiX 32:7a9be7761c46 33 extern float TI_ROLL_RATE;
pHysiX 39:02782ad251db 34
pHysiX 39:02782ad251db 35 extern float KP_PITCH_ATTITUDE;
pHysiX 39:02782ad251db 36 extern float KP_ROLL_ATTITUDE;
pHysiX 39:02782ad251db 37 extern float TI_PITCH_ATTITUDE;
pHysiX 39:02782ad251db 38 extern float TI_ROLL_ATTITUDE;
pHysiX 21:b642c18eccd1 39
pHysiX 22:ef8aa9728013 40 /* Sensors and devices: */
pHysiX 1:43f8ac7ca6d7 41 extern Serial BT;
pHysiX 1:43f8ac7ca6d7 42 extern DigitalOut BT_CMD;
pHysiX 48:9dbdc4144f00 43 extern AnalogIn voltageSense;
pHysiX 48:9dbdc4144f00 44 //extern MPU6050 imu;
pHysiX 48:9dbdc4144f00 45 extern MPU6050_NB imu_nb;
pHysiX 1:43f8ac7ca6d7 46 extern uint16_t packetSize;
pHysiX 22:ef8aa9728013 47 extern MPL3115A2 altimeter;
pHysiX 22:ef8aa9728013 48 extern PwmOut ESC[4];
pHysiX 12:953d25061417 49
pHysiX 22:ef8aa9728013 50 /* PID Devices: */
pHysiX 39:02782ad251db 51 extern PID pitchPIDattitude;
pHysiX 39:02782ad251db 52 extern PID rollPIDattitude;
pHysiX 3:605fbcb54e75 53 extern PID yawPIDrate;
pHysiX 3:605fbcb54e75 54 extern PID pitchPIDrate;
pHysiX 3:605fbcb54e75 55 extern PID rollPIDrate;
pHysiX 1:43f8ac7ca6d7 56
pHysiX 22:ef8aa9728013 57 /* Setup routines: */
pHysiX 3:605fbcb54e75 58 bool setupALLdevices(void);
pHysiX 2:ab967d7b4346 59 bool setup_ESC(void);
pHysiX 1:43f8ac7ca6d7 60 bool setup_bt(void);
pHysiX 3:605fbcb54e75 61 bool setup_PID(void);
pHysiX 1:43f8ac7ca6d7 62 bool setup_mpu6050(void);
pHysiX 22:ef8aa9728013 63 bool setup_altimeter(void);
pHysiX 22:ef8aa9728013 64
pHysiX 12:953d25061417 65 #ifdef ENABLE_COMPASS
pHysiX 22:ef8aa9728013 66 extern HMC5883L compass;
pHysiX 12:953d25061417 67 bool setup_compass(void);
pHysiX 12:953d25061417 68 #endif
pHysiX 1:43f8ac7ca6d7 69
pHysiX 1:43f8ac7ca6d7 70 #endif