i2c trial - does'nt work
Dependencies: ACD_ePaper aconno_I2C aconno_bsp mbed
Fork of acd52832_LSM9DS1 by
Diff: LSM9DS1/LSM9DS1.h
- Revision:
- 1:e97c56fb9629
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LSM9DS1/LSM9DS1.h Wed Feb 14 21:16:43 2018 +0000 @@ -0,0 +1,85 @@ + + +#ifndef LSM9DS1_H +#define LSM9DS1_H + +#include "mbed.h" +#include "aconno_i2c.h" +#include "LSM9DS1_regs.h" +#include "LSM9DS1_defVals.h" + + +//TO DO: once i2c sucessfully works come back to this for fine tuning data + + + +enum Mode{ + HIGH_RES = 0, + NORMAL, + LOW_POWER, +}; + +enum Axis{ + X_axis = 0x01, + Y_axis = 0x02, + Z_axis = 0x04, +}; + +enum Odr{ + PowerDown = 0x00, + ODR_1Hz = 0x01, + ODR_10Hz = 0x02, + ODR_25Hz = 0x03, + ODR_50Hz = 0x04, + ODR_100Hz = 0x05, + ODR_200Hz = 0x06, + ODR_400Hz = 0x07, + ODR_1620Hz = 0x08, + ODR_Max = 0x09, // HighRes/Normal -> 1.344kHz, LowPower -> 5.376kHz +}; + +enum Scale{ + _2g = 0x00, + _4g = 0x01, + _8g = 0x02, + _16g = 0x03, +}; + + +class LSM9DS1{ + public: + LSM9DS1(I2C *i2c_, char address); + uint8_t whoIAm(); + uint8_t setMode(Mode mode); + uint8_t enableAxes(Axis axis); + uint8_t disableAxes(Axis axis); + int16_t readXAxis(); + int16_t readYAxis(); + int16_t readZAxis(); + uint8_t setODR(Odr odr); + uint8_t setScale(Scale scale); + uint8_t int1Setup(uint8_t setup); + uint8_t int1Latch(uint8_t enable); + uint8_t int1Duration(uint8_t duration); + uint8_t int1Threshold(uint8_t threshold); + uint8_t int1Config(uint8_t config); + void clearIntFlag(); + +/* + public: + LSM9DS1(I2C i2c); + void startMag(void); + void readMag(int16_t *results); + void startAcc(void); + void readAcc(int16_t *results); + void startGyro(void); + void readGyro(int16_t *results); + */ + private: + aconno_i2c i2c; + +}; + + +#endif + \ No newline at end of file