UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

BMX055 Class

Module: bmx055

The BMX055 is an integrated 9-axis sensor for the detection of movements and rotations and magnetic heading. It comprises the full functionality of a triaxial, low-g acceleration sensor, a triaxial angular rate sensor and a triaxial geomagnetic sensor.
The BMX055 senses orientation, tilt, motion, acceleration, rotation, shock, vibration and heading in cell phones, handhelds, computer peripherals, man-machine interfaces, virtual reality features and game controllers.
The BMX055 is essentially 3 separate devices in one: the BMA250E Accelerometer, the BMG160 Gyroscope, and the BMM150 Magnetometer. They are completely independent of each other.
This driver provides a very simple interface to these 3 devices. If finer control is desired, you should just use the separate BMA250E , BMG160 , and BMM150 device classes directly. This driver simply initializes all three devices, and provides a mechanism to read accelerometer, gyroscope and magnetometer data from them.

Methods

BMX055

(
  • accelBus
  • accelAddr
  • accelCS
  • gyroBus
  • gyroAddr
  • gyroCS
  • magBus
  • magAddr
  • magCS
)
Number

BMX055 constructor.
This device can support both I2C and SPI. For SPI, set the addr to -1, and specify a positive integer representing the Chip Select (CS) pin for the cs argument. If you are using a hardware CS pin (like edison with arduino breakout), then you can connect the proper pin to the hardware CS pin on your MCU and supply -1 for cs. The default operating mode is I2C.

Parameters:

  • accelBus Number

    I2C or SPI bus to use. -1 to skip initializing this device.

  • accelAddr Number

    The address for this device. -1 for SPI.

  • accelCS Number

    The gpio pin to use for the SPI Chip Select. -1 for I2C or for SPI with a hardware controlled pin.

  • gyroBus Number

    I2C or SPI bus to use. -1 to skip initializing this device.

  • gyroAddr Number

    The address for this device. -1 for SPI.

  • gyroCS Number

    The gpio pin to use for the SPI Chip Select. -1 for I2C or for SPI with a hardware controlled pin.

  • magBus Number

    I2C or SPI bus to use. -1 to skip initializing this device.

  • magAddr Number

    The address for this device. -1 for SPI.

  • magCS Number

    The gpio pin to use for the SPI Chip Select. -1 for I2C or for SPI with a hardware controlled pin.

Returns:

Number:

update

()

Update the internal stored values from sensor data.

initAccelerometer

(
  • pwr
  • range
  • bw
)

Initialize the accelerometer and start operation. This function is called from the constructor so will not typically need to be called by a user unless the device is reset or you want to change these values.

Parameters:

  • pwr BMA250E_POWER_MODE_T

    One of the BMA250E_POWER_MODE_T values. The default is BMA250E_POWER_MODE_NORMAL.

  • range BMA250E_RANGE_T

    One of the BMA250E_RANGE_T values. The default is BMA250E_RANGE_2G.

  • bw BMA250E_BW_T

    One of the filtering BMA250E_BW_T values. The default is BMA250E_BW_250.

initGyroscope

(
  • pwr
  • range
  • bw
)

Initialize the gyroscope and start operation. This function is called from the constructor so will not typically need to be called by a user unless the device is reset or you want to change these values.

Parameters:

  • pwr BMG160_POWER_MODE_T

    One of the BMG160_POWER_MODE_T values. The default is BMG160_POWER_MODE_NORMAL.

  • range BMG160_RANGE_T

    One of the BMG160_RANGE_T values. The default is BMG160_RANGE_250.

  • bw BMG160_BW_T

    One of the filtering BMG160_BW_T values. The default is BMG160_BW_400_47.

initMagnetometer

(
  • usage
)

Initialize the magnetometer and start operation. This function is called from the constructor so will not typically need to be called by a user unless the device is reset or you want to change these values. This method will call BMM150::setPresetMode() with the passed parameter.

Parameters:

  • usage BMM150_USAGE_PRESETS_T

    One of the BMM150_USAGE_PRESETS_T values. The default is BMM150_USAGE_HIGH_ACCURACY.

getAccelerometer

(
  • x
  • y
  • z
)

Return accelerometer data in gravities. update() must have been called prior to calling this method.

Parameters:

  • x Float *

    Pointer to a floating point value that will have the current x component placed into it.

  • y Float *

    Pointer to a floating point value that will have the current y component placed into it.

  • z Float *

    Pointer to a floating point value that will have the current z component placed into it.

getAccelerometer

() Std::vector float

Return accelerometer data in gravities in the form of a floating point vector. update() must have been called prior to calling this method.

Returns:

Std::vector float :

A floating point vector containing x, y, and z in that order.

getGyroscope

(
  • x
  • y
  • z
)

Return gyroscope data in degrees per second. update() must have been called prior to calling this method.

Parameters:

  • x Float *

    Pointer to a floating point value that will have the current x component placed into it.

  • y Float *

    Pointer to a floating point value that will have the current y component placed into it.

  • z Float *

    Pointer to a floating point value that will have the current z component placed into it.

getGyroscope

() Std::vector float

Return gyroscope data in degrees per second in the form of a floating point vector. update() must have been called prior to calling this method.

Returns:

Std::vector float :

A floating point vector containing x, y, and z in that order.

getMagnetometer

(
  • x
  • y
  • z
)

Return magnetometer data in micro-Teslas (uT). update() must have been called prior to calling this method.

Parameters:

  • x Float *

    Pointer to a floating point value that will have the current x component placed into it.

  • y Float *

    Pointer to a floating point value that will have the current y component placed into it.

  • z Float *

    Pointer to a floating point value that will have the current z component placed into it.

getMagnetometer

() Std::vector float

Return magnetometer data in micro-Teslas (uT) in the form of a floating point vector. update() must have been called prior to calling this method.

Returns:

Std::vector float :

A floating point vector containing x, y, and z in that order.