Device driver for the Bosch BMX055 9-axis sensor. More...

Detailed Description

Device driver for the Bosch BMX055 9-axis sensor.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Files

file  bmx055_internal.h
 Definitions for the bmx055 device.
 
file  bmx055_params.h
 Default configuration for bmx055 devices.
 
file  bmx055.h
 Device driver interface for the Bosch BMX055 9-axis sensor.
 

Data Structures

struct  bmx055_params_t
 Data structure holding the device parameters needed for initialization. More...
 
struct  bmx055_t
 Device descriptor for BMX055 sensors. More...
 

Enumerations

enum  {
  BMX055_OK = 0, BMX055_NOBUS = -1, BMX055_NODEV = -2, BMX055_NOREAD = -3,
  BMX055_NOWRITE = -4, BMX055_NOTREADY = -5
}
 Status and error return codes. More...
 
enum  bmx055_mag_rate_t {
  BMX055_MAG_DRATE_DEFAULT = 0x0, BMX055_MAG_DRATE_02HZ = 0x1, BMX055_MAG_DRATE_06HZ = 0x2, BMX055_MAG_DRATE_08HZ = 0x3,
  BMX055_MAG_DRATE_15HZ = 0x4, BMX055_MAG_DRATE_20HZ = 0x5, BMX055_MAG_DRATE_25HZ = 0x6, BMX055_MAG_DRATE_30HZ = 0x7
}
 Datarate for Magnetometer. More...
 
enum  bmx055_acc_range_t { BMX055_ACC_RANGE_2G = 0x0, BMX055_ACC_RANGE_4G = 0x1, BMX055_ACC_RANGE_8G = 0x2, BMX055_ACC_RANGE_16G = 0x3 }
 Range for Accelerometer. More...
 
enum  bmx055_gyro_scale_t {
  BMX055_GYRO_SCALE_2000DPS = 0x0, BMX055_GYRO_SCALE_1000DPS = 0x1, BMX055_GYRO_SCALE_0500DPS = 0x2, BMX055_GYRO_SCALE_0250DPS = 0x3,
  BMX055_GYRO_SCALE_0125DPS = 0x4
}
 Measurement scale for the gyro. More...
 

Functions

int bmx055_init (bmx055_t *dev, const bmx055_params_t *params)
 Initialize modules magnetometer, accelerometer, gyroscope. More...
 
int bmx055_mag_read (const bmx055_t *dev, int16_t *data)
 Read magnetic field value in Gauss per second from magnetometer. More...
 
int bmx055_acc_read (const bmx055_t *dev, int16_t *data)
 Read acceleration value in g from accelerometer. More...
 
int bmx055_gyro_read (const bmx055_t *dev, int16_t *data)
 Read angular speed value in degree per second from gyroscope. More...
 

The sensors default I2C addresses

#define BMX055_MAG_ADDR_DEFAULT   (0x10U)
 
#define BMX055_ACC_ADDR_DEFAULT   (0x18U)
 
#define BMX055_GYRO_ADDR_DEFAULT   (0x68U)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Status and error return codes.

Enumerator
BMX055_OK 

exit without error

BMX055_NOBUS 

cannot connect to module on i2c bus

BMX055_NODEV 

cannot read any data from module

BMX055_NOREAD 

cannot read data from module

BMX055_NOWRITE 

cannot write data to module

BMX055_NOTREADY 

no new data ready for reading

Definition at line 50 of file bmx055.h.

◆ bmx055_acc_range_t

Range for Accelerometer.

Enumerator
BMX055_ACC_RANGE_2G 

range: 2g

BMX055_ACC_RANGE_4G 

range: 4g

BMX055_ACC_RANGE_8G 

range: 8g

BMX055_ACC_RANGE_16G 

range: 16g

Definition at line 76 of file bmx055.h.

◆ bmx055_gyro_scale_t

Measurement scale for the gyro.

Enumerator
BMX055_GYRO_SCALE_2000DPS 

scale: 2000 degree per second

BMX055_GYRO_SCALE_1000DPS 

scale: 1000 degree per second

BMX055_GYRO_SCALE_0500DPS 

scale: 500 degree per second

BMX055_GYRO_SCALE_0250DPS 

scale: 250 degree per second

BMX055_GYRO_SCALE_0125DPS 

scale: 125 degree per second

Definition at line 86 of file bmx055.h.

◆ bmx055_mag_rate_t

Datarate for Magnetometer.

Enumerator
BMX055_MAG_DRATE_DEFAULT 

output data rate: 10 Hz

BMX055_MAG_DRATE_02HZ 

output data rate: 2 Hz

BMX055_MAG_DRATE_06HZ 

output data rate: 6 Hz

BMX055_MAG_DRATE_08HZ 

output data rate: 8 Hz

BMX055_MAG_DRATE_15HZ 

output data rate: 15 Hz

BMX055_MAG_DRATE_20HZ 

output data rate: 20 Hz

BMX055_MAG_DRATE_25HZ 

output data rate: 25 Hz

BMX055_MAG_DRATE_30HZ 

output data rate: 30 Hz

Definition at line 62 of file bmx055.h.

Function Documentation

◆ bmx055_acc_read()

int bmx055_acc_read ( const bmx055_t dev,
int16_t *  data 
)

Read acceleration value in g from accelerometer.

Parameters
[in]devdevice descriptor of accelerometer
[out]dataresult vector in g per axis
Returns
BMX055_OK on success
BMX055_NOREAD if reading acc data is not possible
BMX055_NOTRDY if no new data is available

◆ bmx055_gyro_read()

int bmx055_gyro_read ( const bmx055_t dev,
int16_t *  data 
)

Read angular speed value in degree per second from gyroscope.

Note
The data of steady axis deviate from the expected values while moving the sensor in one of the other axis. Hence reading data for all axis at once may not always give the expected results.
Parameters
[in]devdevice descriptor of gyroscope
[out]dataresult vector in dps per axis
Returns
BMX055_OK on success
BMX055_NOREAD if reading gyro data is not possible

◆ bmx055_init()

int bmx055_init ( bmx055_t dev,
const bmx055_params_t params 
)

Initialize modules magnetometer, accelerometer, gyroscope.

Parameters
[out]devdevice descriptor of sensor to initialize
[in]paramsdefault parameter values
Returns
BMX055_OK on success
BMX055_NOBUS if i2C connection can not be establish
BMX055_NODEV if the register of a module can not be read
BMX055_NOWRITE if a register can not be written

◆ bmx055_mag_read()

int bmx055_mag_read ( const bmx055_t dev,
int16_t *  data 
)

Read magnetic field value in Gauss per second from magnetometer.

Parameters
[in]devdevice descriptor of magnetometer
[out]dataresult vector in Gs per axis
Returns
BMX055_OK on success
BMX055_NOREAD if reading mag data is not possible
BMX055_NOTRDY if no new data is available