bmx055: remove bmm150, use new bmm150 library

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson
2017-03-29 14:09:35 -06:00
parent aeaf84ccc6
commit c014ffddcd
15 changed files with 398 additions and 1718 deletions

View File

@ -76,176 +76,176 @@ namespace upm {
* @snippet bmx055.cxx Interesting
*/
class BMX055 {
public:
/**
* 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.
*
* @param accelBus I2C or SPI bus to use. -1 to skip initializing
* this device.
* @param accelAddr The address for this device. -1 for SPI.
* @param accelCS The gpio pin to use for the SPI Chip Select. -1 for
* I2C or for SPI with a hardware controlled pin.
* @param gyroBus I2C or SPI bus to use. -1 to skip initializing
* this device.
* @param gyroAddr The address for this device. -1 for SPI.
* @param gyroCS The gpio pin to use for the SPI Chip Select. -1 for
* I2C or for SPI with a hardware controlled pin.
* @param magBus I2C or SPI bus to use. -1 to skip initializing
* this device.
* @param magAddr The address for this device. -1 for SPI.
* @param magCS The gpio pin to use for the SPI Chip Select. -1 for
* I2C or for SPI with a hardware controlled pin.
*/
BMX055(int accelBus=BMA250E_DEFAULT_I2C_BUS,
int accelAddr=BMA250E_DEFAULT_ADDR,
int accelCS=-1,
int gyroBus=BMG160_DEFAULT_I2C_BUS,
int gyroAddr=BMG160_DEFAULT_ADDR,
int gyroCS=-1,
int magBus=BMM150_I2C_BUS,
int magAddr=BMX055_DEFAULT_MAG_I2C_ADDR,
int magCS=-1);
class BMX055 {
public:
/**
* 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.
*
* @param accelBus I2C or SPI bus to use. -1 to skip initializing
* this device.
* @param accelAddr The address for this device. -1 for SPI.
* @param accelCS The gpio pin to use for the SPI Chip Select. -1 for
* I2C or for SPI with a hardware controlled pin.
* @param gyroBus I2C or SPI bus to use. -1 to skip initializing
* this device.
* @param gyroAddr The address for this device. -1 for SPI.
* @param gyroCS The gpio pin to use for the SPI Chip Select. -1 for
* I2C or for SPI with a hardware controlled pin.
* @param magBus I2C or SPI bus to use. -1 to skip initializing
* this device.
* @param magAddr The address for this device. -1 for SPI.
* @param magCS The gpio pin to use for the SPI Chip Select. -1 for
* I2C or for SPI with a hardware controlled pin.
*/
BMX055(int accelBus=BMA250E_DEFAULT_I2C_BUS,
int accelAddr=BMA250E_DEFAULT_ADDR,
int accelCS=-1,
int gyroBus=BMG160_DEFAULT_I2C_BUS,
int gyroAddr=BMG160_DEFAULT_ADDR,
int gyroCS=-1,
int magBus=BMM150_DEFAULT_I2C_BUS,
int magAddr=BMX055_DEFAULT_MAG_I2C_ADDR,
int magCS=-1);
/**
* BMX055 Destructor.
*/
~BMX055();
/**
* BMX055 Destructor.
*/
~BMX055();
/**
* Update the internal stored values from sensor data.
*/
void update();
/**
* Update the internal stored values from sensor data.
*/
void update();
/**
* 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.
*
* @param pwr One of the BMA250E_POWER_MODE_T values. The default is
* BMA250E_POWER_MODE_NORMAL.
* @param range One of the BMA250E_RANGE_T values. The default is
* BMA250E_RANGE_2G.
* @param bw One of the filtering BMA250E_BW_T values. The default is
* BMA250E_BW_250.
*/
void initAccelerometer(BMA250E_POWER_MODE_T pwr=BMA250E_POWER_MODE_NORMAL,
BMA250E_RANGE_T range=BMA250E_RANGE_2G,
BMA250E_BW_T bw=BMA250E_BW_250);
/**
* 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.
*
* @param pwr One of the BMA250E_POWER_MODE_T values. The default is
* BMA250E_POWER_MODE_NORMAL.
* @param range One of the BMA250E_RANGE_T values. The default is
* BMA250E_RANGE_2G.
* @param bw One of the filtering BMA250E_BW_T values. The default is
* BMA250E_BW_250.
*/
void initAccelerometer(
BMA250E_POWER_MODE_T pwr=BMA250E_POWER_MODE_NORMAL,
BMA250E_RANGE_T range=BMA250E_RANGE_2G,
BMA250E_BW_T bw=BMA250E_BW_250);
/**
* 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.
*
* @param pwr One of the BMG160_POWER_MODE_T values. The default is
* BMG160_POWER_MODE_NORMAL.
* @param range One of the BMG160_RANGE_T values. The default is
* BMG160_RANGE_250.
* @param bw One of the filtering BMG160_BW_T values. The default is
* BMG160_BW_400_47.
*/
void initGyroscope(BMG160_POWER_MODE_T pwr=BMG160_POWER_MODE_NORMAL,
BMG160_RANGE_T range=BMG160_RANGE_250,
BMG160_BW_T bw=BMG160_BW_400_47);
/**
* 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.
*
* @param pwr One of the BMG160_POWER_MODE_T values. The default is
* BMG160_POWER_MODE_NORMAL.
* @param range One of the BMG160_RANGE_T values. The default is
* BMG160_RANGE_250.
* @param bw One of the filtering BMG160_BW_T values. The default is
* BMG160_BW_400_47.
*/
void initGyroscope(BMG160_POWER_MODE_T pwr=BMG160_POWER_MODE_NORMAL,
BMG160_RANGE_T range=BMG160_RANGE_250,
BMG160_BW_T bw=BMG160_BW_400_47);
/**
* 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.
*
* @param usage One of the BMM150::USAGE_PRESETS_T values. The default is
* BMM150::USAGE_HIGH_ACCURACY.
*/
void initMagnetometer(BMM150::USAGE_PRESETS_T usage=BMM150::USAGE_HIGH_ACCURACY);
/**
* 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.
*
* @param usage One of the BMM150_USAGE_PRESETS_T values.
* The default is BMM150_USAGE_HIGH_ACCURACY.
*/
void initMagnetometer(
BMM150_USAGE_PRESETS_T usage=BMM150_USAGE_HIGH_ACCURACY);
/**
* Return accelerometer data in gravities. update() must have
* been called prior to calling this method.
*
* @param x Pointer to a floating point value that will have the
* current x component placed into it.
* @param y Pointer to a floating point value that will have the
* current y component placed into it.
* @param z Pointer to a floating point value that will have the
* current z component placed into it.
*/
void getAccelerometer(float *x, float *y, float *z);
/**
* Return accelerometer data in gravities. update() must have
* been called prior to calling this method.
*
* @param x Pointer to a floating point value that will have the
* current x component placed into it.
* @param y Pointer to a floating point value that will have the
* current y component placed into it.
* @param z Pointer to a floating point value that will have the
* current z component placed into it.
*/
void getAccelerometer(float *x, float *y, float *z);
/**
* Return accelerometer data in gravities in the form of a
* floating point vector. update() must have been called prior to
* calling this method.
*
* @return A floating point vector containing x, y, and z in
* that order.
*/
std::vector<float> getAccelerometer();
/**
* Return accelerometer data in gravities in the form of a
* floating point vector. update() must have been called prior to
* calling this method.
*
* @return A floating point vector containing x, y, and z in
* that order.
*/
std::vector<float> getAccelerometer();
/**
* Return gyroscope data in degrees per second. update() must
* have been called prior to calling this method.
*
* @param x Pointer to a floating point value that will have the
* current x component placed into it.
* @param y Pointer to a floating point value that will have the
* current y component placed into it.
* @param z Pointer to a floating point value that will have the
* current z component placed into it.
*/
void getGyroscope(float *x, float *y, float *z);
/**
* Return gyroscope data in degrees per second. update() must
* have been called prior to calling this method.
*
* @param x Pointer to a floating point value that will have the
* current x component placed into it.
* @param y Pointer to a floating point value that will have the
* current y component placed into it.
* @param z Pointer to a floating point value that will have the
* current z component placed into it.
*/
void getGyroscope(float *x, float *y, float *z);
/**
* Return gyroscope data in degrees per second in the form of a
* floating point array. The pointer returned by this function is
* statically allocated and will be rewritten on each call.
* update() must have been called prior to calling this method.
*
* @return A floating point array containing x, y, and z in
* that order.
*/
std::vector<float> getGyroscope();
/**
* 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.
*
* @return A floating point vector containing x, y, and z in
* that order.
*/
std::vector<float> getGyroscope();
/**
* Return magnetometer data in micro-Teslas (uT). update() must
* have been called prior to calling this method.
*
* @param x Pointer to a floating point value that will have the
* current x component placed into it.
* @param y Pointer to a floating point value that will have the
* current y component placed into it.
* @param z Pointer to a floating point value that will have the
* current z component placed into it.
*/
void getMagnetometer(float *x, float *y, float *z);
/**
* Return magnetometer data in micro-Teslas (uT). update() must
* have been called prior to calling this method.
*
* @param x Pointer to a floating point value that will have the
* current x component placed into it.
* @param y Pointer to a floating point value that will have the
* current y component placed into it.
* @param z Pointer to a floating point value that will have the
* current z component placed into it.
*/
void getMagnetometer(float *x, float *y, float *z);
/**
* 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.
*
* @return A floating point vector containing x, y, and z in
* that order.
*/
float *getMagnetometer();
/**
* 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.
*
* @return A floating point vector containing x, y, and z in
* that order.
*/
std::vector<float> getMagnetometer();
protected:
BMA250E *m_accel;
BMG160 *m_gyro;
BMM150 *m_mag;
protected:
BMA250E *m_accel;
BMG160 *m_gyro;
BMM150 *m_mag;
private:
};
private:
};
}