fish

Dependencies:   mbed

Committer:
tzxl10000
Date:
Wed Jun 14 20:22:45 2017 +0000
Revision:
0:561f7672eaad
fish;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tzxl10000 0:561f7672eaad 1
tzxl10000 0:561f7672eaad 2 #ifndef __LSM303DLHC_H
tzxl10000 0:561f7672eaad 3 #define __LSM303DLHC_H
tzxl10000 0:561f7672eaad 4 #include "mbed.h"
tzxl10000 0:561f7672eaad 5
tzxl10000 0:561f7672eaad 6
tzxl10000 0:561f7672eaad 7
tzxl10000 0:561f7672eaad 8 class LSM303DLHC {
tzxl10000 0:561f7672eaad 9 public:
tzxl10000 0:561f7672eaad 10 /** Create a new interface for an LSM303DLHC
tzxl10000 0:561f7672eaad 11 *
tzxl10000 0:561f7672eaad 12 * @param sda is the pin for the I2C SDA line
tzxl10000 0:561f7672eaad 13 * @param scl is the pin for the I2C SCL line
tzxl10000 0:561f7672eaad 14 */
tzxl10000 0:561f7672eaad 15 LSM303DLHC(PinName sda, PinName scl);
tzxl10000 0:561f7672eaad 16
tzxl10000 0:561f7672eaad 17
tzxl10000 0:561f7672eaad 18 /** read the raw accelerometer and compass values
tzxl10000 0:561f7672eaad 19 *
tzxl10000 0:561f7672eaad 20 * @param ax,ay,az is the accelerometer 3d vector, written by the function
tzxl10000 0:561f7672eaad 21 * @param mx,my,mz is the magnetometer 3d vector, written by the function
tzxl10000 0:561f7672eaad 22 */
tzxl10000 0:561f7672eaad 23 bool read(float *ax, float *ay, float *az, float *mx, float *my, float *mz);
tzxl10000 0:561f7672eaad 24
tzxl10000 0:561f7672eaad 25
tzxl10000 0:561f7672eaad 26 private:
tzxl10000 0:561f7672eaad 27 I2C _LSM303;
tzxl10000 0:561f7672eaad 28
tzxl10000 0:561f7672eaad 29
tzxl10000 0:561f7672eaad 30 float ax, ay, az;
tzxl10000 0:561f7672eaad 31 float mx, my, mz;
tzxl10000 0:561f7672eaad 32
tzxl10000 0:561f7672eaad 33 bool write_reg(int addr_i2c,int addr_reg, char v);
tzxl10000 0:561f7672eaad 34 bool read_reg(int addr_i2c,int addr_reg, char *v);
tzxl10000 0:561f7672eaad 35 bool recv(char sad, char sub, char *buf, int length);
tzxl10000 0:561f7672eaad 36 };
tzxl10000 0:561f7672eaad 37
tzxl10000 0:561f7672eaad 38 #endif