asdf

Fork of LSM303DLHC by brian claus

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LSM303DLHC.h Source File

LSM303DLHC.h

00001 
00002 #ifndef __LSM303DLHC_H
00003 #define __LSM303DLHC_H
00004 #include "mbed.h"
00005 
00006 class LSM303DLHC {
00007     public:
00008         /** Create a new interface for an LSM303DLHC
00009          *
00010          * @param sda is the pin for the I2C SDA line
00011          * @param scl is the pin for the I2C SCL line
00012          */
00013         LSM303DLHC(PinName sda, PinName scl);
00014 
00015   
00016         /** read the raw accelerometer and compass values
00017          *
00018          * @param ax,ay,az is the accelerometer 3d vector, written by the function
00019          * @param mx,my,mz is the magnetometer 3d vector, written by the function
00020          */
00021          bool read(float *ax, float *ay, float *az, float *mx, float *my, float *mz);
00022          bool read(float *ax, float *ay, float *az);
00023 
00024     private:
00025         I2C _LSM303;
00026          
00027         float ax, ay, az;
00028         float mx, my, mz;         
00029          
00030         bool write_reg(int addr_i2c,int addr_reg, char v);
00031         bool read_reg(int addr_i2c,int addr_reg, char *v);
00032         bool recv(char sad, char sub, char *buf, int length);
00033 };
00034 
00035 #endif