This lib was build for reading the 3 IMU unit sensors of Altimu10v4 board (https://www.pololu.com/product/2470).

Committer:
renanbmx123
Date:
Tue Oct 16 00:16:05 2018 +0000
Revision:
2:3e874281c0f0
Parent:
1:8cc36ccb8d58
Remove some unnecessary data !!!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
renanbmx123 0:08c9e51e6fd6 1 #ifndef __ALTIMU_LIB
renanbmx123 0:08c9e51e6fd6 2 #define __ALTIMU_LIB
renanbmx123 0:08c9e51e6fd6 3 #include "mbed.h"
renanbmx123 0:08c9e51e6fd6 4
renanbmx123 0:08c9e51e6fd6 5 #define LSM303_ADDR 0x3A
renanbmx123 0:08c9e51e6fd6 6 #define L3GD20_ADDR 0xD6
renanbmx123 1:8cc36ccb8d58 7 #define LPS25H_ADDR (0x5d << 1)
renanbmx123 0:08c9e51e6fd6 8
renanbmx123 0:08c9e51e6fd6 9 class Altimu
renanbmx123 0:08c9e51e6fd6 10 {
renanbmx123 0:08c9e51e6fd6 11 public:
renanbmx123 0:08c9e51e6fd6 12 /** Create a new interface for a Altimu10V4
renanbmx123 0:08c9e51e6fd6 13 *
renanbmx123 0:08c9e51e6fd6 14 * @param sda is the pin for the I2C SDA line
renanbmx123 0:08c9e51e6fd6 15 * @param scl is the pin for the I2C SCL line
renanbmx123 0:08c9e51e6fd6 16 */
renanbmx123 0:08c9e51e6fd6 17 Altimu(PinName sda, PinName scl);
renanbmx123 0:08c9e51e6fd6 18
renanbmx123 0:08c9e51e6fd6 19 /** Initialize Altimu10V4
renanbmx123 0:08c9e51e6fd6 20 *
renanbmx123 0:08c9e51e6fd6 21 * @conf configure the i2c frequency.``
renanbmx123 0:08c9e51e6fd6 22 * @conf configure fifo filter.
renanbmx123 0:08c9e51e6fd6 23 * @conf set sample mode.
renanbmx123 0:08c9e51e6fd6 24 */
renanbmx123 0:08c9e51e6fd6 25 void Init(void);
renanbmx123 0:08c9e51e6fd6 26
renanbmx123 0:08c9e51e6fd6 27 // The section below, is reserved all three IMU function's.
renanbmx123 0:08c9e51e6fd6 28
renanbmx123 0:08c9e51e6fd6 29 /** read the raw accelerometer and compass values
renanbmx123 0:08c9e51e6fd6 30 *
renanbmx123 0:08c9e51e6fd6 31 * @param ax,ay,az is the accelerometer 3d vector, written by the function
renanbmx123 0:08c9e51e6fd6 32 * @param mx,my,mz is the magnetometer 3d vector, written by the function
renanbmx123 0:08c9e51e6fd6 33 */
renanbmx123 1:8cc36ccb8d58 34 void read_LSM303D(float *ax, float *ay, float *az, float *mx, float *my, float *mz);
renanbmx123 1:8cc36ccb8d58 35 void read_L3GD20(float *gx, float *gy, float *gz);
renanbmx123 0:08c9e51e6fd6 36 void read_LPS25H(float *press, float *alt);
renanbmx123 0:08c9e51e6fd6 37
renanbmx123 0:08c9e51e6fd6 38 private:
renanbmx123 0:08c9e51e6fd6 39 I2C _ALTIMU; // I2C object
renanbmx123 0:08c9e51e6fd6 40
renanbmx123 0:08c9e51e6fd6 41 bool write_reg(int addr_i2c,int addr_reg, char v); // I2C Write data register.
renanbmx123 0:08c9e51e6fd6 42 bool read_reg(int addr_i2c,int addr_reg, char *v); // I2C Read data register.
renanbmx123 0:08c9e51e6fd6 43 bool recv(char sad, char sub, char *buf, int length); // I2C Read n data
renanbmx123 0:08c9e51e6fd6 44 };
renanbmx123 0:08c9e51e6fd6 45 #endif