work nice now
Fork of LSM303DLHC by
LSM303DLHC.h@4:612f7d5a822d, 2013-02-21 (annotated)
- Committer:
- bclaus
- Date:
- Thu Feb 21 00:20:17 2013 +0000
- Revision:
- 4:612f7d5a822d
- Parent:
- 3:4d9465e7e10e
- Child:
- 7:ddd9717cdb71
added #ifndef
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bclaus | 4:612f7d5a822d | 1 | |
bclaus | 4:612f7d5a822d | 2 | #ifndef __LSM303DLHC_H |
bclaus | 4:612f7d5a822d | 3 | #define __LSM303DLHC_H |
bclaus | 3:4d9465e7e10e | 4 | #include "mbed.h" |
bclaus | 3:4d9465e7e10e | 5 | |
bclaus | 3:4d9465e7e10e | 6 | |
bclaus | 3:4d9465e7e10e | 7 | |
bclaus | 3:4d9465e7e10e | 8 | class LSM303DLHC { |
bclaus | 3:4d9465e7e10e | 9 | public: |
bclaus | 3:4d9465e7e10e | 10 | /** Create a new interface for an LSM303DLHC |
bclaus | 3:4d9465e7e10e | 11 | * |
bclaus | 3:4d9465e7e10e | 12 | * @param sda is the pin for the I2C SDA line |
bclaus | 3:4d9465e7e10e | 13 | * @param scl is the pin for the I2C SCL line |
bclaus | 3:4d9465e7e10e | 14 | */ |
bclaus | 3:4d9465e7e10e | 15 | LSM303DLHC(PinName sda, PinName scl); |
bclaus | 3:4d9465e7e10e | 16 | |
bclaus | 3:4d9465e7e10e | 17 | |
bclaus | 3:4d9465e7e10e | 18 | /** read the raw accelerometer and compass values |
bclaus | 3:4d9465e7e10e | 19 | * |
bclaus | 3:4d9465e7e10e | 20 | * @param ax,ay,az is the accelerometer 3d vector, written by the function |
bclaus | 3:4d9465e7e10e | 21 | * @param mx,my,mz is the magnetometer 3d vector, written by the function |
bclaus | 3:4d9465e7e10e | 22 | */ |
bclaus | 3:4d9465e7e10e | 23 | bool read(float *ax, float *ay, float *az, float *mx, float *my, float *mz); |
bclaus | 3:4d9465e7e10e | 24 | |
bclaus | 3:4d9465e7e10e | 25 | |
bclaus | 3:4d9465e7e10e | 26 | private: |
bclaus | 3:4d9465e7e10e | 27 | I2C _LSM303; |
bclaus | 3:4d9465e7e10e | 28 | |
bclaus | 3:4d9465e7e10e | 29 | |
bclaus | 3:4d9465e7e10e | 30 | float ax, ay, az; |
bclaus | 3:4d9465e7e10e | 31 | float mx, my, mz; |
bclaus | 3:4d9465e7e10e | 32 | |
bclaus | 3:4d9465e7e10e | 33 | bool write_reg(int addr_i2c,int addr_reg, char v); |
bclaus | 3:4d9465e7e10e | 34 | bool read_reg(int addr_i2c,int addr_reg, char *v); |
bclaus | 3:4d9465e7e10e | 35 | bool recv(char sad, char sub, char *buf, int length); |
bclaus | 3:4d9465e7e10e | 36 | }; |
bclaus | 4:612f7d5a822d | 37 | |
bclaus | 4:612f7d5a822d | 38 | #endif |