#ifndef IMU_H
#define IMU_H

#include "I2Cdev.h"
#include "Wire.h"

#define MPU6050_DEFAULT_ADDRESS         0x68
#define MPU6050_RA_PWR_MGMT_1           0x6B
#define MPU6050_PWR1_CLKSEL_BIT            2
#define MPU6050_PWR1_CLKSEL_LENGTH         3
#define MPU6050_CLOCK_PLL_XGYRO         0x01
#define MPU6050_RA_GYRO_CONFIG          0x1B
#define MPU6050_RA_ACCEL_CONFIG         0x1C
#define MPU6050_GCONFIG_FS_SEL_BIT         4
#define MPU6050_GCONFIG_FS_SEL_LENGTH      2
#define MPU6050_ACONFIG_AFS_SEL_BIT        4
#define MPU6050_ACONFIG_AFS_SEL_LENGTH     2
#define MPU6050_GYRO_FS_250             0x00

#define MPU6050_ACCEL_FS_2              0x00
#define MPU6050_RA_PWR_MGMT_1           0x6B
#define MPU6050_PWR1_SLEEP_BIT             6
#define MPU6050_WHO_AM_I_BIT               6
#define MPU6050_WHO_AM_I_LENGTH            6
#define MPU6050_RA_WHO_AM_I             0x75
#define MPU6050_RA_ACCEL_XOUT_H         0x3B

#define MPU6050_RA_XA_OFFS_H        0x06
#define MPU6050_RA_YA_OFFS_H        0x08
#define MPU6050_RA_ZA_OFFS_H        0x0A

#define MPU6050_RA_XG_OFFS_USRH     0x13
#define MPU6050_RA_YG_OFFS_USRH     0x15
#define MPU6050_RA_ZG_OFFS_USRH     0x17

#define IMU_RATE 100

const int IMU_INTERVAL = 1000 / IMU_RATE;

extern void initIMU();

extern void sendIMU();

#endif
