My implementation of Bosh BMI160 Only I2C is tested so far.
Dependents: test_BMI160 TFT_test_MAX32630FTHR
Diff: BMI160.h
- Revision:
- 3:9d3079170b35
- Parent:
- 2:4cc456503e9f
- Child:
- 4:93f16677f730
--- a/BMI160.h Mon Sep 11 23:53:22 2017 +0000 +++ b/BMI160.h Tue Sep 12 00:34:16 2017 +0000 @@ -29,27 +29,56 @@ * BMI160 destructor */ ~BMI160() ; - + +/** + * setCMD set value to the CMD register (0x7E) + * + * @param cmd uint8_t value to write + * @returns none + */ void setCMD(uint8_t cmd) ; + +/** + * getStatus get value of the STATUS register (0x1B) + * @param none + * @returns the value of the STATUS register + */ uint8_t getStatus(void) ; + +/** + * getChipID get value of the CHIP_ID register (0x10) + * @param none + * @returns the chip ID (supposed to be 0xD1) + */ uint8_t getChipID(void) ; uint8_t getAccRange(void) ; int16_t getGyrRange(void) ; - int16_t getAccX(void) ; - int16_t getAccY(void) ; - int16_t getAccZ(void) ; - int16_t getGyrX(void) ; - int16_t getGyrY(void) ; - int16_t getGyrZ(void) ; - void getAcc(int16_t *value) ; - void getGyr(int16_t *value) ; + + int16_t getAccRawX(void) ; + int16_t getAccRawY(void) ; + int16_t getAccRawZ(void) ; + int16_t getGyrRawX(void) ; + int16_t getGyrRawY(void) ; + int16_t getGyrRawZ(void) ; + void getAccRaw(int16_t *value) ; + void getGyrRaw(int16_t *value) ; - + float getAccX(void) ; + float getAccY(void) ; + float getAccZ(void) ; + float getGyrX(void) ; + float getGyrY(void) ; + float getGyrZ(void) ; + void getAcc(float *value) ; + void getGyr(float *value) ; + private: SPI *m_spi ; I2C *m_i2c ; DigitalOut *m_cs ; int m_addr ; + int acc_range ; + int gyr_range ; void init(void) ; void i2c_readRegs(int addr, uint8_t *data, int len) ;