#ifndef MPU6050H
#define MPU6050H

template <typename T>
struct xyzvector
{
	T x;
	T y;
	T z;
};

class _mpu
{
	xyzvector<int> gyro;
	xyzvector<long> acc_raw;
	xyzvector<long> acc;
	long acc_total_vector;
	
	int temperature;
	xyzvector<long> gyro_cal;

	long loop_timer;
	float angle_pitch;
	float angle_roll;
	bool set_gyro_angles;
	float angle_roll_acc;
	float angle_pitch_acc;
	float yaw_rate;
	
	const int calibrationPasses = 500;

	void readRaw( void );

public:
	_mpu(){}

	void processData( void );

	void run( void );

	void begin( void );

	float getangle_pitch( void )
	{
		return angle_pitch;
	}

	float getyaw_rate( void )
	{
		return yaw_rate;
	}

	void print( void );

};

#endif //MPU6050H