STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
QwDevISM330DHCX Class Reference

#include <sfe_ism330dhcx.h>

Inheritance diagram for QwDevISM330DHCX:
[legend]
Collaboration diagram for QwDevISM330DHCX:
[legend]

Public Member Functions

 QwDevISM330DHCX ()
bool init ()
bool isConnected ()
int32_t writeRegisterRegion (uint8_t reg, uint8_t *data, uint16_t length)
int32_t readRegisterRegion (uint8_t reg, uint8_t *data, uint16_t length)
void setCommunicationBus (sfe_ISM330DHCX::QwIDeviceBus &theBus, uint8_t i2cAddress)
void setCommunicationBus (sfe_ISM330DHCX::QwIDeviceBus &theBus)
bool setAccelFullScale (uint8_t val)
bool setGyroFullScale (uint8_t val)
uint8_t getAccelFullScale ()
uint8_t getUniqueId ()
int16_t getTemp ()
bool getRawAccel (sfe_ism_raw_data_t *accelData)
bool getRawGyro (sfe_ism_raw_data_t *gyroData)
bool getAccel (sfe_ism_data_t *accelData)
bool getGyro (sfe_ism_data_t *gyroData)
bool setDeviceConfig (bool enable=true)
bool deviceReset ()
bool getDeviceReset ()
bool setAccelSlopeFilter (uint8_t val)
bool setAccelFilterLP2 (bool enable=true)
bool setGyroFilterLP1 (bool enable=true)
bool setGyroLP1Bandwidth (uint8_t val)
bool setBlockDataUpdate (bool enable=true)
uint8_t getBlockDataUpdate ()
bool setAccelDataRate (uint8_t rate)
bool setGyroDataRate (uint8_t rate)
bool enableTimestamp (bool enable=true)
bool resetTimestamp ()
bool setAccelStatustoInt1 (bool enable=true)
bool setAccelStatustoInt2 (bool enable=true)
bool setGyroStatustoInt1 (bool enable=true)
bool setGyroStatustoInt2 (bool enable=true)
bool setIntNotification (uint8_t val)
bool setDataReadyMode (uint8_t val)
bool setPinMode (bool activeLow=true)
bool setFifoWatermark (uint16_t val)
bool setFifoMode (uint8_t val)
bool setAccelFifoBatchSet (uint8_t val)
bool setGyroFifoBatchSet (uint8_t val)
bool setFifoTimestampDec (uint8_t val)
bool setHubODR (uint8_t rate)
bool setHubSensorRead (uint8_t sensor, sfe_hub_sensor_settings_t *settings)
bool setHubSensorWrite (sfe_hub_sensor_settings_t *settings)
bool setNumberHubSensors (uint8_t numSensors)
bool enableSensorI2C (bool enable)
bool readPeripheralSensor (uint8_t *shReg, uint8_t len)
bool setHubWriteMode (uint8_t config)
bool readMMCMagnetometer (uint8_t *magData, uint8_t len)
bool setHubPassThrough (bool enable=true)
bool setHubFifoBatching (bool enable=true)
bool setHubPullUps (bool enable=true)
bool getHubStatus ()
bool getExternalSensorNack (uint8_t sensor)
bool resetSensorHub ()
bool setAccelSelfTest (uint8_t val)
bool setGyroSelfTest (uint8_t val)
bool checkStatus ()
bool checkAccelStatus ()
bool checkGyroStatus ()
bool checkTempStatus ()
bool configureWakeUpOnInt1 (uint8_t wkThreshold, uint8_t wakeDur, bool routeAccelGyroDrdyToInt1=false)
bool serviceWakeUpInterrupt (sfe_ism330_wake_event_t *out)
bool configureSensor ()
uint16_t getFifoLevel ()
bool readFifoSample (sfe_ism_raw_data_t *gyro, sfe_ism_raw_data_t *accel, uint8_t *tag_out=nullptr)
bool setFifoWtmToInt2 (bool enable=true)
bool calibrateBiases (uint16_t samples=256)
bool getAccelCal (sfe_ism_data_t *accelData)
bool getGyroCal (sfe_ism_data_t *gyroData)
float convert2gToMg (int16_t data)
float convert4gToMg (int16_t data)
float convert8gToMg (int16_t data)
float convert16gToMg (int16_t data)
float convert125dpsToMdps (int16_t data)
float convert250dpsToMdps (int16_t data)
float convert500dpsToMdps (int16_t data)
float convert1000dpsToMdps (int16_t data)
float convert2000dpsToMdps (int16_t data)
float convert4000dpsToMdps (int16_t data)
float convertToCelsius (int16_t data)

Private Member Functions

uint8_t getAllIntSrc ()

Private Attributes

sfe_ISM330DHCX::QwIDeviceBus * _sfeBus
uint8_t _i2cAddress
uint8_t _cs
stmdev_ctx_t sfe_dev
uint8_t fullScaleAccel = 0
uint8_t fullScaleGyro = 0
sfe_ism_data_t _accelBias {0.0f, 0.0f, 0.0f}
sfe_ism_data_t _gyroBias {0.0f, 0.0f, 0.0f}
bool _biasValid = false

Detailed Description

Definition at line 40 of file sfe_ism330dhcx.h.

Constructor & Destructor Documentation

◆ QwDevISM330DHCX()

QwDevISM330DHCX::QwDevISM330DHCX ( )
inline

Definition at line 44 of file sfe_ism330dhcx.h.

References _cs, and _i2cAddress.

Member Function Documentation

◆ calibrateBiases()

bool QwDevISM330DHCX::calibrateBiases ( uint16_t samples = 256)

Definition at line 625 of file sfe_ism330dhcx.cpp.

References _accelBias, _biasValid, _gyroBias, a, delay(), g, getAccel(), and getGyro().

◆ checkAccelStatus()

bool QwDevISM330DHCX::checkAccelStatus ( )

◆ checkGyroStatus()

bool QwDevISM330DHCX::checkGyroStatus ( )

◆ checkStatus()

bool QwDevISM330DHCX::checkStatus ( )

◆ checkTempStatus()

bool QwDevISM330DHCX::checkTempStatus ( )

◆ configureSensor()

◆ configureWakeUpOnInt1()

bool QwDevISM330DHCX::configureWakeUpOnInt1 ( uint8_t wkThreshold,
uint8_t wakeDur,
bool routeAccelGyroDrdyToInt1 = false )

◆ convert1000dpsToMdps()

float QwDevISM330DHCX::convert1000dpsToMdps ( int16_t data)

Definition at line 432 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs1000dps_to_mdps().

Referenced by getGyro().

◆ convert125dpsToMdps()

float QwDevISM330DHCX::convert125dpsToMdps ( int16_t data)

Definition at line 417 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs125dps_to_mdps().

Referenced by getGyro().

◆ convert16gToMg()

float QwDevISM330DHCX::convert16gToMg ( int16_t data)

Definition at line 412 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs16g_to_mg().

Referenced by getAccel().

◆ convert2000dpsToMdps()

float QwDevISM330DHCX::convert2000dpsToMdps ( int16_t data)

Definition at line 437 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs2000dps_to_mdps().

Referenced by getGyro().

◆ convert250dpsToMdps()

float QwDevISM330DHCX::convert250dpsToMdps ( int16_t data)

Definition at line 422 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs250dps_to_mdps().

Referenced by getGyro().

◆ convert2gToMg()

float QwDevISM330DHCX::convert2gToMg ( int16_t data)

Definition at line 397 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs2g_to_mg().

Referenced by getAccel().

◆ convert4000dpsToMdps()

float QwDevISM330DHCX::convert4000dpsToMdps ( int16_t data)

Definition at line 442 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs4000dps_to_mdps().

Referenced by getGyro().

◆ convert4gToMg()

float QwDevISM330DHCX::convert4gToMg ( int16_t data)

Definition at line 402 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs4g_to_mg().

Referenced by getAccel().

◆ convert500dpsToMdps()

float QwDevISM330DHCX::convert500dpsToMdps ( int16_t data)

Definition at line 427 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs500dps_to_mdps().

Referenced by getGyro().

◆ convert8gToMg()

float QwDevISM330DHCX::convert8gToMg ( int16_t data)

Definition at line 407 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_fs8g_to_mg().

Referenced by getAccel().

◆ convertToCelsius()

float QwDevISM330DHCX::convertToCelsius ( int16_t data)

Definition at line 447 of file sfe_ism330dhcx.cpp.

References ism330dhcx_from_lsb_to_celsius().

◆ deviceReset()

bool QwDevISM330DHCX::deviceReset ( )

Definition at line 724 of file sfe_ism330dhcx.cpp.

References ism330dhcx_reset_set(), and sfe_dev.

◆ enableSensorI2C()

bool QwDevISM330DHCX::enableSensorI2C ( bool enable)

Definition at line 1506 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_sh_master_set(), and sfe_dev.

◆ enableTimestamp()

bool QwDevISM330DHCX::enableTimestamp ( bool enable = true)

Definition at line 964 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_timestamp_set(), and sfe_dev.

◆ getAccel()

bool QwDevISM330DHCX::getAccel ( sfe_ism_data_t * accelData)

◆ getAccelCal()

bool QwDevISM330DHCX::getAccelCal ( sfe_ism_data_t * accelData)

Definition at line 656 of file sfe_ism330dhcx.cpp.

References _accelBias, _biasValid, accelData, and getAccel().

◆ getAccelFullScale()

uint8_t QwDevISM330DHCX::getAccelFullScale ( )

Definition at line 175 of file sfe_ism330dhcx.cpp.

References ism330dhcx_xl_full_scale_get(), and sfe_dev.

◆ getAllIntSrc()

uint8_t QwDevISM330DHCX::getAllIntSrc ( )
private

Definition at line 471 of file sfe_ism330dhcx.cpp.

References ISM_REG_ALL_INT_SRC, and readRegisterRegion().

Referenced by serviceWakeUpInterrupt().

◆ getBlockDataUpdate()

uint8_t QwDevISM330DHCX::getBlockDataUpdate ( )

Definition at line 891 of file sfe_ism330dhcx.cpp.

References ism330dhcx_block_data_update_get(), and sfe_dev.

◆ getDeviceReset()

bool QwDevISM330DHCX::getDeviceReset ( )

Definition at line 742 of file sfe_ism330dhcx.cpp.

References ism330dhcx_reset_get(), and sfe_dev.

◆ getExternalSensorNack()

◆ getFifoLevel()

uint16_t QwDevISM330DHCX::getFifoLevel ( )

Definition at line 558 of file sfe_ism330dhcx.cpp.

References ISM_REG_FIFO_STATUS1, and readRegisterRegion().

◆ getGyro()

◆ getGyroCal()

bool QwDevISM330DHCX::getGyroCal ( sfe_ism_data_t * gyroData)

Definition at line 674 of file sfe_ism330dhcx.cpp.

References _biasValid, _gyroBias, getGyro(), and gyroData.

◆ getHubStatus()

bool QwDevISM330DHCX::getHubStatus ( )

◆ getRawAccel()

bool QwDevISM330DHCX::getRawAccel ( sfe_ism_raw_data_t * accelData)

Definition at line 235 of file sfe_ism330dhcx.cpp.

References accelData, ism330dhcx_acceleration_raw_get(), and sfe_dev.

◆ getRawGyro()

bool QwDevISM330DHCX::getRawGyro ( sfe_ism_raw_data_t * gyroData)

Definition at line 262 of file sfe_ism330dhcx.cpp.

References gyroData, ism330dhcx_angular_rate_raw_get(), and sfe_dev.

◆ getTemp()

int16_t QwDevISM330DHCX::getTemp ( )

Definition at line 212 of file sfe_ism330dhcx.cpp.

References ism330dhcx_temperature_raw_get(), and sfe_dev.

◆ getUniqueId()

uint8_t QwDevISM330DHCX::getUniqueId ( )

Definition at line 193 of file sfe_ism330dhcx.cpp.

References ism330dhcx_device_id_get(), and sfe_dev.

Referenced by init(), and isConnected().

◆ init()

bool QwDevISM330DHCX::init ( void )

◆ isConnected()

bool QwDevISM330DHCX::isConnected ( )

Definition at line 39 of file sfe_ism330dhcx.cpp.

References getUniqueId(), and ISM330DHCX_ID.

◆ readFifoSample()

bool QwDevISM330DHCX::readFifoSample ( sfe_ism_raw_data_t * gyro,
sfe_ism_raw_data_t * accel,
uint8_t * tag_out = nullptr )

◆ readMMCMagnetometer()

bool QwDevISM330DHCX::readMMCMagnetometer ( uint8_t * magData,
uint8_t len )

Definition at line 1610 of file sfe_ism330dhcx.cpp.

References readPeripheralSensor().

◆ readPeripheralSensor()

bool QwDevISM330DHCX::readPeripheralSensor ( uint8_t * shReg,
uint8_t len )

Definition at line 1529 of file sfe_ism330dhcx.cpp.

References ism330dhcx_sh_read_data_raw_get(), and sfe_dev.

Referenced by readMMCMagnetometer().

◆ readRegisterRegion()

int32_t QwDevISM330DHCX::readRegisterRegion ( uint8_t reg,
uint8_t * data,
uint16_t length )

◆ resetSensorHub()

bool QwDevISM330DHCX::resetSensorHub ( )

Definition at line 1717 of file sfe_ism330dhcx.cpp.

References ism330dhcx_sh_reset_set(), and sfe_dev.

◆ resetTimestamp()

bool QwDevISM330DHCX::resetTimestamp ( )

Definition at line 984 of file sfe_ism330dhcx.cpp.

References ism330dhcx_timestamp_rst(), and sfe_dev.

◆ serviceWakeUpInterrupt()

bool QwDevISM330DHCX::serviceWakeUpInterrupt ( sfe_ism330_wake_event_t * out)

Definition at line 478 of file sfe_ism330dhcx.cpp.

References getAllIntSrc(), ISM330DHCX_WAKE_UP_SRC, and readRegisterRegion().

◆ setAccelDataRate()

bool QwDevISM330DHCX::setAccelDataRate ( uint8_t rate)

Definition at line 913 of file sfe_ism330dhcx.cpp.

References ism330dhcx_xl_data_rate_set(), and sfe_dev.

Referenced by configureSensor().

◆ setAccelFifoBatchSet()

bool QwDevISM330DHCX::setAccelFifoBatchSet ( uint8_t val)

Definition at line 1075 of file sfe_ism330dhcx.cpp.

References ism330dhcx_fifo_xl_batch_set(), and sfe_dev.

◆ setAccelFilterLP2()

bool QwDevISM330DHCX::setAccelFilterLP2 ( bool enable = true)

Definition at line 799 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_xl_filter_lp2_set(), and sfe_dev.

◆ setAccelFullScale()

bool QwDevISM330DHCX::setAccelFullScale ( uint8_t val)

Definition at line 123 of file sfe_ism330dhcx.cpp.

References fullScaleAccel, ism330dhcx_xl_full_scale_set(), and sfe_dev.

Referenced by configureSensor().

◆ setAccelSelfTest()

bool QwDevISM330DHCX::setAccelSelfTest ( uint8_t val)

Definition at line 1743 of file sfe_ism330dhcx.cpp.

References ism330dhcx_xl_self_test_set(), and sfe_dev.

◆ setAccelSlopeFilter()

bool QwDevISM330DHCX::setAccelSlopeFilter ( uint8_t val)

Definition at line 772 of file sfe_ism330dhcx.cpp.

References ism330dhcx_xl_hp_path_on_out_set(), and sfe_dev.

◆ setAccelStatustoInt1()

bool QwDevISM330DHCX::setAccelStatustoInt1 ( bool enable = true)

◆ setAccelStatustoInt2()

bool QwDevISM330DHCX::setAccelStatustoInt2 ( bool enable = true)

◆ setBlockDataUpdate()

bool QwDevISM330DHCX::setBlockDataUpdate ( bool enable = true)

Definition at line 872 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_block_data_update_set(), and sfe_dev.

Referenced by configureSensor().

◆ setCommunicationBus() [1/2]

void QwDevISM330DHCX::setCommunicationBus ( sfe_ISM330DHCX::QwIDeviceBus & theBus)

Definition at line 74 of file sfe_ism330dhcx.cpp.

References _sfeBus.

◆ setCommunicationBus() [2/2]

void QwDevISM330DHCX::setCommunicationBus ( sfe_ISM330DHCX::QwIDeviceBus & theBus,
uint8_t i2cAddress )

Definition at line 58 of file sfe_ism330dhcx.cpp.

References _i2cAddress, and _sfeBus.

Referenced by ISM330DH::begin(), ISM330DH::begin(), ISM330DH_SPI::begin(), and ISM330DH_SPI::begin().

◆ setDataReadyMode()

bool QwDevISM330DHCX::setDataReadyMode ( uint8_t val)

Definition at line 1335 of file sfe_ism330dhcx.cpp.

References ism330dhcx_data_ready_mode_set(), and sfe_dev.

◆ setDeviceConfig()

bool QwDevISM330DHCX::setDeviceConfig ( bool enable = true)

Definition at line 705 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_device_conf_set(), and sfe_dev.

Referenced by configureSensor().

◆ setFifoMode()

bool QwDevISM330DHCX::setFifoMode ( uint8_t val)

Definition at line 1046 of file sfe_ism330dhcx.cpp.

References ism330dhcx_fifo_mode_set(), and sfe_dev.

◆ setFifoTimestampDec()

bool QwDevISM330DHCX::setFifoTimestampDec ( uint8_t val)

Definition at line 1129 of file sfe_ism330dhcx.cpp.

References ism330dhcx_fifo_timestamp_decimation_set(), and sfe_dev.

◆ setFifoWatermark()

bool QwDevISM330DHCX::setFifoWatermark ( uint16_t val)

Definition at line 1018 of file sfe_ism330dhcx.cpp.

References ism330dhcx_fifo_watermark_set(), and sfe_dev.

◆ setFifoWtmToInt2()

bool QwDevISM330DHCX::setFifoWtmToInt2 ( bool enable = true)

◆ setGyroDataRate()

bool QwDevISM330DHCX::setGyroDataRate ( uint8_t rate)

Definition at line 939 of file sfe_ism330dhcx.cpp.

References ism330dhcx_gy_data_rate_set(), and sfe_dev.

Referenced by configureSensor().

◆ setGyroFifoBatchSet()

bool QwDevISM330DHCX::setGyroFifoBatchSet ( uint8_t val)

Definition at line 1103 of file sfe_ism330dhcx.cpp.

References ism330dhcx_fifo_gy_batch_set(), and sfe_dev.

◆ setGyroFilterLP1()

bool QwDevISM330DHCX::setGyroFilterLP1 ( bool enable = true)

Definition at line 822 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_gy_filter_lp1_set(), and sfe_dev.

◆ setGyroFullScale()

bool QwDevISM330DHCX::setGyroFullScale ( uint8_t val)

Definition at line 152 of file sfe_ism330dhcx.cpp.

References fullScaleGyro, ism330dhcx_gy_full_scale_set(), and sfe_dev.

Referenced by configureSensor().

◆ setGyroLP1Bandwidth()

bool QwDevISM330DHCX::setGyroLP1Bandwidth ( uint8_t val)

Definition at line 846 of file sfe_ism330dhcx.cpp.

References ism330dhcx_gy_lp1_bandwidth_set(), and sfe_dev.

◆ setGyroSelfTest()

bool QwDevISM330DHCX::setGyroSelfTest ( uint8_t val)

Definition at line 1759 of file sfe_ism330dhcx.cpp.

References ism330dhcx_gy_self_test_set(), and sfe_dev.

◆ setGyroStatustoInt1()

bool QwDevISM330DHCX::setGyroStatustoInt1 ( bool enable = true)

◆ setGyroStatustoInt2()

bool QwDevISM330DHCX::setGyroStatustoInt2 ( bool enable = true)

◆ setHubFifoBatching()

bool QwDevISM330DHCX::setHubFifoBatching ( bool enable = true)

Definition at line 1675 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_sh_batch_slave_0_set(), and sfe_dev.

◆ setHubODR()

bool QwDevISM330DHCX::setHubODR ( uint8_t rate)

Definition at line 1377 of file sfe_ism330dhcx.cpp.

References ism330dhcx_sh_data_rate_set(), and sfe_dev.

◆ setHubPassThrough()

bool QwDevISM330DHCX::setHubPassThrough ( bool enable = true)

Definition at line 1655 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_sh_pass_through_set(), and sfe_dev.

◆ setHubPullUps()

bool QwDevISM330DHCX::setHubPullUps ( bool enable = true)

Definition at line 1697 of file sfe_ism330dhcx.cpp.

References enable(), ism330dhcx_sh_pin_mode_set(), and sfe_dev.

◆ setHubSensorRead()

◆ setHubSensorWrite()

◆ setHubWriteMode()

bool QwDevISM330DHCX::setHubWriteMode ( uint8_t config)

Definition at line 1626 of file sfe_ism330dhcx.cpp.

References config, ism330dhcx_sh_write_mode_set(), and sfe_dev.

◆ setIntNotification()

bool QwDevISM330DHCX::setIntNotification ( uint8_t val)

Definition at line 1200 of file sfe_ism330dhcx.cpp.

References ism330dhcx_int_notification_set(), and sfe_dev.

◆ setNumberHubSensors()

bool QwDevISM330DHCX::setNumberHubSensors ( uint8_t numSensors)

Definition at line 1482 of file sfe_ism330dhcx.cpp.

References ism330dhcx_sh_slave_connected_set(), and sfe_dev.

◆ setPinMode()

bool QwDevISM330DHCX::setPinMode ( bool activeLow = true)

◆ writeRegisterRegion()

int32_t QwDevISM330DHCX::writeRegisterRegion ( uint8_t reg,
uint8_t * data,
uint16_t length )

Definition at line 90 of file sfe_ism330dhcx.cpp.

References _i2cAddress, and _sfeBus.

Referenced by setFifoWtmToInt2().

Member Data Documentation

◆ _accelBias

sfe_ism_data_t QwDevISM330DHCX::_accelBias {0.0f, 0.0f, 0.0f}
private

Definition at line 215 of file sfe_ism330dhcx.h.

Referenced by calibrateBiases(), and getAccelCal().

◆ _biasValid

bool QwDevISM330DHCX::_biasValid = false
private

Definition at line 217 of file sfe_ism330dhcx.h.

Referenced by calibrateBiases(), getAccelCal(), and getGyroCal().

◆ _cs

uint8_t QwDevISM330DHCX::_cs
private

Definition at line 209 of file sfe_ism330dhcx.h.

Referenced by QwDevISM330DHCX().

◆ _gyroBias

sfe_ism_data_t QwDevISM330DHCX::_gyroBias {0.0f, 0.0f, 0.0f}
private

Definition at line 216 of file sfe_ism330dhcx.h.

Referenced by calibrateBiases(), and getGyroCal().

◆ _i2cAddress

uint8_t QwDevISM330DHCX::_i2cAddress
private

◆ _sfeBus

sfe_ISM330DHCX::QwIDeviceBus* QwDevISM330DHCX::_sfeBus
private

◆ fullScaleAccel

uint8_t QwDevISM330DHCX::fullScaleAccel = 0
private

Definition at line 211 of file sfe_ism330dhcx.h.

Referenced by getAccel(), and setAccelFullScale().

◆ fullScaleGyro

uint8_t QwDevISM330DHCX::fullScaleGyro = 0
private

Definition at line 212 of file sfe_ism330dhcx.h.

Referenced by getGyro(), and setGyroFullScale().

◆ sfe_dev


The documentation for this class was generated from the following files: