read acceleration and angler ratio from mpu6050 and estimate pitch and roll angle

Dependencies:   mbed

Committer:
ojan
Date:
Wed May 13 04:02:27 2015 +0000
Revision:
3:40559ebef0f1
estimate gravity vector & geomagnetic vector

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ojan 3:40559ebef0f1 1 #pragma once
ojan 3:40559ebef0f1 2
ojan 3:40559ebef0f1 3 const static int hmc_addr = 0x3c;
ojan 3:40559ebef0f1 4
ojan 3:40559ebef0f1 5 typedef union {
ojan 3:40559ebef0f1 6 char reg[6];
ojan 3:40559ebef0f1 7 struct {
ojan 3:40559ebef0f1 8 uint8_t mag_x_L;
ojan 3:40559ebef0f1 9 uint8_t mag_x_H;
ojan 3:40559ebef0f1 10 uint8_t mag_y_L;
ojan 3:40559ebef0f1 11 uint8_t mag_y_H;
ojan 3:40559ebef0f1 12 uint8_t mag_z_L;
ojan 3:40559ebef0f1 13 uint8_t mag_z_H;
ojan 3:40559ebef0f1 14 } byte;
ojan 3:40559ebef0f1 15
ojan 3:40559ebef0f1 16 int16_t value[3];
ojan 3:40559ebef0f1 17
ojan 3:40559ebef0f1 18 } HMC_DATA;
ojan 3:40559ebef0f1 19
ojan 3:40559ebef0f1 20 class HMC5883L {
ojan 3:40559ebef0f1 21 public:
ojan 3:40559ebef0f1 22 HMC5883L(I2C* i2c);
ojan 3:40559ebef0f1 23 ~HMC5883L();
ojan 3:40559ebef0f1 24
ojan 3:40559ebef0f1 25 int init();
ojan 3:40559ebef0f1 26 int read();
ojan 3:40559ebef0f1 27
ojan 3:40559ebef0f1 28 HMC_DATA data;
ojan 3:40559ebef0f1 29
ojan 3:40559ebef0f1 30 private:
ojan 3:40559ebef0f1 31 I2C* i2c;
ojan 3:40559ebef0f1 32 };