compatibility changes
Fork of LSM303DLHC by
LSM303DLHC.h@5:0136aae4f1ff, 2014-09-26 (annotated)
- Committer:
- jn80842
- Date:
- Fri Sep 26 23:05:10 2014 +0000
- Revision:
- 5:0136aae4f1ff
- Parent:
- 4:612f7d5a822d
compatibility
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 |