My implementation of Bosh BMI160 Only I2C is tested so far.

Dependents:   test_BMI160 TFT_test_MAX32630FTHR

Embed: (wiki syntax)

« Back to documentation index

BMI160 Class Reference

BMI160 Class Reference

BMI160 Bosch Small, low power inertial measurement unit. More...

#include <BMI160.h>

Public Member Functions

 BMI160 (PinName sda, PinName scl, int addr)
 BMI160 I2C Interface.
 BMI160 (PinName sck, PinName miso, PinName mosi, PinName cs)
 BMI160 SPI Interface.
 ~BMI160 ()
 BMI160 destructor.
void setCMD (uint8_t cmd)
 setCMD set value to the CMD register (0x7E)
uint8_t getStatus (void)
 getStatus get value of the STATUS register (0x1B)
uint8_t getChipID (void)
 getChipID get value of the CHIP_ID register (0x10)
uint8_t getAccRange (void)
 get range of Acc (0x41)
int16_t getGyrRange (void)
 get range of Gyr (0x43)
int16_t getAccRawX (void)
 get Raw acc x value
int16_t getAccRawY (void)
 get Raw acc y value
int16_t getAccRawZ (void)
 get Raw acc z value
int16_t getGyrRawX (void)
 get Raw gyr x value
int16_t getGyrRawY (void)
 get Raw gyr y value
int16_t getGyrRawZ (void)
 get Raw gyr z value
void getAccRaw (int16_t *value)
 get Raw acc x,y,z values
void getGyrRaw (int16_t *value)
 get Raw gyr x,y,z values
float getAccX (void)
 get acc x value
float getAccY (void)
 get acc y value
float getAccZ (void)
 get acc z value
float getGyrX (void)
 get gyr x value
float getGyrY (void)
 get gyr y value
float getGyrZ (void)
 get gyr z value
void getAcc (float *value)
 get acc x, y, z values
void getGyr (float *value)
 get gyr x, y, z values

Detailed Description

BMI160 Bosch Small, low power inertial measurement unit.

Definition at line 7 of file BMI160.h.


Constructor & Destructor Documentation

BMI160 ( PinName  sda,
PinName  scl,
int  addr 
)

BMI160 I2C Interface.

Parameters:
sdaSDA pin
sclSCL pin
addraddress of the I2C peripheral

Definition at line 472 of file BMI160.cpp.

BMI160 ( PinName  sck,
PinName  miso,
PinName  mosi,
PinName  cs 
)

BMI160 SPI Interface.

Parameters:
sckSPI SCKL pin
misoSPI Master In Slave Out pin
mosiSPI Master Out Slave In pin
csSPI Chip Select pin

Definition at line 481 of file BMI160.cpp.

~BMI160 (  )

BMI160 destructor.

Definition at line 491 of file BMI160.cpp.


Member Function Documentation

void getAcc ( float *  value )

get acc x, y, z values

Parameters:
floatarray address to receive the values
Returns:
none
Note:
the value range is (-acc_range ~ +acc_range)

Definition at line 729 of file BMI160.cpp.

uint8_t getAccRange ( void   )

get range of Acc (0x41)

Parameters:
none
Returns:
accelerometer g-range
Note:
the value is 2, 4, or 8

Definition at line 584 of file BMI160.cpp.

void getAccRaw ( int16_t *  value )

get Raw acc x,y,z values

Parameters:
16bitarray address to receive the data
Returns:
none

Definition at line 663 of file BMI160.cpp.

int16_t getAccRawX ( void   )

get Raw acc x value

Parameters:
none
Returns:
16bit signed value

Definition at line 636 of file BMI160.cpp.

int16_t getAccRawY ( void   )

get Raw acc y value

Parameters:
none
Returns:
16bit signed value

Definition at line 645 of file BMI160.cpp.

int16_t getAccRawZ ( void   )

get Raw acc z value

Parameters:
none
Returns:
16bit signed value

Definition at line 654 of file BMI160.cpp.

float getAccX ( void   )

get acc x value

Parameters:
none
Returns:
value (-acc_range ~ +acc_range)

Definition at line 708 of file BMI160.cpp.

float getAccY ( void   )

get acc y value

Parameters:
none
Returns:
value (-acc_range ~ +acc_range)

Definition at line 715 of file BMI160.cpp.

float getAccZ ( void   )

get acc z value

Parameters:
none
Returns:
value (-acc_range ~ +acc_range)

Definition at line 722 of file BMI160.cpp.

uint8_t getChipID ( void   )

getChipID get value of the CHIP_ID register (0x10)

Parameters:
none
Returns:
the chip ID (supposed to be 0xD1)

Definition at line 577 of file BMI160.cpp.

void getGyr ( float *  value )

get gyr x, y, z values

Parameters:
floatarray address to receive the values
Returns:
none
Note:
the value range is (-gyr_range ~ +gyr_range)

Definition at line 759 of file BMI160.cpp.

int16_t getGyrRange ( void   )

get range of Gyr (0x43)

Parameters:
none
Returns:
Angular Rate Range and Resolution
Note:
the values are
2000 ( 16.4 LSB/deg/s <-> 61.0 mdeg/s/LSB)
1000 ( 32.8 LSB/deg/s <-> 30.5 mdeg/s/LSB)
500 ( 65.6 LSB/deg/s <-> 15.3 mdeg/s/LSB)
250 (131.2 LSB/deg/s <-> 7.6 mdeg/s/LSB)
125 (262.4 LSB/deg/s <-> 3.8 mdeg/s/LSB)

Definition at line 607 of file BMI160.cpp.

void getGyrRaw ( int16_t *  value )

get Raw gyr x,y,z values

Parameters:
16bitarray address to receive the data
Returns:
none

Definition at line 699 of file BMI160.cpp.

int16_t getGyrRawX ( void   )

get Raw gyr x value

Parameters:
none
Returns:
16bit signed value

Definition at line 672 of file BMI160.cpp.

int16_t getGyrRawY ( void   )

get Raw gyr y value

Parameters:
none
Returns:
16bit signed value

Definition at line 681 of file BMI160.cpp.

int16_t getGyrRawZ ( void   )

get Raw gyr z value

Parameters:
none
Returns:
16bit signed value

Definition at line 690 of file BMI160.cpp.

float getGyrX ( void   )

get gyr x value

Parameters:
none
Returns:
value (-gyr_range ~ +gyr_range)

Definition at line 738 of file BMI160.cpp.

float getGyrY ( void   )

get gyr y value

Parameters:
none
Returns:
value (-gyr_range ~ +gyr_range)

Definition at line 745 of file BMI160.cpp.

float getGyrZ ( void   )

get gyr z value

Parameters:
none
Returns:
value (-gyr_range ~ +gyr_range)

Definition at line 752 of file BMI160.cpp.

uint8_t getStatus ( void   )

getStatus get value of the STATUS register (0x1B)

Parameters:
none
Returns:
the value of the STATUS register

Definition at line 570 of file BMI160.cpp.

void setCMD ( uint8_t  cmd )

setCMD set value to the CMD register (0x7E)

Parameters:
cmduint8_t value to write
Returns:
none

Definition at line 562 of file BMI160.cpp.