pyupm_bmi160 module¶
-
class
pyupm_bmi160.
BMI160
(bus=0, address=105, csPin=-1, enableMag=True)[source]¶ Bases:
object
UPM API for the BMI160 3-axis Accelerometer, Gyroscope and Magnetometer.
ID: bmi160
Name: Low-power IMU (triaxial Accelerometer and Triaxial Gyroscope) and Magnetometer
Category: accelerometer compass
Manufacturer: bosch mouser
Connection: i2c
Link:https://www.bosch-sensortec.com/bst/products/all_products/bmi160 The Bosch BMI160 is a 3-axis Accelerometer and Gyroscope. Additionally it supports an external Magnetometer, accessed through the BMI160’s register interface. This driver was developed with a BMI160 “Shuttle” board, which included a BMM150 Magnetometer.
The device is driven by either 1.8v or 3.3vdc. This driver incorporates the Bosch BMI160 driver code athttps://github.com/BoschSensortec/BMI160_driver
The Bosch driver code does not provide a mechanism for passing user data around (like the device context). For this reason, only one instance of this driver can be used in a given process, due to the use of static data in the driver.
While not all of the functionality of this device is supported initially, the inclusion of the Bosch driver in the source code makes it possible to support whatever features are required that the driver can support.
C++ includes: bmi160.hpp
-
enableMagnetometer
(enable)[source]¶ void enableMagnetometer(bool enable)
Enable or disable the Magnetometer. By default, the magnetometer is enabled.
enable: true to enable the magnetometer, false to disable.
-
getAccelerometer
(*args)[source]¶ void getAccelerometer(float *x, float *y, float *z)
Get the Accelerometer values. The values returned are in gravities. update() must have been called prior to calling this method.
x: A pointer into which the X value will be returned
y: A pointer into which the Y value will be returned
z: A pointer into which the Z value will be returned
-
getGyroscope
(*args)[source]¶ void getGyroscope(float *x, float *y, float *z)
Get the Gyroscope values. The values returned are in degrees per second. update() must have been called prior to calling this method.
x: A pointer into which the X value will be returned
y: A pointer into which the Y value will be returned
z: A pointer into which the Z value will be returned
-
getMagnetometer
(*args)[source]¶ void getMagnetometer(float *x, float *y, float *z)
Get the Magnetometer values. The values returned are in micro Teslas. update() must have been called prior to calling this method.
x: A pointer into which the X value will be returned
y: A pointer into which the Y value will be returned
z: A pointer into which the Z value will be returned
-
getSensorTime
()[source]¶ unsigned int getSensorTime()
Return the sensor time. This is a 24bit value that increments every 39us. It will wrap around once the 24b resolution is exceeded.
The current sensor time.
-
setAccelerometerScale
(scale)[source]¶ void setAccelerometerScale(BMI160_ACC_RANGE_T scale)
set the scaling mode of the accelerometer
scale: one of the ACCEL_RANGE_T values
-