SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
SensorQMI8658 Class Reference

QMI8658 IMU sensor driver class. More...

#include <SensorQMI8658.hpp>

Inheritance diagram for SensorQMI8658:
[legend]

Classes

struct  EventCallbacks
 Grouped callbacks for QMI8658 events. More...
 

Public Types

enum class  AccelRange : uint8_t {
  FS_2G , FS_4G , FS_8G , FS_16G ,
  ACC_RANGE_2G , ACC_RANGE_4G , ACC_RANGE_8G , ACC_RANGE_16G
}
 Accelerometer full-scale range enumeration. More...
 
enum class  AccelODR : uint8_t {
  ODR_7Hz , ODR_14Hz , ODR_28Hz , ODR_56Hz ,
  ODR_112Hz , ODR_224Hz , ODR_448Hz , ODR_896Hz ,
  ODR_1792Hz , ODR_3584Hz , ODR_7168Hz , ODR_LP_3Hz ,
  ODR_LP_11Hz , ODR_LP_21Hz , ODR_LP_128Hz , ACC_ODR_1000Hz = 3 ,
  ACC_ODR_500Hz , ACC_ODR_250Hz , ACC_ODR_125Hz , ACC_ODR_62_5Hz ,
  ACC_ODR_31_25Hz , ACC_ODR_LOWPOWER_128Hz = 12 , ACC_ODR_LOWPOWER_21Hz , ACC_ODR_LOWPOWER_11Hz ,
  ACC_ODR_LOWPOWER_3Hz
}
 Accelerometer output data rate enumeration. More...
 
enum class  GyroRange : uint8_t {
  FS_16DPS , FS_32DPS , FS_64DPS , FS_128DPS ,
  FS_256DPS , FS_512DPS , FS_1024DPS , FS_2048DPS ,
  GYR_RANGE_16DPS , GYR_RANGE_32DPS , GYR_RANGE_64DPS , GYR_RANGE_128DPS ,
  GYR_RANGE_256DPS , GYR_RANGE_512DPS , GYR_RANGE_1024DPS
}
 Gyroscope full-scale range enumeration. More...
 
enum class  GyroODR : uint8_t {
  ODR_7Hz , ODR_14Hz , ODR_28Hz , ODR_56Hz ,
  ODR_112Hz , ODR_224Hz , ODR_448Hz , ODR_896Hz ,
  ODR_1792Hz , ODR_3584Hz , ODR_7168Hz , GYR_ODR_7174_4Hz ,
  GYR_ODR_3587_2Hz , GYR_ODR_1793_6Hz , GYR_ODR_896_8Hz , GYR_ODR_448_4Hz ,
  GYR_ODR_224_2Hz , GYR_ODR_112_1Hz , GYR_ODR_56_05Hz , GYR_ODR_28_025Hz
}
 Gyroscope output data rate enumeration. More...
 
enum class  LpfMode : uint8_t {
  MODE_0 , MODE_1 , MODE_2 , MODE_3 ,
  OFF = 0xFF , LPF_MODE_0 , LPF_MODE_1 , LPF_MODE_2 ,
  LPF_MODE_3 , LPF_OFF
}
 Low-pass filter mode enumeration. More...
 
enum class  FifoMode : uint8_t { BYPASS , FIFO , STREAM }
 FIFO mode enumeration. More...
 
enum class  FifoSamples : uint8_t { SAMPLES_16 , SAMPLES_32 , SAMPLES_64 , SAMPLES_128 }
 FIFO sample count enumeration. More...
 
enum class  TapPriority : uint8_t {
  X_GT_Y_GT_Z , X_GT_Z_GT_Y , Y_GT_X_GT_Z , Y_GT_Z_GT_X ,
  Z_GT_X_GT_Y , Z_GT_Y_GT_X
}
 Tap detection axis priority enumeration. More...
 
enum class  MotionType : uint8_t { ANY_MOTION = 0 , NO_MOTION = 1 , SIGNIFICANT = 2 }
 Motion detection type enumeration. More...
 
enum class  Layout : uint8_t {
  LAYOUT_DEFAULT = 0 , LAYOUT_ROTATE_90 = 1 , LAYOUT_ROTATE_180 = 2 , LAYOUT_ROTATE_270 = 3 ,
  LAYOUT_FLIP_Z = 4 , LAYOUT_FLIP_Z_90 = 5 , LAYOUT_FLIP_Z_180 = 6 , LAYOUT_FLIP_Z_270 = 7
}
 Sensor axis layout enumeration for coordinate transformation. More...
 
enum  AccelRange { FS_2G , FS_4G , FS_8G , FS_16G }
 
enum  GyroRange {
  FS_16DPS , FS_32DPS , FS_64DPS , FS_128DPS ,
  FS_256DPS , FS_512DPS , FS_1024DPS , FS_2048DPS
}
 
enum  AccelODR {
  ODR_7Hz , ODR_14Hz , ODR_28Hz , ODR_56Hz ,
  ODR_112Hz , ODR_224Hz , ODR_448Hz , ODR_896Hz ,
  ODR_1792Hz , ODR_3584Hz , ODR_7168Hz , ODR_LP_3Hz ,
  ODR_LP_11Hz , ODR_LP_21Hz , ODR_LP_128Hz
}
 
enum  GyroODR {
  ODR_7Hz , ODR_14Hz , ODR_28Hz , ODR_56Hz ,
  ODR_112Hz , ODR_224Hz , ODR_448Hz , ODR_896Hz ,
  ODR_1792Hz , ODR_3584Hz , ODR_7168Hz
}
 
enum  TapEvent { INVALID_TAP , SINGLE_TAP , DOUBLE_TAP }
 
enum  LpfMode {
  MODE_0 , MODE_1 , MODE_2 , MODE_3 ,
  OFF = 0xFF
}
 
enum  MotionEvent {
  MOTION_TAP , MOTION_ANT_MOTION , MOTION_NO_MOTION , MOTION_SIGNIFICANT ,
  MOTION_PEDOMETER
}
 
enum  IntPin { INTERRUPT_PIN_1 , INTERRUPT_PIN_2 , INTERRUPT_PIN_DISABLE }
 
enum  FIFO_Samples { FIFO_SAMPLES_16 , FIFO_SAMPLES_32 , FIFO_SAMPLES_64 , FIFO_SAMPLES_128 }
 
enum  FIFO_Mode { FIFO_MODE_BYPASS , FIFO_MODE_FIFO , FIFO_MODE_STREAM }
 
enum  SampleMode { SYNC_MODE , ASYNC_MODE }
 
enum  CommandTable {
  CTRL_CMD_ACK = 0x00 , CTRL_CMD_RST_FIFO = 0x04 , CTRL_CMD_REQ_FIFO = 0x05 , CTRL_CMD_WRITE_WOM_SETTING = 0x08 ,
  CTRL_CMD_ACCEL_HOST_DELTA_OFFSET = 0x09 , CTRL_CMD_GYRO_HOST_DELTA_OFFSET = 0x0A , CTRL_CMD_CONFIGURE_TAP = 0x0C , CTRL_CMD_CONFIGURE_PEDOMETER = 0x0D ,
  CTRL_CMD_CONFIGURE_MOTION = 0x0E , CTRL_CMD_RESET_PEDOMETER = 0x0F , CTRL_CMD_COPY_USID = 0x10 , CTRL_CMD_SET_RPU = 0x11 ,
  CTRL_CMD_AHB_CLOCK_GATING = 0x12 , CTRL_CMD_ON_DEMAND_CALIBRATION = 0xA2 , CTRL_CMD_APPLY_GYRO_GAINS = 0xAA
}
 
enum  StatusReg {
  EVENT_SIGNIFICANT_MOTION = 128 , EVENT_NO_MOTION = 64 , EVENT_ANY_MOTION = 32 , EVENT_PEDOMETER_MOTION = 16 ,
  EVENT_WOM_MOTION = 4 , EVENT_TAP_MOTION = 2
}
 
enum  SensorStatus {
  STATUS_INT_CTRL9_CMD_DONE = 0x0001 , STATUS_INT_LOCKED = 0x0002 , STATUS_INT_AVAIL = 0x0004 , STATUS0_GYRO_DATA_READY = 0x0008 ,
  STATUS0_ACCEL_DATA_READY = 0x0010 , STATUS1_SIGNIFICANT_MOTION = 0x0020 , STATUS1_NO_MOTION = 0x0040 , STATUS1_ANY_MOTION = 0x0080 ,
  STATUS1_PEDOMETER_MOTION = 0x0100 , STATUS1_WOM_MOTION = 0x0200 , STATUS1_TAP_MOTION = 0x0400
}
 
enum  TapDetectionPriority {
  PRIORITY0 , PRIORITY1 , PRIORITY2 , PRIORITY3 ,
  PRIORITY4 , PRIORITY5
}
 
enum  MotionCtrl {
  ANY_MOTION_EN_X = sensorlib::_bv(0) , ANY_MOTION_EN_Y = sensorlib::_bv(1) , ANY_MOTION_EN_Z = sensorlib::_bv(2) , ANY_MOTION_LOGIC_AND = sensorlib::_bv(3) ,
  NO_MOTION_EN_X = sensorlib::_bv(4) , NO_MOTION_EN_Y = sensorlib::_bv(5) , NO_MOTION_EN_Z = sensorlib::_bv(6) , NO_MOTION_LOGIC_OR = sensorlib::_bv(7)
}
 
using IntPin = InterruptPinMap
 
using TapEvent = ::TapEvent
 
using MotionCallback = std::function< void()>
 Callback function type for motion events.
 
using TapCallback = std::function< void(TapEvent event)>
 Callback function type for tap events.
 
using DataReadyCallback = std::function< void()>
 Callback function type for data ready events.
 
typedef void(* EventCallBack_t) (void)
 
- Public Types inherited from ImuBase
enum class  DataReadyMask : uint8_t { ACCEL = 0x01 , GYRO = 0x02 , BOTH = 0x03 }
 

Public Member Functions

 SensorQMI8658 ()
 Construct a new SensorQMI8658 object.
 
 ~SensorQMI8658 () override
 Destroy the SensorQMI8658 object.
 
bool reset () override
 Reset the IMU sensor to its default state.
 
bool selfTest () override
 Perform self-test on the IMU sensor.
 
bool isPresent () override
 Check if the IMU sensor is responding.
 
uint8_t getChipID () override
 Get the chip ID / WHO_AM_I value.
 
uint32_t getFirmwareVersion () override
 Get the firmware version.
 
bool setOperationMode (OperationMode mode) override
 Set IMU operation mode.
 
float getTemperature () override
 Get the temperature reading from the sensor.
 
uint32_t getTimestamp () override
 Get the timestamp from the sensor.
 
bool isDataReady (uint8_t mask=static_cast< uint8_t >(ImuBase::DataReadyMask::BOTH)) override
 Check if requested IMU data is available.
 
bool readAccel (AccelerometerData &out) override
 Read accelerometer data.
 
bool enableAccel () override
 Enable the accelerometer.
 
bool disableAccel () override
 Disable the accelerometer.
 
bool isAccelEnabled () override
 Check if accelerometer is enabled.
 
bool setAccelFullScaleRange (AccelFullScaleRange range) override
 Set accelerometer full scale range.
 
bool setAccelOutputDataRate (float data_rate_hz) override
 Set accelerometer output data rate.
 
bool readAccelRaw (int16_t &x, int16_t &y, int16_t &z) override
 Read raw accelerometer data without scaling.
 
bool readGyro (GyroscopeData &out) override
 Read gyroscope data.
 
bool enableGyro () override
 Enable the gyroscope.
 
bool disableGyro () override
 Disable the gyroscope.
 
bool isGyroEnabled () override
 Check if gyroscope is enabled.
 
bool setGyroFullScaleRange (GyroFullScaleRange range) override
 Set gyroscope full scale range.
 
bool setGyroOutputDataRate (float data_rate_hz) override
 Set gyroscope output data rate.
 
bool readGyroRaw (int16_t &x, int16_t &y, int16_t &z) override
 Read raw gyroscope data without scaling.
 
bool enableSyncMode () override
 Enable synchronous sampling mode.
 
bool disableSyncMode () override
 Disable synchronous sampling mode.
 
bool configureFifo (bool enable, uint8_t watermark_samples=16) override
 Configure the FIFO buffer.
 
uint16_t readFromFifo (AccelerometerData *accel_data, uint16_t accel_count, GyroscopeData *gyro_data, uint16_t gyro_count) override
 Read data from FIFO buffer.
 
bool configAccel (AccelFullScaleRange range, float data_rate_hz, LpfMode lpf=LpfMode::MODE_0)
 Configure the accelerometer with specified parameters.
 
bool configGyro (GyroFullScaleRange range, float data_rate_hz, LpfMode lpf=LpfMode::MODE_0)
 Configure the gyroscope with specified parameters.
 
bool enableInterrupt (IntPin pin)
 Enable interrupt on specified pin.
 
bool disableInterrupt (IntPin pin)
 Disable interrupt on specified pin.
 
bool enableDataReadyInterrupt (IntPin pin=IntPin::PIN2)
 Enable data ready interrupt.
 
uint8_t getInterruptStatus ()
 Get interrupt status.
 
void setPins (int pin)
 Set interrupt pin.
 
void setIntPin (int pin)
 Backward-compatible alias of setPins.
 
bool configFifo (FifoMode mode, FifoSamples samples=FifoSamples::SAMPLES_16, uint8_t watermark_samples=16)
 Configure FIFO with specified mode.
 
bool resetFifo ()
 Reset the FIFO.
 
uint8_t getFifoStatus ()
 Get FIFO status.
 
bool enableLockingMechanism ()
 Enable the data locking mechanism.
 
bool disableLockingMechanism ()
 Disable the data locking mechanism.
 
bool calibrate (uint16_t *gyro_x_gain=nullptr, uint16_t *gyro_y_gain=nullptr, uint16_t *gyro_z_gain=nullptr)
 Perform on-demand calibration.
 
bool writeCalibration (uint16_t gyro_x_gain, uint16_t gyro_y_gain, uint16_t gyro_z_gain)
 Write previously saved gyro calibration gains.
 
void setAccelOffset (int16_t x, int16_t y, int16_t z)
 Set accelerometer host delta offsets.
 
void setGyroOffset (int16_t x, int16_t y, int16_t z)
 Set gyroscope host delta offsets.
 
bool selfTestAccel ()
 Perform accelerometer self-test.
 
bool selfTestGyro ()
 Perform gyroscope self-test.
 
bool configMotionDetect (MotionType type, float threshold_x, float threshold_y, float threshold_z, uint8_t duration)
 Configure motion detection parameters.
 
bool configMotionDetectDefault (MotionType type)
 Configure motion detection with default parameters.
 
bool enableMotionDetect (IntPin pin=IntPin::PIN1)
 Enable motion detection on specified pin.
 
bool disableMotionDetect ()
 Disable motion detection.
 
bool configWakeOnMotion (uint8_t threshold=200, float odr_hz=128.0f, IntPin pin=IntPin::PIN2)
 Configure wake-on-motion (WoM) feature.
 
bool configWakeOnMotionAdvanced (uint8_t threshold, float odr_hz, IntPin pin, uint8_t default_pin_value, uint8_t blanking_time, AccelFullScaleRange acc_range)
 Configure wake-on-motion (WoM) with full vendor parameters.
 
bool configAccel (AccelRange range, AccelODR odr, LpfMode lpf=LpfMode::MODE_0)
 
bool configAccel (AccelRange range, float data_rate_hz, LpfMode lpf=LpfMode::MODE_0)
 
bool configGyro (GyroRange range, GyroODR odr, LpfMode lpf=LpfMode::MODE_0)
 
bool configGyro (GyroRange range, float data_rate_hz, LpfMode lpf=LpfMode::MODE_0)
 
bool configWakeOnMotion (uint8_t threshold, AccelODR odr, IntPin pin)
 
bool configWakeOnMotion (uint8_t threshold, AccelODR odr, IntPin pin, uint8_t default_pin_value, uint8_t blanking_time, AccelRange acc_range)
 
bool configTap (TapPriority priority, uint8_t peak_window, uint16_t tap_window, uint16_t double_tap_window, float peak_mag_threshold, float quiet_threshold)
 Configure tap detection parameters.
 
bool configTapDefault (TapPriority priority=TapPriority::X_GT_Y_GT_Z)
 Configure tap detection with default parameters.
 
bool enableTap (IntPin pin=IntPin::PIN1)
 Enable tap detection.
 
bool disableTap ()
 Disable tap detection.
 
TapEvent getTapStatus ()
 Get tap status.
 
bool configPedometer (uint16_t sample_count, uint16_t peak_to_peak, uint16_t peak_threshold, uint16_t time_up, uint8_t time_low=20, uint8_t entry_count=10, uint8_t fix_precision=0, uint8_t sig_count=4)
 Configure pedometer parameters.
 
bool configPedometerDefault (float odr=125.0f)
 Configure pedometer with default parameters.
 
bool enablePedometer (IntPin pin=IntPin::DISABLE)
 Enable pedometer.
 
bool disablePedometer ()
 Disable pedometer.
 
uint32_t getStepCount ()
 Get pedometer step count.
 
bool resetStepCount ()
 Reset pedometer counter.
 
void setAnyMotionCallback (MotionCallback callback)
 Set callback for any-motion event.
 
void setNoMotionCallback (MotionCallback callback)
 Set callback for no-motion event.
 
void setSignificantMotionCallback (MotionCallback callback)
 Set callback for significant motion event.
 
void setWakeOnMotionCallback (MotionCallback callback)
 Set callback for wake-on-motion event.
 
void setTapCallback (TapCallback callback)
 Set callback for tap event.
 
void setPedometerCallback (MotionCallback callback)
 Set callback for pedometer event.
 
void setAccelDataReadyCallback (DataReadyCallback callback)
 Set callback for accelerometer data ready.
 
void setGyroDataReadyCallback (DataReadyCallback callback)
 Set callback for gyroscope data ready.
 
void setDataLockingCallback (DataReadyCallback callback)
 Set callback for data locking.
 
void setCallbacks (const EventCallbacks &cbs)
 Set all event callbacks at once.
 
EventCallbacksgetCallbacks ()
 Get current callbacks.
 
const EventCallbacksgetCallbacks () const
 Get current callbacks (const).
 
uint16_t update ()
 Update sensor status and process events.
 
void dumpRegisters ()
 Dump control registers for debugging.
 
void getChipUsid (uint8_t *buffer, uint8_t length)
 Get sensor USID (unique chip ID).
 
float getAccelScale ()
 Get the accelerometer scale factor.
 
float getGyroScale ()
 Get the gyroscope scale factor.
 
void setAxisLayout (Layout layout)
 Set the sensor axis layout for coordinate transformation.
 
Layout getAxisLayout () const
 Get the current axis layout setting.
 
void axisConvert (int16_t accel_data[3], int16_t gyro_data[3])
 Apply axis conversion to raw sensor data.
 
void enableStaticCalibration (bool enable)
 Start static calibration.
 
bool isStaticCalibrationEnabled () const
 Check if static calibration is enabled.
 
bool isStaticCalibrationComplete () const
 Get the current static calibration status.
 
bool processStaticCalibration (int16_t accel_data[3], int16_t gyro_data[3])
 Process static calibration with current sensor data.
 
void getStaticCalibrationOffsets (int16_t accel_offset[3], int16_t gyro_offset[3])
 Get static calibration offsets.
 
void resetStaticCalibration ()
 Reset static calibration.
 
void enableDynamicGyroCalibration (bool enable)
 Enable dynamic gyroscope calibration.
 
bool isDynamicGyroCalibrationEnabled () const
 Check if dynamic gyro calibration is enabled.
 
void getDynamicGyroCalibrationOffsets (int16_t gyro_offset[3])
 Get dynamic gyroscope calibration offsets.
 
void processDynamicCalibration (int16_t accel_data[3], int16_t gyro_data[3])
 Process dynamic calibration with current sensor data.
 
bool hardwareSelfTest (bool includeAccel=true, bool includeGyro=true)
 Perform hardware self-test on both sensors.
 
void getHardwareSelfTestResults (float accel_result[3], float gyro_result[3])
 Get hardware self-test results.
 
 SensorQMI8658 ()=default
 Constructor for SensorQMI8658.
 
 ~SensorQMI8658 ()
 Destructor for SensorQMI8658.
 
void setPins (int _irq)
 Set sensor interrupt pins.
 
bool reset (bool waitResult=true, uint32_t timeout=500)
 Reset the sensor.
 
uint8_t getChipID ()
 Get the chip ID.
 
int whoAmI ()
 Get the WHO_AM_I register value.
 
uint32_t getTimestamp ()
 Get the timestamp.
 
float getTemperature_C ()
 Get the temperature in degree Celsius.
 
void enableINT (IntPin pin, bool enable=true)
 Enable or disable the interrupt.
 
uint8_t getIrqStatus ()
 Get the IRQ status.
 
void enableDataReadyINT (bool enable=true)
 Enable or disable the Data Ready interrupt.
 
bool configAccelerometer (AccelRange range, AccelODR odr, LpfMode lpfOdr=LPF_MODE_0)
 Configure the accelerometer.
 
bool configGyroscope (GyroRange range, GyroODR odr, LpfMode lpfOdr=LPF_MODE_0)
 Configure the gyroscope.
 
bool configFIFO (FIFO_Mode mode, FIFO_Samples samples=FIFO_SAMPLES_16, IntPin pin=INTERRUPT_PIN_DISABLE, uint8_t trigger_samples=16)
 Configure the FIFO.
 
uint16_t readFromFifo (IMUdata *acc, uint16_t accLength, IMUdata *gyro, uint16_t gyrLength)
 readFromFifo
 
bool enableAccelerometer ()
 Enable the accelerometer.
 
bool disableAccelerometer ()
 Disable the accelerometer.
 
bool isEnableAccelerometer ()
 Check if the accelerometer is enabled.
 
bool isEnableGyroscope ()
 Check if the gyroscope is enabled.
 
bool enableGyroscope ()
 Enable the gyroscope.
 
bool disableGyroscope ()
 Disable the gyroscope.
 
bool getAccelRaw (int16_t *rawBuffer)
 Get the raw accelerometer data.
 
bool getAccelerometer (float &x, float &y, float &z)
 Get the accelerometer data.
 
float getAccelerometerScales ()
 Get the accelerometer scales.
 
float getGyroscopeScales ()
 Get the gyroscope scales.
 
bool getGyroRaw (int16_t *rawBuffer)
 Get the raw gyroscope data.
 
bool getGyroscope (float &x, float &y, float &z)
 Get the raw gyroscope data.
 
bool getDataReady ()
 Check if new data is available.
 
bool enableSyncSampleMode ()
 Enable the synchronous sample mode.
 
bool disableSyncSampleMode ()
 Disable the synchronous sample mode.
 
bool enableLockingMechanism ()
 Enable the locking mechanism.
 
bool disableLockingMechanism ()
 Disable the locking mechanism.
 
void dumpCtrlRegister ()
 Dump the control register values.
 
void powerDown ()
 Power down the sensor.
 
void powerOn ()
 Power on the sensor.
 
int getStatusRegister ()
 Get the Pedometer counter.
 
int configActivityInterruptMap (IntPin pin)
 Config activity interrupt pin mapping.
 
bool configPedometer (uint16_t ped_sample_cnt, uint16_t ped_fix_peak2peak, uint16_t ped_fix_peak, uint16_t ped_time_up, uint8_t ped_time_low=0x14, uint8_t ped_time_cnt_entry=0x0A, uint8_t ped_fix_precision=0x00, uint8_t ped_sig_count=0x04)
 configPedometer
 
uint32_t getPedometerCounter ()
 Get the Pedometer counter.
 
bool clearPedometerCounter ()
 Clear the Pedometer counter.
 
bool enablePedometer (IntPin pin=INTERRUPT_PIN_DISABLE)
 enablePedometer
 
bool disablePedometer ()
 
bool configTap (uint8_t priority, uint8_t peakWindow, uint16_t tapWindow, uint16_t dTapWindow, float alpha, float gamma, float peakMagThr, float UDMThr)
 configTap
 
bool enableTap (IntPin pin=INTERRUPT_PIN_1)
 Enable tap detection.
 
bool disableTap ()
 Disable tap detection.
 
TapEvent getTapStatus ()
 Get the current tap status.
 
bool configMotion (uint8_t modeCtrl, float AnyMotionXThr, float AnyMotionYThr, float AnyMotionZThr, uint8_t AnyMotionWindow, float NoMotionXThr, float NoMotionYThr, float NoMotionZThr, uint8_t NoMotionWindow, uint16_t SigMotionWaitWindow, uint16_t SigMotionConfirmWindow)
 
bool enableMotionDetect (IntPin pin=INTERRUPT_PIN_1)
 Enable motion detection.
 
bool disableMotionDetect ()
 Disable motion detection.
 
bool configWakeOnMotion (uint8_t WoMThreshold=200, AccelODR odr=ACC_ODR_LOWPOWER_128Hz, IntPin pin=INTERRUPT_PIN_2, uint8_t defaultPinValue=1, uint8_t blankingTime=0x20, AccelRange accRange=ACC_RANGE_8G)
 configWakeOnMotion
 
void getChipUsid (uint8_t *buffer, uint8_t length)
 Get Sensor chip USID.
 
uint32_t getChipFirmwareVersion ()
 Get Sensor chip firmware version.
 
uint16_t update ()
 Update sensor status.
 
void setWakeupMotionEventCallBack (EventCallBack_t cb)
 
void setTapEventCallBack (EventCallBack_t cb)
 
void setPedometerEventCallBack (EventCallBack_t cb)
 
void setNoMotionEventCallBack (EventCallBack_t cb)
 
void setAnyMotionEventCallBack (EventCallBack_t cb)
 
void setSignificantMotionEventCallBack (EventCallBack_t cb)
 
void setGyroDataReadyCallBack (EventCallBack_t cb)
 
void setAccelDataReadyEventCallBack (EventCallBack_t cb)
 
void setDataLockingEventCallBack (EventCallBack_t cb)
 
bool calibration (uint16_t *gX_gain=NULL, uint16_t *gY_gain=NULL, uint16_t *gZ_gain=NULL)
 Set Gyroscope calibration gains.
 
bool writeCalibration (uint16_t gX_gain, uint16_t gY_gain, uint16_t gZ_gain)
 Write Gyroscope calibration gains.
 
bool selfTestAccel ()
 Perform self-test on the accelerometer.
 
bool selfTestGyro ()
 Perform self-test on the gyroscope.
 
void setAccelOffset (int16_t offset_x, int16_t offset_y, int16_t offset_z)
 Write accelerometer calibration offsets.
 
void setGyroOffset (int16_t offset_x, int16_t offset_y, int16_t offset_z)
 Write gyroscope calibration offsets.
 
- Public Member Functions inherited from ComplexDeviceWithHal
bool begin (CommInterface interface, SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr=0)
 Initialize the sensor using custom callback interface.
 
- Public Member Functions inherited from DeviceBeginCommon
virtual ~DeviceBeginCommon ()
 
uint8_t getAddress () const
 
uint8_t getInterface () const
 
- Public Member Functions inherited from SensorCommWrapper
 SensorCommWrapper ()=default
 
int readReg (uint8_t reg) const
 
int readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const
 
int readBuff (uint8_t *buf, size_t len) const
 
int writeReg (uint8_t reg, uint8_t val)
 
int writeRegBuff (uint8_t reg, uint8_t *buf, size_t len)
 
int writeBuff (uint8_t *buf, size_t len)
 
int writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len)
 
bool setRegBit (uint8_t reg, uint8_t bit)
 
bool clrRegBit (uint8_t reg, uint8_t bit)
 
bool getRegBit (uint8_t reg, uint8_t bit)
 
int updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted)
 
void setAddress (uint8_t address)
 
void setAck (bool enable)
 
- Public Member Functions inherited from SensorCommInterface
virtual ~SensorCommInterface ()=default
 
- Public Member Functions inherited from ImuBase
virtual ~ImuBase ()=default
 
bool powerOn ()
 Compatibility wrapper: switch IMU to NORMAL mode.
 
bool powerDown ()
 Compatibility wrapper: switch IMU to SUSPEND mode.
 
- Public Member Functions inherited from ComplexStaticDeviceWithHal
bool begin (CommInterface interface, SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr=0)
 Initialize the sensor using custom callback interface.
 

Protected Member Functions

bool initImpl (uint8_t param) override
 
int writeCommand (uint8_t cmd, uint32_t timeout_ms=1000)
 
uint8_t mgToBytes (float mg)
 
uint8_t getAccelRangeRegValue (AccelFullScaleRange range)
 
uint8_t getGyroRangeRegValue (GyroFullScaleRange range)
 
float getAccelScaleFromRange (AccelFullScaleRange range)
 
float getGyroScaleFromRange (GyroFullScaleRange range)
 
bool applyMotionConfig ()
 
float odrToFloat (float odr)
 
uint8_t findClosestAccelOdr (float hz)
 
uint8_t findClosestGyroOdr (float hz)
 
uint8_t findClosestAccelLpOdr (float hz)
 
bool initImpl (uint8_t param) override
 
- Protected Member Functions inherited from ComplexDeviceWithHal
bool ensureValid () const override
 Ensure the communication interface is valid.
 
- Protected Member Functions inherited from DeviceBeginCommon
 DeviceBeginCommon ()=default
 
virtual SensorCommBasegetComm () const override
 
virtual void beforeBegin ()
 
virtual void afterCommReady ()
 
virtual void afterInitSuccess (uint8_t param)
 
virtual void onBeginFail ()
 
bool fail ()
 
void clearCommState ()
 
template<typename CreateComm >
bool beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm)
 
- Protected Member Functions inherited from ComplexStaticDeviceWithHal
bool ensureValid () const override
 Ensure the communication interface is valid.
 

Protected Attributes

AccelFullScaleRange _accel_range
 
GyroFullScaleRange _gyro_range
 
float _accel_scale
 
float _gyro_scale
 
float _accel_odr
 
float _gyro_odr
 
bool _motion_any_configured
 
bool _motion_no_configured
 
bool _motion_sig_configured
 
uint8_t _motion_any_thr [3]
 
uint8_t _motion_no_thr [3]
 
uint8_t _motion_any_window
 
uint8_t _motion_no_window
 
uint16_t _motion_sig_wait_window
 
uint16_t _motion_sig_confirm_window
 
bool _accel_enabled = false
 
bool _gyro_enabled = false
 
bool _sync_mode
 
bool _fifo_enabled
 
uint8_t _fifo_mode = 0x00
 
uint8_t _fifo_watermark
 
int _int_pin
 
uint8_t _int_pin_mask
 
bool _int_enabled
 
uint32_t _last_step_count
 
bool _tap_event_active
 
TapEvent _last_tap_event
 
uint32_t _last_tap_event_ms
 
uint32_t _last_timestamp
 
uint32_t _firmware_version
 
uint8_t _usid [6]
 
EventCallbacks callbacks
 
uint8_t * _fifo_buffer
 
uint16_t _fifo_buffer_size
 
Layout _axis_layout
 
uint16_t _static_cali_sample_count
 
bool _static_cali_enabled
 
bool _static_cali_complete
 
int32_t _accel_cali_sum [3]
 
int32_t _gyro_cali_sum [3]
 
int16_t _accel_cali_offset [3]
 
int16_t _gyro_cali_offset [3]
 
bool _dyn_cal_enabled
 
float _gyro_speed_buffer [DYN_CAL_BUFFER_SIZE]
 
float _accel_speed_buffer [DYN_CAL_BUFFER_SIZE]
 
int16_t _dyn_gyro_offset [3]
 
uint32_t _dyn_static_delay
 
uint8_t _dyn_static_flag
 
uint8_t _dyn_cali_sample_count
 
int32_t _dyn_gyro_sum [3]
 
float _gyro_static_deviation
 
float _accel_static_deviation
 
uint8_t _dyn_offset_applied
 
float _hw_st_accel_result [3]
 
float _hw_st_gyro_result [3]
 
- Protected Attributes inherited from DeviceBeginCommon
std::unique_ptr< SensorCommBasecomm
 
std::unique_ptr< SensorHalhal
 
std::unique_ptr< SensorCommStaticstaticComm
 
uint8_t _addr = 0
 
uint8_t _iface = COMM_CUSTOM
 

Static Protected Attributes

static constexpr uint8_t STATUS_TAP_EVENT = sensorlib::_bv(1)
 
static constexpr uint8_t STATUS_WOM_EVENT = sensorlib::_bv(2)
 
static constexpr uint8_t STATUS_PEDOMETER_EVENT = sensorlib::_bv(4)
 
static constexpr uint8_t STATUS_ANY_MOTION_EVENT = sensorlib::_bv(5)
 
static constexpr uint8_t STATUS_NO_MOTION_EVENT = sensorlib::_bv(6)
 
static constexpr uint8_t STATUS_SIGNIFICANT_MOTION = sensorlib::_bv(7)
 
static constexpr uint16_t MAX_STATIC_CALI_SAMPLES = 100
 
static constexpr uint8_t DYN_CAL_BUFFER_SIZE = 10
 
static constexpr uint8_t DYN_CAL_STATIC_COUNT = 12
 
static constexpr float HW_ST_ACCEL_THRESHOLD_MG = 200.0f
 
static constexpr float HW_ST_GYRO_THRESHOLD_DPS = 300.0f
 
static constexpr uint8_t QMI8658_REG_WHOAMI_DEFAULT = 0x05
 
static constexpr uint8_t QMI8658_REG_STATUS_DEFAULT = 0x03
 
static constexpr uint8_t QMI8658_REG_RESET_DEFAULT = 0xB0
 
static constexpr uint8_t QMI8658_REG_WHOAMI = 0x00
 
static constexpr uint8_t QMI8658_REG_REVISION = 0x01
 
static constexpr uint8_t QMI8658_REG_CTRL1 = 0x02
 
static constexpr uint8_t QMI8658_REG_CTRL2 = 0x03
 
static constexpr uint8_t QMI8658_REG_CTRL3 = 0x04
 
static constexpr uint8_t QMI8658_REG_CTRL5 = 0x06
 
static constexpr uint8_t QMI8658_REG_CTRL7 = 0x08
 
static constexpr uint8_t QMI8658_REG_CTRL8 = 0x09
 
static constexpr uint8_t QMI8658_REG_CTRL9 = 0x0A
 
static constexpr uint8_t QMI8658_REG_CAL1_L = 0x0B
 
static constexpr uint8_t QMI8658_REG_CAL1_H = 0x0C
 
static constexpr uint8_t QMI8658_REG_CAL2_L = 0x0D
 
static constexpr uint8_t QMI8658_REG_CAL2_H = 0x0E
 
static constexpr uint8_t QMI8658_REG_CAL3_L = 0x0F
 
static constexpr uint8_t QMI8658_REG_CAL3_H = 0x10
 
static constexpr uint8_t QMI8658_REG_CAL4_L = 0x11
 
static constexpr uint8_t QMI8658_REG_CAL4_H = 0x12
 
static constexpr uint8_t QMI8658_REG_FIFO_WTM_TH = 0x13
 
static constexpr uint8_t QMI8658_REG_FIFO_CTRL = 0x14
 
static constexpr uint8_t QMI8658_REG_FIFO_COUNT = 0x15
 
static constexpr uint8_t QMI8658_REG_FIFO_STATUS = 0x16
 
static constexpr uint8_t QMI8658_REG_FIFO_DATA = 0x17
 
static constexpr uint8_t QMI8658_REG_STATUS_INT = 0x2D
 
static constexpr uint8_t QMI8658_REG_STATUS0 = 0x2E
 
static constexpr uint8_t QMI8658_REG_STATUS1 = 0x2F
 
static constexpr uint8_t QMI8658_REG_TIMESTAMP_L = 0x30
 
static constexpr uint8_t QMI8658_REG_TIMESTAMP_M = 0x31
 
static constexpr uint8_t QMI8658_REG_TIMESTAMP_H = 0x32
 
static constexpr uint8_t QMI8658_REG_TEMPERATURE_L = 0x33
 
static constexpr uint8_t QMI8658_REG_TEMPERATURE_H = 0x34
 
static constexpr uint8_t QMI8658_REG_AX_L = 0x35
 
static constexpr uint8_t QMI8658_REG_AX_H = 0x36
 
static constexpr uint8_t QMI8658_REG_AY_L = 0x37
 
static constexpr uint8_t QMI8658_REG_AY_H = 0x38
 
static constexpr uint8_t QMI8658_REG_AZ_L = 0x39
 
static constexpr uint8_t QMI8658_REG_AZ_H = 0x3A
 
static constexpr uint8_t QMI8658_REG_GX_L = 0x3B
 
static constexpr uint8_t QMI8658_REG_GX_H = 0x3C
 
static constexpr uint8_t QMI8658_REG_GY_L = 0x3D
 
static constexpr uint8_t QMI8658_REG_GY_H = 0x3E
 
static constexpr uint8_t QMI8658_REG_GZ_L = 0x3F
 
static constexpr uint8_t QMI8658_REG_GZ_H = 0x40
 
static constexpr uint8_t QMI8658_REG_COD_STATUS = 0x46
 
static constexpr uint8_t QMI8658_REG_DQW_L = 0x49
 
static constexpr uint8_t QMI8658_REG_DQW_H = 0x4A
 
static constexpr uint8_t QMI8658_REG_DQX_L = 0x4B
 
static constexpr uint8_t QMI8658_REG_DQX_H = 0x4C
 
static constexpr uint8_t QMI8658_REG_DQY_L = 0x4D
 
static constexpr uint8_t QMI8658_REG_DQY_H = 0x4E
 
static constexpr uint8_t QMI8658_REG_DQZ_L = 0x4F
 
static constexpr uint8_t QMI8658_REG_DQZ_H = 0x50
 
static constexpr uint8_t QMI8658_REG_DVX_L = 0x51
 
static constexpr uint8_t QMI8658_REG_DVX_H = 0x52
 
static constexpr uint8_t QMI8658_REG_DVY_L = 0x53
 
static constexpr uint8_t QMI8658_REG_DVY_H = 0x54
 
static constexpr uint8_t QMI8658_REG_DVZ_L = 0x55
 
static constexpr uint8_t QMI8658_REG_DVZ_H = 0x56
 
static constexpr uint8_t QMI8658_REG_TAP_STATUS = 0x59
 
static constexpr uint8_t QMI8658_REG_STEP_CNT_LOW = 0x5A
 
static constexpr uint8_t QMI8658_REG_STEP_CNT_MID = 0x5B
 
static constexpr uint8_t QMI8658_REG_STEP_CNT_HIGH = 0x5C
 
static constexpr uint8_t QMI8658_REG_RESET = 0x60
 
static constexpr uint8_t QMI8658_REG_RST_RESULT = 0x4D
 
static constexpr uint8_t QMI8658_REG_RST_RESULT_VAL = 0x80
 
static constexpr uint8_t STATUS0_ACCEL_AVAIL = 0x01
 
static constexpr uint8_t STATUS0_GYRO_AVAIL = 0x02
 
static constexpr uint8_t QMI8658_ACCEL_LPF_MASK = 0xF9
 
static constexpr uint8_t QMI8658_GYRO_LPF_MASK = 0x9F
 
static constexpr uint8_t QMI8658_ACCEL_EN_MASK = 0x01
 
static constexpr uint8_t QMI8658_GYRO_EN_MASK = 0x02
 
static constexpr uint8_t QMI8658_ACCEL_GYRO_EN_MASK = 0x03
 
static constexpr uint8_t QMI8658_FIFO_MAP_INT1 = 0x04
 

Detailed Description

QMI8658 IMU sensor driver class.

Definition at line 45 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Member Typedef Documentation

◆ DataReadyCallback

using SensorQMI8658::DataReadyCallback = std::function<void()>

Callback function type for data ready events.

Definition at line 199 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ EventCallBack_t

typedef void(* SensorQMI8658::EventCallBack_t) (void)

Definition at line 52 of file SensorQMI8658.hpp.

◆ IntPin

◆ MotionCallback

using SensorQMI8658::MotionCallback = std::function<void()>

Callback function type for motion events.

Definition at line 189 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ TapCallback

using SensorQMI8658::TapCallback = std::function<void(TapEvent event)>

Callback function type for tap events.

Definition at line 194 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ TapEvent

Member Enumeration Documentation

◆ AccelODR [1/2]

enum class SensorQMI8658::AccelODR : uint8_t
strong

Accelerometer output data rate enumeration.

Enumerator
ODR_7Hz 

7 Hz

ODR_14Hz 

14 Hz

ODR_28Hz 

28 Hz

ODR_56Hz 

56 Hz

ODR_112Hz 

112 Hz

ODR_224Hz 

224 Hz

ODR_448Hz 

448 Hz

ODR_896Hz 

896 Hz

ODR_1792Hz 

1792 Hz

ODR_3584Hz 

3584 Hz

ODR_7168Hz 

7168 Hz

ODR_LP_3Hz 

Low power 3 Hz.

ODR_LP_11Hz 

Low power 11 Hz.

ODR_LP_21Hz 

Low power 21 Hz.

ODR_LP_128Hz 

Low power 128 Hz.

ACC_ODR_1000Hz 
ACC_ODR_500Hz 
ACC_ODR_250Hz 
ACC_ODR_125Hz 
ACC_ODR_62_5Hz 
ACC_ODR_31_25Hz 
ACC_ODR_LOWPOWER_128Hz 
ACC_ODR_LOWPOWER_21Hz 
ACC_ODR_LOWPOWER_11Hz 
ACC_ODR_LOWPOWER_3Hz 

Definition at line 62 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ AccelODR [2/2]

Enumerator
ODR_7Hz 

7 Hz

ODR_14Hz 

14 Hz

ODR_28Hz 

28 Hz

ODR_56Hz 

56 Hz

ODR_112Hz 

112 Hz

ODR_224Hz 

224 Hz

ODR_448Hz 

448 Hz

ODR_896Hz 

896 Hz

ODR_1792Hz 

1792 Hz

ODR_3584Hz 

3584 Hz

ODR_7168Hz 

7168 Hz

ODR_LP_3Hz 

Low power 3 Hz.

ODR_LP_11Hz 

Low power 11 Hz.

ODR_LP_21Hz 

Low power 21 Hz.

ODR_LP_128Hz 

Low power 128 Hz.

Definition at line 73 of file SensorQMI8658.hpp.

◆ AccelRange [1/2]

enum class SensorQMI8658::AccelRange : uint8_t
strong

Accelerometer full-scale range enumeration.

Enumerator
FS_2G 

±2g range

FS_4G 

±4g range

FS_8G 

±8g range

FS_16G 

±16g range

ACC_RANGE_2G 
ACC_RANGE_4G 
ACC_RANGE_8G 
ACC_RANGE_16G 

Definition at line 52 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ AccelRange [2/2]

Enumerator
FS_2G 

±2g range

FS_4G 

±4g range

FS_8G 

±8g range

FS_16G 

±16g range

Definition at line 54 of file SensorQMI8658.hpp.

◆ CommandTable

Enumerator
CTRL_CMD_ACK 
CTRL_CMD_RST_FIFO 
CTRL_CMD_REQ_FIFO 
CTRL_CMD_WRITE_WOM_SETTING 
CTRL_CMD_ACCEL_HOST_DELTA_OFFSET 
CTRL_CMD_GYRO_HOST_DELTA_OFFSET 
CTRL_CMD_CONFIGURE_TAP 
CTRL_CMD_CONFIGURE_PEDOMETER 
CTRL_CMD_CONFIGURE_MOTION 
CTRL_CMD_RESET_PEDOMETER 
CTRL_CMD_COPY_USID 
CTRL_CMD_SET_RPU 
CTRL_CMD_AHB_CLOCK_GATING 
CTRL_CMD_ON_DEMAND_CALIBRATION 
CTRL_CMD_APPLY_GYRO_GAINS 

Definition at line 151 of file SensorQMI8658.hpp.

◆ FIFO_Mode

Enumerator
FIFO_MODE_BYPASS 
FIFO_MODE_FIFO 
FIFO_MODE_STREAM 

Definition at line 134 of file SensorQMI8658.hpp.

◆ FIFO_Samples

Enumerator
FIFO_SAMPLES_16 
FIFO_SAMPLES_32 
FIFO_SAMPLES_64 
FIFO_SAMPLES_128 

Definition at line 127 of file SensorQMI8658.hpp.

◆ FifoMode

enum class SensorQMI8658::FifoMode : uint8_t
strong

FIFO mode enumeration.

Enumerator
BYPASS 

Bypass mode (FIFO disabled)

FIFO 

FIFO mode (stops when full)

STREAM 

Stream mode (overwrites oldest)

Definition at line 125 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ FifoSamples

enum class SensorQMI8658::FifoSamples : uint8_t
strong

FIFO sample count enumeration.

Enumerator
SAMPLES_16 

16 samples

SAMPLES_32 

32 samples

SAMPLES_64 

64 samples

SAMPLES_128 

128 samples

Definition at line 134 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ GyroODR [1/2]

enum class SensorQMI8658::GyroODR : uint8_t
strong

Gyroscope output data rate enumeration.

Enumerator
ODR_7Hz 

7 Hz

ODR_14Hz 

14 Hz

ODR_28Hz 

28 Hz

ODR_56Hz 

56 Hz

ODR_112Hz 

112 Hz

ODR_224Hz 

224 Hz

ODR_448Hz 

448 Hz

ODR_896Hz 

896 Hz

ODR_1792Hz 

1792 Hz

ODR_3584Hz 

3584 Hz

ODR_7168Hz 

7168 Hz

GYR_ODR_7174_4Hz 
GYR_ODR_3587_2Hz 
GYR_ODR_1793_6Hz 
GYR_ODR_896_8Hz 
GYR_ODR_448_4Hz 
GYR_ODR_224_2Hz 
GYR_ODR_112_1Hz 
GYR_ODR_56_05Hz 
GYR_ODR_28_025Hz 

Definition at line 97 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ GyroODR [2/2]

Enumerator
ODR_7Hz 

7 Hz

ODR_14Hz 

14 Hz

ODR_28Hz 

28 Hz

ODR_56Hz 

56 Hz

ODR_112Hz 

112 Hz

ODR_224Hz 

224 Hz

ODR_448Hz 

448 Hz

ODR_896Hz 

896 Hz

ODR_1792Hz 

1792 Hz

ODR_3584Hz 

3584 Hz

ODR_7168Hz 

7168 Hz

Definition at line 86 of file SensorQMI8658.hpp.

◆ GyroRange [1/2]

enum class SensorQMI8658::GyroRange : uint8_t
strong

Gyroscope full-scale range enumeration.

Enumerator
FS_16DPS 

±16 degrees per second

FS_32DPS 

±32 degrees per second

FS_64DPS 

±64 degrees per second

FS_128DPS 

±128 degrees per second

FS_256DPS 

±256 degrees per second

FS_512DPS 

±512 degrees per second

FS_1024DPS 

±1024 degrees per second

FS_2048DPS 

±2048 degrees per second

GYR_RANGE_16DPS 
GYR_RANGE_32DPS 
GYR_RANGE_64DPS 
GYR_RANGE_128DPS 
GYR_RANGE_256DPS 
GYR_RANGE_512DPS 
GYR_RANGE_1024DPS 

Definition at line 83 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ GyroRange [2/2]

Enumerator
FS_16DPS 

±16 degrees per second

FS_32DPS 

±32 degrees per second

FS_64DPS 

±64 degrees per second

FS_128DPS 

±128 degrees per second

FS_256DPS 

±256 degrees per second

FS_512DPS 

±512 degrees per second

FS_1024DPS 

±1024 degrees per second

FS_2048DPS 

±2048 degrees per second

Definition at line 61 of file SensorQMI8658.hpp.

◆ IntPin

Enumerator
INTERRUPT_PIN_1 
INTERRUPT_PIN_2 
INTERRUPT_PIN_DISABLE 

Definition at line 121 of file SensorQMI8658.hpp.

◆ Layout

enum class SensorQMI8658::Layout : uint8_t
strong

Sensor axis layout enumeration for coordinate transformation.

Different mounting orientations require different axis mappings. Layout values 0-3: Z-axis pointing up Layout values 4-7: Z-axis pointing down Even layouts (0,2,4,6): X-Y axis not swapped Odd layouts (1,3,5,7): X-Y axis swapped Second group (2,3,6,7): X-axis inverted Third group (1,3,5,7): Y-axis inverted

Enumerator
LAYOUT_DEFAULT 

Default orientation: X=right, Y=forward, Z=up.

LAYOUT_ROTATE_90 

Rotated 90 degrees: X=forward, Y=left, Z=up.

LAYOUT_ROTATE_180 

Rotated 180 degrees: X=left, Y=backward, Z=up.

LAYOUT_ROTATE_270 

Rotated 270 degrees: X=backward, Y=right, Z=up.

LAYOUT_FLIP_Z 

Flipped: X=right, Y=backward, Z=down.

LAYOUT_FLIP_Z_90 

Flipped + 90: X=backward, Y=left, Z=down.

LAYOUT_FLIP_Z_180 

Flipped + 180: X=left, Y=forward, Z=down.

LAYOUT_FLIP_Z_270 

Flipped + 270: X=forward, Y=right, Z=down.

Definition at line 175 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ LpfMode [1/2]

enum class SensorQMI8658::LpfMode : uint8_t
strong

Low-pass filter mode enumeration.

Enumerator
MODE_0 

2.66% of output data rate

MODE_1 

3.63% of output data rate

MODE_2 

5.39% of output data rate

MODE_3 

13.37% of output data rate

OFF 

Disable low-pass filter.

LPF_MODE_0 
LPF_MODE_1 
LPF_MODE_2 
LPF_MODE_3 
LPF_OFF 

Definition at line 114 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ LpfMode [2/2]

Enumerator
MODE_0 

2.66% of output data rate

MODE_1 

3.63% of output data rate

MODE_2 

5.39% of output data rate

MODE_3 

13.37% of output data rate

OFF 

Disable low-pass filter.

Definition at line 105 of file SensorQMI8658.hpp.

◆ MotionCtrl

Enumerator
ANY_MOTION_EN_X 
ANY_MOTION_EN_Y 
ANY_MOTION_EN_Z 
ANY_MOTION_LOGIC_AND 
NO_MOTION_EN_X 
NO_MOTION_EN_Y 
NO_MOTION_EN_Z 
NO_MOTION_LOGIC_OR 

Definition at line 201 of file SensorQMI8658.hpp.

◆ MotionEvent

Enumerator
MOTION_TAP 
MOTION_ANT_MOTION 
MOTION_NO_MOTION 
MOTION_SIGNIFICANT 
MOTION_PEDOMETER 

Definition at line 113 of file SensorQMI8658.hpp.

◆ MotionType

enum class SensorQMI8658::MotionType : uint8_t
strong

Motion detection type enumeration.

Enumerator
ANY_MOTION 

Any motion detection.

NO_MOTION 

No motion detection.

SIGNIFICANT 

Significant motion detection.

Definition at line 159 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

◆ SampleMode

Enumerator
SYNC_MODE 
ASYNC_MODE 

Definition at line 146 of file SensorQMI8658.hpp.

◆ SensorStatus

Enumerator
STATUS_INT_CTRL9_CMD_DONE 
STATUS_INT_LOCKED 
STATUS_INT_AVAIL 
STATUS0_GYRO_DATA_READY 
STATUS0_ACCEL_DATA_READY 
STATUS1_SIGNIFICANT_MOTION 
STATUS1_NO_MOTION 
STATUS1_ANY_MOTION 
STATUS1_PEDOMETER_MOTION 
STATUS1_WOM_MOTION 
STATUS1_TAP_MOTION 

Definition at line 178 of file SensorQMI8658.hpp.

◆ StatusReg

Enumerator
EVENT_SIGNIFICANT_MOTION 
EVENT_NO_MOTION 
EVENT_ANY_MOTION 
EVENT_PEDOMETER_MOTION 
EVENT_WOM_MOTION 
EVENT_TAP_MOTION 

Definition at line 169 of file SensorQMI8658.hpp.

◆ TapDetectionPriority

Enumerator
PRIORITY0 
PRIORITY1 
PRIORITY2 
PRIORITY3 
PRIORITY4 
PRIORITY5 

Definition at line 192 of file SensorQMI8658.hpp.

◆ TapEvent

Enumerator
INVALID_TAP 
SINGLE_TAP 
DOUBLE_TAP 

Definition at line 98 of file SensorQMI8658.hpp.

◆ TapPriority

enum class SensorQMI8658::TapPriority : uint8_t
strong

Tap detection axis priority enumeration.

Enumerator
X_GT_Y_GT_Z 

X > Y > Z.

X_GT_Z_GT_Y 

X > Z > Y.

Y_GT_X_GT_Z 

Y > X > Z.

Y_GT_Z_GT_X 

Y > Z > X.

Z_GT_X_GT_Y 

Z > X > Y.

Z_GT_Y_GT_X 

Z > Y > X.

Definition at line 147 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Constructor & Destructor Documentation

◆ SensorQMI8658() [1/2]

◆ ~SensorQMI8658() [1/2]

SensorQMI8658::~SensorQMI8658 ( )
override

Destroy the SensorQMI8658 object.

Definition at line 256 of file SensorQMI8658.cpp.

References _fifo_buffer, and _fifo_buffer_size.

◆ SensorQMI8658() [2/2]

SensorQMI8658::SensorQMI8658 ( )
default

Constructor for SensorQMI8658.

Note
This function initializes the SensorQMI8658 object.
Return values
None

◆ ~SensorQMI8658() [2/2]

SensorQMI8658::~SensorQMI8658 ( )
inline

Destructor for SensorQMI8658.

Note
This function cleans up the resources used by the SensorQMI8658 object.
Return values
None

Definition at line 230 of file SensorQMI8658.hpp.

Member Function Documentation

◆ applyMotionConfig()

◆ axisConvert()

void SensorQMI8658::axisConvert ( int16_t  accel_data[3],
int16_t  gyro_data[3] 
)

Apply axis conversion to raw sensor data.

Parameters
[in,out]accel_accelAccel data array [x, y, z].
[in,out]gyro_dataGyro data array [x, y, z].

Definition at line 2088 of file SensorQMI8658.cpp.

References _axis_layout.

Referenced by readGyro().

◆ calibrate()

bool SensorQMI8658::calibrate ( uint16_t *  gyro_x_gain = nullptr,
uint16_t *  gyro_y_gain = nullptr,
uint16_t *  gyro_z_gain = nullptr 
)

Perform on-demand calibration.

Parameters
[out]gyro_x_gainOptional output for X-axis gyro gain.
[out]gyro_y_gainOptional output for Y-axis gyro gain.
[out]gyro_z_gainOptional output for Z-axis gyro gain.
Returns
true if calibration successful, false otherwise.

Definition at line 1111 of file SensorQMI8658.cpp.

References _accel_enabled, _gyro_enabled, CTRL_CMD_ON_DEMAND_CALIBRATION, disableAccel(), disableGyro(), DeviceBeginCommon::hal, SensorCommWrapper::readReg(), SensorCommWrapper::readRegBuff(), SENSORLIB_LOG_E, and writeCommand().

Referenced by setup().

◆ calibration()

bool SensorQMI8658::calibration ( uint16_t *  gX_gain = NULL,
uint16_t *  gY_gain = NULL,
uint16_t *  gZ_gain = NULL 
)
inline

Set Gyroscope calibration gains.

Note
This function sets the calibration gains for the gyroscope
Parameters
*gX_gainPointer to the gain value for the X axis
*gY_gainPointer to the gain value for the Y axis
*gZ_gainPointer to the gain value for the Z axis
Return values
Trueif successful, false otherwise

Definition at line 1718 of file SensorQMI8658.hpp.

References sensorlib::_bv(), DeviceBeginCommon::comm, CTRL_CMD_ON_DEMAND_CALIBRATION, DeviceBeginCommon::hal, QMI8658_REG_COD_STATUS, QMI8658_REG_CTRL7, QMI8658_REG_DVX_L, SENSORLIB_LOG_D, SENSORLIB_LOG_E, and writeCommand().

Referenced by setup().

◆ clearPedometerCounter()

bool SensorQMI8658::clearPedometerCounter ( )
inline

Clear the Pedometer counter.

Note
This function will reset the Pedometer step count to zero
Return values
Trueon success, false on failure

Definition at line 1119 of file SensorQMI8658.hpp.

References CTRL_CMD_RESET_PEDOMETER, and writeCommand().

◆ configAccel() [1/3]

bool SensorQMI8658::configAccel ( AccelFullScaleRange  range,
float  data_rate_hz,
LpfMode  lpf = LpfMode::MODE_0 
)

Configure the accelerometer with specified parameters.

Parameters
rangeFull-scale range.
odrOutput data rate.
lpfLow-pass filter mode (default: MODE_0).
Note
If accelerometer and gyroscope are both enabled (6DOF), the effective synchronized ODR base is derived from gyroscope natural frequency.
Returns
true if configuration successful, false otherwise.

Definition at line 636 of file SensorQMI8658.cpp.

References _accel_enabled, _accel_odr, _accel_range, _accel_scale, SensorCommWrapper::clrRegBit(), disableAccel(), enableAccel(), findClosestAccelOdr(), getAccelRangeRegValue(), getAccelScaleFromRange(), OFF, SensorCommWrapper::setRegBit(), SensorCommWrapper::updateBits(), and SensorCommWrapper::writeReg().

Referenced by configAccel(), configAccel(), and setup().

◆ configAccel() [2/3]

bool SensorQMI8658::configAccel ( AccelRange  range,
AccelODR  odr,
LpfMode  lpf = LpfMode::MODE_0 
)

Definition at line 1536 of file SensorQMI8658.cpp.

References configAccel(), FS_16G, FS_16G, FS_2G, FS_2G, FS_4G, FS_4G, FS_8G, and FS_8G.

◆ configAccel() [3/3]

bool SensorQMI8658::configAccel ( AccelRange  range,
float  data_rate_hz,
LpfMode  lpf = LpfMode::MODE_0 
)

Definition at line 1556 of file SensorQMI8658.cpp.

References configAccel(), FS_16G, FS_16G, FS_2G, FS_2G, FS_4G, FS_4G, FS_8G, and FS_8G.

◆ configAccelerometer()

bool SensorQMI8658::configAccelerometer ( AccelRange  range,
AccelODR  odr,
LpfMode  lpfOdr = LPF_MODE_0 
)
inline

Configure the accelerometer.

Parameters
rangeAccelerometer range setting
odrAccelerometer output data rate setting
lpfOdrAccelerometer low-pass filter setting
Return values
trueon success, false on failure

Definition at line 385 of file SensorQMI8658.hpp.

References ACC_RANGE_16G, ACC_RANGE_2G, ACC_RANGE_4G, ACC_RANGE_8G, DeviceBeginCommon::comm, disableAccelerometer(), enableAccelerometer(), isEnableAccelerometer(), LPF_OFF, QMI8658_ACCEL_LPF_MASK, QMI8658_REG_CTRL2, and QMI8658_REG_CTRL5.

Referenced by setup().

◆ configActivityInterruptMap()

int SensorQMI8658::configActivityInterruptMap ( IntPin  pin)
inline

Config activity interrupt pin mapping.

Parameters
pinInterrupt pin to map activity interrupt, see IntPin enum
Return values
trueon success, false on failure

Definition at line 1016 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, INTERRUPT_PIN_1, and QMI8658_REG_CTRL8.

Referenced by enableMotionDetect(), enablePedometer(), and enableTap().

◆ configFIFO()

bool SensorQMI8658::configFIFO ( FIFO_Mode  mode,
FIFO_Samples  samples = FIFO_SAMPLES_16,
IntPin  pin = INTERRUPT_PIN_DISABLE,
uint8_t  trigger_samples = 16 
)
inline

Configure the FIFO.

Note
Call this function to configure FIFO before using readFromFifo function
Parameters
modeFIFO mode setting
samplesNumber of samples to store in FIFO
pinInterrupt pin to output FIFO watermark interrupt, see IntPin enum
trigger_samplesNumber of samples to trigger FIFO watermark interrupt
Return values
trueon success, false on failure

Definition at line 530 of file SensorQMI8658.hpp.

References _fifo_mode, DeviceBeginCommon::comm, CTRL_CMD_RST_FIFO, disableAccelerometer(), disableGyroscope(), enableAccelerometer(), enableGyroscope(), INTERRUPT_PIN_1, INTERRUPT_PIN_2, INTERRUPT_PIN_DISABLE, isEnableAccelerometer(), isEnableGyroscope(), QMI8658_REG_CTRL1, QMI8658_REG_FIFO_CTRL, QMI8658_REG_FIFO_WTM_TH, SENSORLIB_LOG_D, SENSORLIB_LOG_E, and writeCommand().

Referenced by loop(), and setup().

◆ configFifo()

bool SensorQMI8658::configFifo ( FifoMode  mode,
FifoSamples  samples = FifoSamples::SAMPLES_16,
uint8_t  watermark_samples = 16 
)

Configure FIFO with specified mode.

Parameters
modeFIFO mode.
Note
In Non-SyncSample mode, enabling FIFO (mode != BYPASS) disables DRDY function.
Parameters
samplesFIFO sample count.
watermark_samplesWatermark threshold.
Returns
true if configuration successful, false otherwise.

Definition at line 867 of file SensorQMI8658.cpp.

References _accel_enabled, _fifo_enabled, _fifo_mode, _fifo_watermark, _gyro_enabled, BYPASS, CTRL_CMD_RST_FIFO, disableAccel(), disableGyro(), enableAccel(), enableGyro(), resetFifo(), SAMPLES_128, SAMPLES_16, SAMPLES_32, SAMPLES_64, writeCommand(), and SensorCommWrapper::writeReg().

Referenced by setup().

◆ configGyro() [1/3]

bool SensorQMI8658::configGyro ( GyroFullScaleRange  range,
float  data_rate_hz,
LpfMode  lpf = LpfMode::MODE_0 
)

Configure the gyroscope with specified parameters.

Parameters
rangeFull-scale range.
odrOutput data rate.
lpfLow-pass filter mode (default: MODE_0).
Note
In 6DOF mode (ACC+GYR enabled), system ODR synchronization is derived from gyroscope natural frequency.
Returns
true if configuration successful, false otherwise.

Definition at line 668 of file SensorQMI8658.cpp.

References _gyro_enabled, _gyro_odr, _gyro_range, _gyro_scale, SensorCommWrapper::clrRegBit(), disableGyro(), enableGyro(), findClosestGyroOdr(), getGyroRangeRegValue(), getGyroScaleFromRange(), OFF, SensorCommWrapper::setRegBit(), SensorCommWrapper::updateBits(), and SensorCommWrapper::writeReg().

Referenced by configGyro(), configGyro(), and setup().

◆ configGyro() [2/3]

bool SensorQMI8658::configGyro ( GyroRange  range,
float  data_rate_hz,
LpfMode  lpf = LpfMode::MODE_0 
)

◆ configGyro() [3/3]

bool SensorQMI8658::configGyro ( GyroRange  range,
GyroODR  odr,
LpfMode  lpf = LpfMode::MODE_0 
)

◆ configGyroscope()

bool SensorQMI8658::configGyroscope ( GyroRange  range,
GyroODR  odr,
LpfMode  lpfOdr = LPF_MODE_0 
)
inline

Configure the gyroscope.

Note
Call this function to configure the gyroscope settings
Parameters
rangeGyroscope range setting
odrGyroscope output data rate setting
lpfOdrGyroscope low-pass filter setting
Return values
trueon success, false on failure

Definition at line 453 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, disableGyroscope(), enableGyroscope(), GYR_RANGE_1024DPS, GYR_RANGE_128DPS, GYR_RANGE_16DPS, GYR_RANGE_256DPS, GYR_RANGE_32DPS, GYR_RANGE_512DPS, GYR_RANGE_64DPS, isEnableGyroscope(), LPF_OFF, QMI8658_GYRO_LPF_MASK, QMI8658_REG_CTRL3, and QMI8658_REG_CTRL5.

Referenced by setup().

◆ configMotion()

bool SensorQMI8658::configMotion ( uint8_t  modeCtrl,
float  AnyMotionXThr,
float  AnyMotionYThr,
float  AnyMotionZThr,
uint8_t  AnyMotionWindow,
float  NoMotionXThr,
float  NoMotionYThr,
float  NoMotionZThr,
uint8_t  NoMotionWindow,
uint16_t  SigMotionWaitWindow,
uint16_t  SigMotionConfirmWindow 
)
inline

◆ configMotionDetect()

bool SensorQMI8658::configMotionDetect ( MotionType  type,
float  threshold_x,
float  threshold_y,
float  threshold_z,
uint8_t  duration 
)

Configure motion detection parameters.

Parameters
typeMotion detection type.
threshold_xX-axis threshold in mg.
threshold_yY-axis threshold in mg.
threshold_zZ-axis threshold in mg.
durationNumber of consecutive samples above/below threshold.
Returns
true if configuration successful, false otherwise.

Definition at line 1310 of file SensorQMI8658.cpp.

References _motion_any_configured, _motion_any_thr, _motion_any_window, _motion_no_configured, _motion_no_thr, _motion_no_window, _motion_sig_configured, _motion_sig_confirm_window, ANY_MOTION, applyMotionConfig(), mgToBytes(), NO_MOTION, and SIGNIFICANT.

Referenced by configMotionDetectDefault(), and setup().

◆ configMotionDetectDefault()

bool SensorQMI8658::configMotionDetectDefault ( MotionType  type)

Configure motion detection with default parameters.

Provides sensible defaults for motion detection based on type:

  • ANY_MOTION: 100mg threshold, 4 samples duration
  • NO_MOTION: 100mg threshold, 10 samples duration
  • SIGNIFICANT: 200mg threshold, 8 samples duration
    Parameters
    typeMotion detection type.
    Returns
    true if configuration successful, false otherwise.

Definition at line 1421 of file SensorQMI8658.cpp.

References ANY_MOTION, configMotionDetect(), NO_MOTION, and SIGNIFICANT.

Referenced by setup().

◆ configPedometer() [1/2]

bool SensorQMI8658::configPedometer ( uint16_t  ped_sample_cnt,
uint16_t  ped_fix_peak2peak,
uint16_t  ped_fix_peak,
uint16_t  ped_time_up,
uint8_t  ped_time_low = 0x14,
uint8_t  ped_time_cnt_entry = 0x0A,
uint8_t  ped_fix_precision = 0x00,
uint8_t  ped_sig_count = 0x04 
)
inline

configPedometer

Note
The calculation of the Pedometer Detection is based on the accelerometer ODR defined by CTRL2.aODR, refer to Table 22 for details.
Parameters
ped_sample_cntIndicates the count of sample batch/window for calculation
ped_fix_peak2peak:Indicatesthe threshold of the valid peak-to-peak detection E.g., 0x00CC means 200mg
ped_fix_peak:Indicatesthe threshold of the peak detection comparing to average E.g., 0x0066 means 100mg
ped_time_up:Indicatesthe maximum duration (timeout window) for a step. Reset counting calculation if no peaks detected within this duration. E.g., 80 means 1.6s @ ODR = 50Hz
ped_time_low:Indicatesthe minimum duration for a step. The peaks detected within this duration (quiet time) is ignored. E.g., 12 means 0.25s @ ODR = 50Hz
ped_time_cnt_entry:Indicatesthe minimum continuous steps to start the valid step counting. If the continuously detected steps is lower than this count and timeout, the steps will not be take into account; if yes, the detected steps will all be taken into account and counting is started to count every following step before timeout. This is useful to screen out the fake steps detected by non-step vibrations The timeout duration is defined by ped_time_up. E.g., 10 means 10 steps entry count
ped_fix_precision:0is recommended
ped_sig_countThe amount of steps when to update the pedometer output registers. E.g., ped_sig_count = 4, every 4 valid steps is detected, update the registers once (added by 4).
Return values

Definition at line 1050 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, CTRL_CMD_CONFIGURE_PEDOMETER, disableAccelerometer(), disableGyroscope(), disableSyncSampleMode(), enableAccelerometer(), enableGyroscope(), isEnableAccelerometer(), isEnableGyroscope(), QMI8658_REG_CAL1_H, QMI8658_REG_CAL1_L, QMI8658_REG_CAL2_H, QMI8658_REG_CAL2_L, QMI8658_REG_CAL3_H, QMI8658_REG_CAL3_L, QMI8658_REG_CAL4_H, QMI8658_REG_CAL4_L, and writeCommand().

◆ configPedometer() [2/2]

bool SensorQMI8658::configPedometer ( uint16_t  sample_count,
uint16_t  peak_to_peak,
uint16_t  peak_threshold,
uint16_t  time_up,
uint8_t  time_low = 20,
uint8_t  entry_count = 10,
uint8_t  fix_precision = 0,
uint8_t  sig_count = 4 
)

Configure pedometer parameters.

Parameters
sample_countNumber of samples per calculation window.
peak_to_peakPeak-to-peak threshold in mg.
peak_thresholdPeak threshold in mg.
time_upMaximum step duration in samples.
time_lowMinimum step duration in samples.
entry_countMinimum steps to start counting.
fix_precisionPedometer precision parameter (recommended 0).
sig_countSteps per output update.
Returns
true if configuration successful, false otherwise.

Definition at line 1760 of file SensorQMI8658.cpp.

References _accel_enabled, _gyro_enabled, CTRL_CMD_CONFIGURE_PEDOMETER, disableAccel(), disableGyro(), disableSyncMode(), enableAccel(), enableGyro(), writeCommand(), SensorCommWrapper::writeReg(), and SensorCommWrapper::writeRegBuff().

Referenced by configPedometerDefault(), and setup().

◆ configPedometerDefault()

bool SensorQMI8658::configPedometerDefault ( float  odr = 125.0f)

Configure pedometer with default parameters.

Provides sensible defaults for step counting. Works well for normal walking.

Parameters
odrCurrent accelerometer ODR in Hz (for time calculation).
Returns
true if configuration successful, false otherwise.

Definition at line 1816 of file SensorQMI8658.cpp.

References configPedometer().

Referenced by setup().

◆ configTap() [1/2]

bool SensorQMI8658::configTap ( TapPriority  priority,
uint8_t  peak_window,
uint16_t  tap_window,
uint16_t  double_tap_window,
float  peak_mag_threshold,
float  quiet_threshold 
)

Configure tap detection parameters.

Parameters
priorityAxis priority for tap detection.
peak_windowMaximum peak duration in samples.
tap_windowMinimum quiet time between taps.
double_tap_windowMaximum time for double tap.
peak_mag_thresholdPeak magnitude threshold in g^2.
quiet_thresholdUndefined motion threshold in g^2.
Returns
true if configuration successful, false otherwise.

Definition at line 1668 of file SensorQMI8658.cpp.

References _accel_enabled, _gyro_enabled, CTRL_CMD_CONFIGURE_TAP, disableAccel(), disableGyro(), disableSyncMode(), enableAccel(), enableGyro(), writeCommand(), and SensorCommWrapper::writeReg().

Referenced by applyTapConfig(), configTapDefault(), and setup().

◆ configTap() [2/2]

bool SensorQMI8658::configTap ( uint8_t  priority,
uint8_t  peakWindow,
uint16_t  tapWindow,
uint16_t  dTapWindow,
float  alpha,
float  gamma,
float  peakMagThr,
float  UDMThr 
)
inline

configTap

Note
The calculation of the Tap Detection is based on the accelerometer ODR defined by CTRL2.aODR, refer to Table 22 for details.
Parameters
priorityPriority definition between the x, y, z axes of acceleration. Only Priority[2:0] bits are used. The axis that output the first peak of Linear Acceleration in a valid Tap detection, will be consider as the Tap axis. However, there is possibility that two or three of the axes shows same Linear Acceleration at exactly same time when reach (or be higher than) the PeakMagThr. In this case, the defined priority is used to judge and select the axis as Tap axis.
peakWindow:Definesthe maximum duration (in sample) for a valid peak. In a valid peak, the linear acceleration should reach or be higher than the PeakMagThr and should return to quiet (no significant movement) within UDMThr, at the end of PeakWindow. E.g., 20 @500Hz ODR
tapWindow:Definesthe minimum quiet time before the second Tap happen. After the first Tap is detected, there should be no significant movement (defined by UDMThr) during the TapWindow. The valid second tap should be detected after TapWindow and before DTapWindow. E.g., 50 @500Hz ODR
dTapWindow:Definesthe maximum time for a valid second Tap for Double Tap, count start from the first peak of the valid first Tap. E.g., 250 @500Hz ODR
alpha:Definesthe ratio for calculation the average of the acceleration. The bigger of Alpha, the bigger weight of the latest data. E.g., 0.0625
gamma:Definesthe ratio for calculating the average of the movement magnitude. The bigger of Gamma, the bigger weight of the latest data. E.g., 0.25
peakMagThr:Thresholdfor peak detection. E.g, 0.8g2
UDMThr:UndefinedMotion threshold. This defines the threshold of the Linear Acceleration for quiet status. E.g., 0.4g2
Return values

Definition at line 1185 of file SensorQMI8658.hpp.

References sensorlib::_highByte(), sensorlib::_lowByte(), DeviceBeginCommon::comm, CTRL_CMD_CONFIGURE_TAP, disableAccelerometer(), disableGyroscope(), disableSyncSampleMode(), enableAccelerometer(), enableGyroscope(), isEnableAccelerometer(), isEnableGyroscope(), peakWindow, QMI8658_REG_CAL1_H, QMI8658_REG_CAL1_L, QMI8658_REG_CAL2_H, QMI8658_REG_CAL2_L, QMI8658_REG_CAL3_H, QMI8658_REG_CAL3_L, QMI8658_REG_CAL4_H, tapWindow, and writeCommand().

◆ configTapDefault()

bool SensorQMI8658::configTapDefault ( TapPriority  priority = TapPriority::X_GT_Y_GT_Z)

Configure tap detection with default parameters.

Provides sensible defaults for tap detection. Uses X>Y>Z axis priority.

Parameters
priorityAxis priority for tap detection.
Returns
true if configuration successful, false otherwise.

Definition at line 1715 of file SensorQMI8658.cpp.

References configTap().

Referenced by setup().

◆ configureFifo()

bool SensorQMI8658::configureFifo ( bool  enable,
uint8_t  watermark_samples = 16 
)
overridevirtual

Configure the FIFO buffer.

Parameters
enabletrue to enable FIFO, false to disable.
watermark_samplesNumber of samples for watermark interrupt.
Returns
true if configured successfully, false otherwise.

Implements ImuBase.

Definition at line 828 of file SensorQMI8658.cpp.

References _accel_enabled, _fifo_enabled, _fifo_mode, _fifo_watermark, _gyro_enabled, CTRL_CMD_RST_FIFO, disableAccel(), disableGyro(), enableAccel(), enableGyro(), FIFO_MODE_STREAM, FIFO_SAMPLES_16, resetFifo(), SENSORLIB_LOG_E, writeCommand(), and SensorCommWrapper::writeReg().

◆ configWakeOnMotion() [1/4]

bool SensorQMI8658::configWakeOnMotion ( uint8_t  threshold,
AccelODR  odr,
IntPin  pin 
)

Definition at line 1628 of file SensorQMI8658.cpp.

References configWakeOnMotion().

◆ configWakeOnMotion() [2/4]

bool SensorQMI8658::configWakeOnMotion ( uint8_t  threshold,
AccelODR  odr,
IntPin  pin,
uint8_t  default_pin_value,
uint8_t  blanking_time,
AccelRange  acc_range 
)

Definition at line 1633 of file SensorQMI8658.cpp.

References configWakeOnMotionAdvanced(), FS_16G, FS_16G, FS_2G, FS_2G, FS_4G, FS_4G, FS_8G, and FS_8G.

◆ configWakeOnMotion() [3/4]

bool SensorQMI8658::configWakeOnMotion ( uint8_t  threshold = 200,
float  odr_hz = 128.0f,
IntPin  pin = IntPin::PIN2 
)

Configure wake-on-motion (WoM) feature.

Parameters
thresholdWoM threshold in mg (default: 200mg).
odrAccelerometer ODR for WoM (default: LP_128Hz).
pinInterrupt pin.
Returns
true if configuration successful, false otherwise.

Definition at line 1484 of file SensorQMI8658.cpp.

References configWakeOnMotionAdvanced(), and FS_8G.

Referenced by configWakeOnMotion(), and setup().

◆ configWakeOnMotion() [4/4]

bool SensorQMI8658::configWakeOnMotion ( uint8_t  WoMThreshold = 200,
AccelODR  odr = ACC_ODR_LOWPOWER_128Hz,
IntPin  pin = INTERRUPT_PIN_2,
uint8_t  defaultPinValue = 1,
uint8_t  blankingTime = 0x20,
AccelRange  accRange = ACC_RANGE_8G 
)
inline

configWakeOnMotion

Note
Configuring Wom will reset the sensor, set the function to Wom, and there will be no data output
Parameters
WoMThresholdResolution = 1mg ,default 200mg
odrAccelerometer output data rate ,default low power 128Hz
pinInterrupt Pin( 1 or 2 ) ,default use pin2
defaultPinValueWoM Interrupt Initial Value select: ,default pin high 01 – INT2 (with initial value 0) 11 – INT2 (with initial value 1) 00 – INT1 (with initial value 0) 10 – INT1 (with initial value 1)
blankingTimeInterrupt Blanking Time (in number of accelerometer samples), the number of consecutive samples that will be ignored after enabling the WoM, to screen out unwanted fake detection
accRangeAccelerometer Range ,default ±8g
Return values
Trueif successful, false otherwise

Definition at line 1465 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, CTRL_CMD_WRITE_WOM_SETTING, enableAccelerometer(), enableINT(), INTERRUPT_PIN_1, INTERRUPT_PIN_2, QMI8658_REG_CAL1_H, QMI8658_REG_CAL1_L, QMI8658_REG_CTRL2, QMI8658_REG_CTRL7, reset(), and writeCommand().

◆ configWakeOnMotionAdvanced()

bool SensorQMI8658::configWakeOnMotionAdvanced ( uint8_t  threshold,
float  odr_hz,
IntPin  pin,
uint8_t  default_pin_value,
uint8_t  blanking_time,
AccelFullScaleRange  acc_range 
)

Configure wake-on-motion (WoM) with full vendor parameters.

Parameters
thresholdWoM threshold register value.
odr_hzAccelerometer ODR in Hz.
pinInterrupt pin routing.
default_pin_valueInitial interrupt pin level (0 or 1).
blanking_timeInterrupt blanking time (accelerometer samples).
acc_rangeAccelerometer range used in WoM mode.
Returns
true if configuration successful, false otherwise.

Definition at line 1489 of file SensorQMI8658.cpp.

References SensorCommWrapper::clrRegBit(), CTRL_CMD_WRITE_WOM_SETTING, enableAccel(), enableInterrupt(), findClosestAccelLpOdr(), getAccelRangeRegValue(), DeviceBeginCommon::hal, reset(), SensorCommWrapper::updateBits(), writeCommand(), and SensorCommWrapper::writeReg().

Referenced by applyWomConfig(), configWakeOnMotion(), and configWakeOnMotion().

◆ disableAccel()

bool SensorQMI8658::disableAccel ( )
overridevirtual

Disable the accelerometer.

Returns
true if disabled successfully, false otherwise.

Implements ImuBase.

Definition at line 419 of file SensorQMI8658.cpp.

References _accel_enabled, and SensorCommWrapper::clrRegBit().

Referenced by applyMotionConfig(), calibrate(), configAccel(), configFifo(), configPedometer(), configTap(), configureFifo(), hardwareSelfTest(), selfTestAccel(), selfTestGyro(), setOperationMode(), and writeCalibration().

◆ disableAccelerometer()

bool SensorQMI8658::disableAccelerometer ( )
inline

Disable the accelerometer.

Note
This function will disable the accelerometer
Return values
trueon success, false on failure

Definition at line 713 of file SensorQMI8658.hpp.

References _accel_enabled, DeviceBeginCommon::comm, and QMI8658_REG_CTRL7.

Referenced by configAccelerometer(), configFIFO(), configMotion(), configPedometer(), configTap(), and powerDown().

◆ disableGyro()

bool SensorQMI8658::disableGyro ( )
overridevirtual

Disable the gyroscope.

Returns
true if disabled successfully, false otherwise.

Implements ImuBase.

Definition at line 558 of file SensorQMI8658.cpp.

References _gyro_enabled, and SensorCommWrapper::clrRegBit().

Referenced by applyMotionConfig(), calibrate(), configFifo(), configGyro(), configPedometer(), configTap(), configureFifo(), hardwareSelfTest(), selfTestAccel(), selfTestGyro(), setOperationMode(), and writeCalibration().

◆ disableGyroscope()

bool SensorQMI8658::disableGyroscope ( )
inline

Disable the gyroscope.

Note
This function will disable the gyroscope
Return values
trueon success, false on failure

Definition at line 760 of file SensorQMI8658.hpp.

References _gyro_enabled, DeviceBeginCommon::comm, and QMI8658_REG_CTRL7.

Referenced by configFIFO(), configGyroscope(), configMotion(), configPedometer(), configTap(), and powerDown().

◆ disableInterrupt()

bool SensorQMI8658::disableInterrupt ( IntPin  pin)

Disable interrupt on specified pin.

Parameters
pinInterrupt pin.
Returns
true if successful, false otherwise.

Definition at line 754 of file SensorQMI8658.cpp.

References _int_enabled, _int_pin_mask, and SensorCommWrapper::clrRegBit().

◆ disableLockingMechanism() [1/2]

bool SensorQMI8658::disableLockingMechanism ( )

Disable the data locking mechanism.

Returns
true if successful, false otherwise.

Definition at line 1102 of file SensorQMI8658.cpp.

References CTRL_CMD_AHB_CLOCK_GATING, disableSyncMode(), writeCommand(), and SensorCommWrapper::writeReg().

◆ disableLockingMechanism() [2/2]

bool SensorQMI8658::disableLockingMechanism ( )
inline

Disable the locking mechanism.

Note
This function will disable the locking mechanism for the sensor
Return values
trueon success, false on failure

Definition at line 952 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, CTRL_CMD_AHB_CLOCK_GATING, disableSyncSampleMode(), QMI8658_REG_CAL1_L, and writeCommand().

◆ disableMotionDetect() [1/2]

bool SensorQMI8658::disableMotionDetect ( )

Disable motion detection.

Returns
true if disabled successfully, false otherwise.

Definition at line 1475 of file SensorQMI8658.cpp.

References SensorCommWrapper::clrRegBit().

◆ disableMotionDetect() [2/2]

bool SensorQMI8658::disableMotionDetect ( )
inline

Disable motion detection.

Note
This function disables motion detection and the associated interrupt
Return values
Trueif successful, false otherwise

Definition at line 1438 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_CTRL8.

◆ disablePedometer() [1/2]

bool SensorQMI8658::disablePedometer ( )

Disable pedometer.

Returns
true if disabled successfully, false otherwise.

Definition at line 1862 of file SensorQMI8658.cpp.

References SensorCommWrapper::clrRegBit().

◆ disablePedometer() [2/2]

bool SensorQMI8658::disablePedometer ( )
inline

Definition at line 1146 of file SensorQMI8658.hpp.

References _accel_enabled, DeviceBeginCommon::comm, and QMI8658_REG_CTRL8.

◆ disableSyncMode()

bool SensorQMI8658::disableSyncMode ( )
overridevirtual

Disable synchronous sampling mode.

Returns
true if disabled successfully, false otherwise.

Implements ImuBase.

Definition at line 627 of file SensorQMI8658.cpp.

References _sync_mode, and SensorCommWrapper::clrRegBit().

Referenced by applyMotionConfig(), configPedometer(), configTap(), disableLockingMechanism(), and enablePedometer().

◆ disableSyncSampleMode()

bool SensorQMI8658::disableSyncSampleMode ( )
inline

Disable the synchronous sample mode.

Note
This function will disable the synchronous sample mode for the sensor
Return values
trueon success, false on failure

Definition at line 927 of file SensorQMI8658.hpp.

References ASYNC_MODE, DeviceBeginCommon::comm, and QMI8658_REG_CTRL7.

Referenced by configMotion(), configPedometer(), configTap(), and disableLockingMechanism().

◆ disableTap() [1/2]

bool SensorQMI8658::disableTap ( )

Disable tap detection.

Returns
true if disabled successfully, false otherwise.

Definition at line 1740 of file SensorQMI8658.cpp.

References SensorCommWrapper::clrRegBit().

Referenced by applyTapConfig().

◆ disableTap() [2/2]

bool SensorQMI8658::disableTap ( )
inline

Disable tap detection.

Note
This function disables tap detection and the associated interrupt
Return values
Trueif successful, false otherwise

Definition at line 1279 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_CTRL8.

◆ dumpCtrlRegister()

void SensorQMI8658::dumpCtrlRegister ( )
inline

Dump the control register values.

Note
This function will read and log the values of the control registers
Return values
None

Definition at line 966 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, i, QMI8658_REG_CTRL1, QMI8658_REG_FIFO_CTRL, and SENSORLIB_LOG_D.

Referenced by setup().

◆ dumpRegisters()

void SensorQMI8658::dumpRegisters ( )

Dump control registers for debugging.

Definition at line 2045 of file SensorQMI8658.cpp.

References i, SensorCommWrapper::readReg(), SensorCommWrapper::readRegBuff(), and SENSORLIB_LOG_I.

Referenced by setup().

◆ enableAccel()

bool SensorQMI8658::enableAccel ( )
overridevirtual

Enable the accelerometer.

Returns
true if enabled successfully, false otherwise.

Implements ImuBase.

Definition at line 410 of file SensorQMI8658.cpp.

References _accel_enabled, and SensorCommWrapper::setRegBit().

Referenced by applyMotionConfig(), configAccel(), configFifo(), configPedometer(), configTap(), configureFifo(), configWakeOnMotionAdvanced(), enablePedometer(), hardwareSelfTest(), and setup().

◆ enableAccelerometer()

bool SensorQMI8658::enableAccelerometer ( )
inline

Enable the accelerometer.

Note
This function will enable the accelerometer
Return values
trueon success, false on failure

Definition at line 700 of file SensorQMI8658.hpp.

References _accel_enabled, DeviceBeginCommon::comm, and QMI8658_REG_CTRL7.

Referenced by configAccelerometer(), configFIFO(), configMotion(), configPedometer(), configTap(), configWakeOnMotion(), and setup().

◆ enableDataReadyINT()

void SensorQMI8658::enableDataReadyINT ( bool  enable = true)
inline

Enable or disable the Data Ready interrupt.

Parameters
enableTrue to enable, false to disable

Definition at line 372 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_CTRL7.

Referenced by setup().

◆ enableDataReadyInterrupt()

bool SensorQMI8658::enableDataReadyInterrupt ( IntPin  pin = IntPin::PIN2)

Enable data ready interrupt.

Parameters
pinInterrupt pin for data ready signal.
Note
In Non-SyncSample mode, DRDY is only routed to INT2 when CTRL7.bit5=0. If FIFO mode is enabled (FIFO_MODE != bypass), DRDY is disabled by hardware.
Returns
true if successful, false otherwise.

Definition at line 771 of file SensorQMI8658.cpp.

References SensorCommWrapper::clrRegBit(), and enableInterrupt().

Referenced by setup().

◆ enableDynamicGyroCalibration()

void SensorQMI8658::enableDynamicGyroCalibration ( bool  enable)

Enable dynamic gyroscope calibration.

Dynamic calibration continuously updates gyro offsets when the sensor detects static periods. It uses accelerometer data to determine when the device is stationary.

Parameters
enableTrue to enable, false to disable.

Definition at line 2202 of file SensorQMI8658.cpp.

References _accel_static_deviation, _dyn_cal_enabled, _dyn_cali_sample_count, _dyn_gyro_offset, _dyn_offset_applied, _dyn_static_delay, _dyn_static_flag, and _gyro_static_deviation.

Referenced by setup().

◆ enableGyro()

bool SensorQMI8658::enableGyro ( )
overridevirtual

Enable the gyroscope.

Returns
true if enabled successfully, false otherwise.

Implements ImuBase.

Definition at line 549 of file SensorQMI8658.cpp.

References _gyro_enabled, and SensorCommWrapper::setRegBit().

Referenced by applyMotionConfig(), configFifo(), configGyro(), configPedometer(), configTap(), configureFifo(), enablePedometer(), hardwareSelfTest(), loop(), and setup().

◆ enableGyroscope()

bool SensorQMI8658::enableGyroscope ( )
inline

Enable the gyroscope.

Note
This function will enable the gyroscope
Return values
trueon success, false on failure

Definition at line 747 of file SensorQMI8658.hpp.

References _gyro_enabled, DeviceBeginCommon::comm, and QMI8658_REG_CTRL7.

Referenced by configFIFO(), configGyroscope(), configMotion(), configPedometer(), configTap(), and setup().

◆ enableINT()

void SensorQMI8658::enableINT ( IntPin  pin,
bool  enable = true 
)
inline

Enable or disable the interrupt.

Parameters
pinInterrupt pin to enable/disable,see IntPin enum
enableTrue to enable, false to disable

Definition at line 342 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, INTERRUPT_PIN_1, INTERRUPT_PIN_2, and QMI8658_REG_CTRL1.

Referenced by configWakeOnMotion(), enableMotionDetect(), enablePedometer(), enableTap(), and setup().

◆ enableInterrupt()

bool SensorQMI8658::enableInterrupt ( IntPin  pin)

Enable interrupt on specified pin.

Parameters
pinInterrupt pin.
Returns
true if successful, false otherwise.

Definition at line 739 of file SensorQMI8658.cpp.

References _int_enabled, _int_pin_mask, and SensorCommWrapper::setRegBit().

Referenced by configWakeOnMotionAdvanced(), enableDataReadyInterrupt(), enableMotionDetect(), enablePedometer(), and enableTap().

◆ enableLockingMechanism() [1/2]

bool SensorQMI8658::enableLockingMechanism ( )

Enable the data locking mechanism.

Returns
true if successful, false otherwise.

Definition at line 1093 of file SensorQMI8658.cpp.

References CTRL_CMD_AHB_CLOCK_GATING, enableSyncMode(), writeCommand(), and SensorCommWrapper::writeReg().

Referenced by setup().

◆ enableLockingMechanism() [2/2]

bool SensorQMI8658::enableLockingMechanism ( )
inline

Enable the locking mechanism.

Note
This function will enable the locking mechanism for the sensor
Return values
trueon success, false on failure

Definition at line 938 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, CTRL_CMD_AHB_CLOCK_GATING, enableSyncSampleMode(), QMI8658_REG_CAL1_L, and writeCommand().

◆ enableMotionDetect() [1/2]

bool SensorQMI8658::enableMotionDetect ( IntPin  pin = INTERRUPT_PIN_1)
inline

Enable motion detection.

Note
The Motion Detection can only work in Non-SyncSample mode
Parameters
pinInterrupt Pin( 1 or 2 ) ,default use pin1
Return values
Trueif successful, false otherwise

Definition at line 1415 of file SensorQMI8658.hpp.

References _accel_enabled, DeviceBeginCommon::comm, configActivityInterruptMap(), enableINT(), INTERRUPT_PIN_1, INTERRUPT_PIN_2, and QMI8658_REG_CTRL8.

◆ enableMotionDetect() [2/2]

bool SensorQMI8658::enableMotionDetect ( IntPin  pin = IntPin::PIN1)

Enable motion detection on specified pin.

Parameters
pinInterrupt pin for motion events.
Returns
true if enabled successfully, false otherwise.

Definition at line 1436 of file SensorQMI8658.cpp.

References _accel_enabled, _motion_any_configured, _motion_no_configured, _motion_sig_configured, SensorCommWrapper::clrRegBit(), enableInterrupt(), and SensorCommWrapper::setRegBit().

Referenced by setup().

◆ enablePedometer() [1/2]

bool SensorQMI8658::enablePedometer ( IntPin  pin = INTERRUPT_PIN_DISABLE)
inline

enablePedometer

Note
Enable the Pedometer function , pedometer can only work in Non-SyncSample mode
Parameters
pinInterrupt pin to output Pedometer interrupt, see IntPin enum
Return values
trueon success, false on failure

Definition at line 1130 of file SensorQMI8658.hpp.

References _accel_enabled, DeviceBeginCommon::comm, configActivityInterruptMap(), enableINT(), INTERRUPT_PIN_1, INTERRUPT_PIN_2, and QMI8658_REG_CTRL8.

◆ enablePedometer() [2/2]

bool SensorQMI8658::enablePedometer ( IntPin  pin = IntPin::DISABLE)

Enable pedometer.

Parameters
pinInterrupt pin for pedometer events.
Returns
true if enabled successfully, false otherwise.

Definition at line 1831 of file SensorQMI8658.cpp.

References _accel_enabled, _gyro_enabled, _last_step_count, SensorCommWrapper::clrRegBit(), disableSyncMode(), enableAccel(), enableGyro(), enableInterrupt(), getStepCount(), and SensorCommWrapper::setRegBit().

Referenced by setup().

◆ enableStaticCalibration()

void SensorQMI8658::enableStaticCalibration ( bool  enable)

Start static calibration.

Static calibration calculates accelerometer and gyroscope offsets when the sensor is stationary. Place the sensor in a stable position and call processCalibration() periodically until it returns true.

Parameters
enableTrue to enable static calibration, false to disable.

Definition at line 2128 of file SensorQMI8658.cpp.

References _static_cali_enabled, and resetStaticCalibration().

Referenced by setup().

◆ enableSyncMode()

bool SensorQMI8658::enableSyncMode ( )
overridevirtual

Enable synchronous sampling mode.

Returns
true if enabled successfully, false otherwise.

Implements ImuBase.

Definition at line 618 of file SensorQMI8658.cpp.

References _sync_mode, and SensorCommWrapper::setRegBit().

Referenced by enableLockingMechanism(), and setup().

◆ enableSyncSampleMode()

bool SensorQMI8658::enableSyncSampleMode ( )
inline

Enable the synchronous sample mode.

Note
This function will enable the synchronous sample mode for the sensor
Return values
trueon success, false on failure

Definition at line 916 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, QMI8658_REG_CTRL7, and SYNC_MODE.

Referenced by enableLockingMechanism().

◆ enableTap() [1/2]

bool SensorQMI8658::enableTap ( IntPin  pin = INTERRUPT_PIN_1)
inline

Enable tap detection.

Note
The Tap Detection can only work in Non-SyncSample mode
Parameters
pinInterrupt Pin( 1 or 2 ) ,default is INTERRUPT_PIN_1
Return values
Trueif successful, false otherwise

Definition at line 1259 of file SensorQMI8658.hpp.

References _accel_enabled, DeviceBeginCommon::comm, configActivityInterruptMap(), enableINT(), INTERRUPT_PIN_1, INTERRUPT_PIN_2, and QMI8658_REG_CTRL8.

◆ enableTap() [2/2]

bool SensorQMI8658::enableTap ( IntPin  pin = IntPin::PIN1)

Enable tap detection.

Parameters
pinInterrupt pin for tap events.
Returns
true if enabled successfully, false otherwise.

Definition at line 1725 of file SensorQMI8658.cpp.

References _accel_enabled, enableInterrupt(), and SensorCommWrapper::setRegBit().

Referenced by applyTapConfig(), and setup().

◆ findClosestAccelLpOdr()

uint8_t SensorQMI8658::findClosestAccelLpOdr ( float  hz)
protected

Definition at line 731 of file SensorQMI8658.cpp.

Referenced by configWakeOnMotionAdvanced().

◆ findClosestAccelOdr()

uint8_t SensorQMI8658::findClosestAccelOdr ( float  hz)
protected

Definition at line 705 of file SensorQMI8658.cpp.

Referenced by configAccel(), and setAccelOutputDataRate().

◆ findClosestGyroOdr()

uint8_t SensorQMI8658::findClosestGyroOdr ( float  hz)
protected

Definition at line 718 of file SensorQMI8658.cpp.

Referenced by configGyro(), and setGyroOutputDataRate().

◆ getAccelerometer()

bool SensorQMI8658::getAccelerometer ( float &  x,
float &  y,
float &  z 
)
inline

Get the accelerometer data.

Note
This function will read the accelerometer data from the sensor
Parameters
&xaccelerometer X-axis data
&yaccelerometer Y-axis data
&zaccelerometer Z-axis data
Return values
trueon success, false on failure

Definition at line 799 of file SensorQMI8658.hpp.

References _accel_enabled, getAccelRaw(), x, and y.

Referenced by lockingMechanismHandler(), loop(), and readSensorData().

◆ getAccelerometerScales()

float SensorQMI8658::getAccelerometerScales ( )
inline

Get the accelerometer scales.

Note
This function will return the current accelerometer scales
Return values
Thecurrent accelerometer scales

Definition at line 819 of file SensorQMI8658.hpp.

◆ getAccelRangeRegValue()

uint8_t SensorQMI8658::getAccelRangeRegValue ( AccelFullScaleRange  range)
protected

Definition at line 455 of file SensorQMI8658.cpp.

References FS_16G, FS_2G, FS_4G, and FS_8G.

Referenced by configAccel(), configWakeOnMotionAdvanced(), and setAccelFullScaleRange().

◆ getAccelRaw()

bool SensorQMI8658::getAccelRaw ( int16_t *  rawBuffer)
inline

Get the raw accelerometer data.

Note
This function will read the raw accelerometer data from the sensor
Parameters
*rawBufferPointer to the buffer to store the raw data
Return values
trueon success, false on failure

Definition at line 775 of file SensorQMI8658.hpp.

References _accel_enabled, DeviceBeginCommon::comm, and QMI8658_REG_AX_L.

Referenced by getAccelerometer().

◆ getAccelScale()

float SensorQMI8658::getAccelScale ( )

Get the accelerometer scale factor.

Returns
Scale factor in m/s^2 per LSB.

Definition at line 2068 of file SensorQMI8658.cpp.

References _accel_scale.

◆ getAccelScaleFromRange()

float SensorQMI8658::getAccelScaleFromRange ( AccelFullScaleRange  range)
protected

Definition at line 466 of file SensorQMI8658.cpp.

References FS_16G, FS_2G, FS_4G, and FS_8G.

Referenced by configAccel(), and setAccelFullScaleRange().

◆ getAxisLayout()

SensorQMI8658::Layout SensorQMI8658::getAxisLayout ( ) const

Get the current axis layout setting.

Returns
Current axis layout.

Definition at line 2083 of file SensorQMI8658.cpp.

References _axis_layout.

Referenced by setup().

◆ getCallbacks() [1/2]

SensorQMI8658::EventCallbacks & SensorQMI8658::getCallbacks ( )

Get current callbacks.

Definition at line 1931 of file SensorQMI8658.cpp.

References callbacks.

◆ getCallbacks() [2/2]

const SensorQMI8658::EventCallbacks & SensorQMI8658::getCallbacks ( ) const

Get current callbacks (const).

Definition at line 1936 of file SensorQMI8658.cpp.

References callbacks.

◆ getChipFirmwareVersion()

uint32_t SensorQMI8658::getChipFirmwareVersion ( )
inline

Get Sensor chip firmware version.

Note
This function retrieves the firmware version of the sensor chip
Return values
Firmwareversion number

Definition at line 1542 of file SensorQMI8658.hpp.

◆ getChipID() [1/2]

uint8_t SensorQMI8658::getChipID ( )
inlinevirtual

Get the chip ID.

Return values
ChipID

Implements ImuBase.

Definition at line 288 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_REVISION.

◆ getChipID() [2/2]

uint8_t SensorQMI8658::getChipID ( )
overridevirtual

Get the chip ID / WHO_AM_I value.

Returns
Chip ID value.

Implements ImuBase.

Definition at line 328 of file SensorQMI8658.cpp.

References SensorCommWrapper::readReg().

Referenced by initImpl(), isPresent(), and setup().

◆ getChipUsid() [1/2]

void SensorQMI8658::getChipUsid ( uint8_t *  buffer,
uint8_t  length 
)

Get sensor USID (unique chip ID).

Parameters
[out]bufferBuffer to store USID (must be at least 6 bytes).
lengthNumber of bytes to read.

Definition at line 2060 of file SensorQMI8658.cpp.

References _usid.

◆ getChipUsid() [2/2]

void SensorQMI8658::getChipUsid ( uint8_t *  buffer,
uint8_t  length 
)
inline

Get Sensor chip USID.

Parameters
*bufferInput buffer to store the USID , must be uint8_t[6]
lengthLength of the buffer , must be less than or equal to 6
Return values
None

Definition at line 1528 of file SensorQMI8658.hpp.

◆ getDataReady()

bool SensorQMI8658::getDataReady ( )
inline

Check if new data is available.

Note
This function will check the status register to see if new data is available
Return values
trueif new data is available, false otherwise

Definition at line 884 of file SensorQMI8658.hpp.

References _accel_enabled, _gyro_enabled, ASYNC_MODE, DeviceBeginCommon::comm, DeviceBeginCommon::hal, QMI8658_REG_STATUS0, QMI8658_REG_STATUS_INT, and SYNC_MODE.

Referenced by loop().

◆ getDynamicGyroCalibrationOffsets()

void SensorQMI8658::getDynamicGyroCalibrationOffsets ( int16_t  gyro_offset[3])

Get dynamic gyroscope calibration offsets.

Parameters
[out]gyro_offsetGyro offsets [x, y, z] in raw units.

Definition at line 2222 of file SensorQMI8658.cpp.

References _dyn_gyro_offset.

Referenced by loop().

◆ getFifoStatus()

uint8_t SensorQMI8658::getFifoStatus ( )

Get FIFO status.

Returns
FIFO status register value.

Definition at line 928 of file SensorQMI8658.cpp.

References SensorCommWrapper::readReg().

Referenced by readFromFifo().

◆ getFirmwareVersion()

uint32_t SensorQMI8658::getFirmwareVersion ( )
overridevirtual

Get the firmware version.

Returns
Firmware version value.

Implements ImuBase.

Definition at line 333 of file SensorQMI8658.cpp.

References _firmware_version.

Referenced by setup().

◆ getGyroRangeRegValue()

uint8_t SensorQMI8658::getGyroRangeRegValue ( GyroFullScaleRange  range)
protected

Definition at line 594 of file SensorQMI8658.cpp.

References FS_1000_DPS, FS_125_DPS, FS_2000_DPS, FS_250_DPS, and FS_500_DPS.

Referenced by configGyro(), and setGyroFullScaleRange().

◆ getGyroRaw()

bool SensorQMI8658::getGyroRaw ( int16_t *  rawBuffer)
inline

Get the raw gyroscope data.

Note
This function will read the raw gyroscope data from the sensor
Parameters
*rawBufferPointer to the buffer to store the raw data
Return values
trueon success, false on failure

Definition at line 840 of file SensorQMI8658.hpp.

References _gyro_enabled, DeviceBeginCommon::comm, and QMI8658_REG_GX_L.

Referenced by getGyroscope().

◆ getGyroScale()

float SensorQMI8658::getGyroScale ( )

Get the gyroscope scale factor.

Returns
Scale factor in rad/s per LSB.

Definition at line 2073 of file SensorQMI8658.cpp.

References _gyro_scale.

◆ getGyroScaleFromRange()

float SensorQMI8658::getGyroScaleFromRange ( GyroFullScaleRange  range)
protected

Definition at line 606 of file SensorQMI8658.cpp.

References FS_1000_DPS, FS_125_DPS, FS_2000_DPS, FS_250_DPS, and FS_500_DPS.

Referenced by configGyro(), and setGyroFullScaleRange().

◆ getGyroscope()

bool SensorQMI8658::getGyroscope ( float &  x,
float &  y,
float &  z 
)
inline

Get the raw gyroscope data.

Note
This function will read the raw gyroscope data from the sensor
Parameters
&xReference to the variable to store the X-axis data
&yReference to the variable to store the Y-axis data
&zReference to the variable to store the Z-axis data
Return values
trueon success, false on failure

Definition at line 864 of file SensorQMI8658.hpp.

References _gyro_enabled, getGyroRaw(), x, and y.

Referenced by lockingMechanismHandler(), loop(), and readSensorData().

◆ getGyroscopeScales()

float SensorQMI8658::getGyroscopeScales ( )
inline

Get the gyroscope scales.

Note
This function will return the current gyroscope scales
Return values
Thecurrent gyroscope scales

Definition at line 829 of file SensorQMI8658.hpp.

◆ getHardwareSelfTestResults()

void SensorQMI8658::getHardwareSelfTestResults ( float  accel_result[3],
float  gyro_result[3] 
)

Get hardware self-test results.

Parameters
[out]accel_resultAccel self-test results [x, y, z] in mg.
[out]gyro_resultGyro self-test results [x, y, z] in dps.

Definition at line 2429 of file SensorQMI8658.cpp.

References _hw_st_accel_result, and _hw_st_gyro_result.

Referenced by setup().

◆ getInterruptStatus()

uint8_t SensorQMI8658::getInterruptStatus ( )

Get interrupt status.

Returns
Interrupt status register value.

Definition at line 780 of file SensorQMI8658.cpp.

References SensorCommWrapper::readReg().

◆ getIrqStatus()

uint8_t SensorQMI8658::getIrqStatus ( )
inline

Get the IRQ status.

Note
This status indicates which interrupt has occurred
Return values
IRQstatus register value

Definition at line 363 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_STATUS_INT.

Referenced by readSensorData().

◆ getPedometerCounter()

uint32_t SensorQMI8658::getPedometerCounter ( )
inline

Get the Pedometer counter.

Note
This function will return the current Pedometer step count
Return values
Pedometerstep count

Definition at line 1105 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_STEP_CNT_LOW.

Referenced by pedometerEvent().

◆ getStaticCalibrationOffsets()

void SensorQMI8658::getStaticCalibrationOffsets ( int16_t  accel_offset[3],
int16_t  gyro_offset[3] 
)

Get static calibration offsets.

Parameters
[out]accel_offsetAccel offsets [x, y, z] in raw units.
[out]gyro_offsetGyro offsets [x, y, z] in raw units.

Definition at line 2182 of file SensorQMI8658.cpp.

References _accel_cali_offset, and _gyro_cali_offset.

Referenced by loop(), and setup().

◆ getStatusRegister()

int SensorQMI8658::getStatusRegister ( )
inline

Get the Pedometer counter.

Note
This function will return the current Pedometer step count
Return values
Pedometerstep count

Definition at line 1006 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_STATUS1.

Referenced by loop().

◆ getStepCount()

uint32_t SensorQMI8658::getStepCount ( )

Get pedometer step count.

Returns
Number of steps counted.

Definition at line 1867 of file SensorQMI8658.cpp.

References SensorCommWrapper::readRegBuff().

Referenced by enablePedometer(), pedometerCallback(), and update().

◆ getTapStatus() [1/2]

SensorQMI8658::TapEvent SensorQMI8658::getTapStatus ( )

Get tap status.

Returns
TapEvent indicating the detected tap type.

Definition at line 1745 of file SensorQMI8658.cpp.

References DOUBLE, INVALID, SensorCommWrapper::readReg(), and SINGLE.

Referenced by tapEventCallback(), and update().

◆ getTapStatus() [2/2]

TapEvent SensorQMI8658::getTapStatus ( )
inline

Get the current tap status.

Note
This function reads the tap status register and returns the tap event
Return values
Thecurrent tap event

Definition at line 1289 of file SensorQMI8658.hpp.

References sensorlib::_bv(), DeviceBeginCommon::comm, DOUBLE_TAP, INVALID_TAP, QMI8658_REG_TAP_STATUS, SENSORLIB_LOG_I, and SINGLE_TAP.

◆ getTemperature()

float SensorQMI8658::getTemperature ( )
overridevirtual

Get the temperature reading from the sensor.

Returns
Temperature in degrees Celsius, or NaN on error.

Implements ImuBase.

Definition at line 352 of file SensorQMI8658.cpp.

References SensorCommWrapper::readRegBuff().

Referenced by readAccel(), and readGyro().

◆ getTemperature_C()

float SensorQMI8658::getTemperature_C ( )
inline

Get the temperature in degree Celsius.

Return values
Temperaturevalue in degree Celsius

Definition at line 328 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_TEMPERATURE_L.

Referenced by lockingMechanismHandler(), and readSensorData().

◆ getTimestamp() [1/2]

uint32_t SensorQMI8658::getTimestamp ( )
inlinevirtual

Get the timestamp.

Note
This timestamp is generated by the sensor
Return values
Timestampvalue

Implements ImuBase.

Definition at line 308 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, QMI8658_REG_TIMESTAMP_L, and timestamp.

◆ getTimestamp() [2/2]

uint32_t SensorQMI8658::getTimestamp ( )
overridevirtual

Get the timestamp from the sensor.

Returns
Timestamp value.

Implements ImuBase.

Definition at line 361 of file SensorQMI8658.cpp.

References _last_timestamp, and SensorCommWrapper::readRegBuff().

Referenced by lockingMechanismHandler(), loop(), and readSensorData().

◆ hardwareSelfTest()

bool SensorQMI8658::hardwareSelfTest ( bool  includeAccel = true,
bool  includeGyro = true 
)

Perform hardware self-test on both sensors.

Parameters
includeAccelTrue to include accelerometer self-test.
includeGyroTrue to include gyroscope self-test.
Returns
true if all tests passed, false otherwise.

Definition at line 2314 of file SensorQMI8658.cpp.

References _accel_enabled, _gyro_enabled, _hw_st_accel_result, _hw_st_gyro_result, disableAccel(), disableGyro(), enableAccel(), enableGyro(), DeviceBeginCommon::hal, HW_ST_ACCEL_THRESHOLD_MG, HW_ST_GYRO_THRESHOLD_DPS, SensorCommWrapper::readReg(), SensorCommWrapper::readRegBuff(), SENSORLIB_LOG_E, and SensorCommWrapper::writeReg().

Referenced by setup().

◆ initImpl() [1/2]

bool SensorQMI8658::initImpl ( uint8_t  param)
overrideprotectedvirtual

◆ initImpl() [2/2]

bool SensorQMI8658::initImpl ( uint8_t  param)
inlineoverrideprotectedvirtual

◆ isAccelEnabled()

bool SensorQMI8658::isAccelEnabled ( )
overridevirtual

Check if accelerometer is enabled.

Returns
true if enabled, false otherwise.

Implements ImuBase.

Definition at line 428 of file SensorQMI8658.cpp.

References _accel_enabled.

◆ isDataReady()

bool SensorQMI8658::isDataReady ( uint8_t  mask = static_cast<uint8_t>(ImuBase::DataReadyMask::BOTH))
overridevirtual

Check if requested IMU data is available.

Parameters
maskData-ready target mask (ACCEL / GYRO / BOTH).
Returns
true if requested data is ready, false otherwise.

Implements ImuBase.

Definition at line 785 of file SensorQMI8658.cpp.

References _accel_enabled, _gyro_enabled, _int_enabled, _int_pin, _sync_mode, SensorCommWrapper::getRegBit(), DeviceBeginCommon::hal, and SensorCommWrapper::readReg().

Referenced by loop(), and setup().

◆ isDynamicGyroCalibrationEnabled()

bool SensorQMI8658::isDynamicGyroCalibrationEnabled ( ) const

Check if dynamic gyro calibration is enabled.

Returns
true if enabled, false otherwise.

Definition at line 2217 of file SensorQMI8658.cpp.

References _dyn_cal_enabled.

Referenced by loop().

◆ isEnableAccelerometer()

bool SensorQMI8658::isEnableAccelerometer ( )
inline

Check if the accelerometer is enabled.

Note
This function will check if the accelerometer is enabled
Return values
trueif enabled, false otherwise

Definition at line 727 of file SensorQMI8658.hpp.

References _accel_enabled.

Referenced by configAccelerometer(), configFIFO(), configMotion(), configPedometer(), configTap(), and loop().

◆ isEnableGyroscope()

bool SensorQMI8658::isEnableGyroscope ( )
inline

Check if the gyroscope is enabled.

Note
This function will check if the gyroscope is enabled
Return values
trueif enabled, false otherwise

Definition at line 737 of file SensorQMI8658.hpp.

References _gyro_enabled.

Referenced by configFIFO(), configGyroscope(), configMotion(), configPedometer(), configTap(), and loop().

◆ isGyroEnabled()

bool SensorQMI8658::isGyroEnabled ( )
overridevirtual

Check if gyroscope is enabled.

Returns
true if enabled, false otherwise.

Implements ImuBase.

Definition at line 567 of file SensorQMI8658.cpp.

References _gyro_enabled.

◆ isPresent()

bool SensorQMI8658::isPresent ( )
overridevirtual

Check if the IMU sensor is responding.

Returns
true if sensor is present, false otherwise.

Implements ImuBase.

Definition at line 323 of file SensorQMI8658.cpp.

References getChipID().

◆ isStaticCalibrationComplete()

bool SensorQMI8658::isStaticCalibrationComplete ( ) const

Get the current static calibration status.

Returns
true if calibration is complete, false otherwise.

Definition at line 2141 of file SensorQMI8658.cpp.

References _static_cali_complete.

Referenced by loop(), and setup().

◆ isStaticCalibrationEnabled()

bool SensorQMI8658::isStaticCalibrationEnabled ( ) const

Check if static calibration is enabled.

Returns
true if enabled, false otherwise.

Definition at line 2136 of file SensorQMI8658.cpp.

References _static_cali_enabled.

◆ mgToBytes()

uint8_t SensorQMI8658::mgToBytes ( float  mg)
protected

Definition at line 1656 of file SensorQMI8658.cpp.

Referenced by applyMotionConfig(), configMotion(), and configMotionDetect().

◆ odrToFloat()

float SensorQMI8658::odrToFloat ( float  odr)
protected

Definition at line 700 of file SensorQMI8658.cpp.

◆ powerDown()

void SensorQMI8658::powerDown ( )
inline

Power down the sensor.

Note
This function will disable the accelerometer and gyroscope
Return values
None

Definition at line 983 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, disableAccelerometer(), disableGyroscope(), and QMI8658_REG_CTRL1.

◆ powerOn()

void SensorQMI8658::powerOn ( )
inline

Power on the sensor.

Note
This function will enable the accelerometer and gyroscope
Return values
None

Definition at line 996 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_CTRL1.

◆ processDynamicCalibration()

void SensorQMI8658::processDynamicCalibration ( int16_t  accel_data[3],
int16_t  gyro_data[3] 
)

Process dynamic calibration with current sensor data.

Parameters
accel_dataRaw accelerometer data [x, y, z].
gyro_dataRaw gyroscope data [x, y, z].

Definition at line 2229 of file SensorQMI8658.cpp.

References _accel_speed_buffer, _accel_static_deviation, _dyn_cal_enabled, _dyn_cali_sample_count, _dyn_gyro_offset, _dyn_gyro_sum, _dyn_offset_applied, _dyn_static_delay, _dyn_static_flag, _gyro_speed_buffer, _gyro_static_deviation, DYN_CAL_BUFFER_SIZE, DYN_CAL_STATIC_COUNT, and i.

Referenced by readGyro().

◆ processStaticCalibration()

bool SensorQMI8658::processStaticCalibration ( int16_t  accel_data[3],
int16_t  gyro_data[3] 
)

Process static calibration with current sensor data.

Parameters
accel_dataRaw accelerometer data [x, y, z].
gyro_dataRaw gyroscope data [x, y, z].
Returns
true if calibration is complete, false if still collecting data.

Definition at line 2146 of file SensorQMI8658.cpp.

References _accel_cali_offset, _accel_cali_sum, _gyro_cali_offset, _gyro_cali_sum, _static_cali_complete, _static_cali_enabled, _static_cali_sample_count, i, and MAX_STATIC_CALI_SAMPLES.

Referenced by readGyro().

◆ readAccel()

bool SensorQMI8658::readAccel ( AccelerometerData out)
overridevirtual

Read accelerometer data.

Parameters
[out]outReference to store the read data.
Returns
true if read successful, false otherwise.

Implements ImuBase.

Definition at line 376 of file SensorQMI8658.cpp.

References _accel_scale, getTemperature(), AccelerometerUtils::gToMps2(), AccelerometerData::mps2, AccelerometerData::raw, readAccelRaw(), AccelerometerData::temperature, x, SensorVector::x, RawVector::x, y, SensorVector::y, RawVector::y, SensorVector::z, and RawVector::z.

Referenced by loop(), and setup().

◆ readAccelRaw()

bool SensorQMI8658::readAccelRaw ( int16_t &  x,
int16_t &  y,
int16_t &  z 
)
overridevirtual

Read raw accelerometer data without scaling.

Parameters
[out]xX-axis raw value.
[out]yY-axis raw value.
[out]zZ-axis raw value.
Returns
true if read successful, false otherwise.

Implements ImuBase.

Definition at line 394 of file SensorQMI8658.cpp.

References _accel_enabled, SensorCommWrapper::readRegBuff(), x, and y.

Referenced by readAccel().

◆ readFromFifo() [1/2]

uint16_t SensorQMI8658::readFromFifo ( AccelerometerData accel_data,
uint16_t  accel_count,
GyroscopeData gyro_data,
uint16_t  gyro_count 
)
overridevirtual

Read data from FIFO buffer.

Parameters
[out]accel_dataArray to store accelerometer samples.
accel_countMaximum number of accelerometer samples.
[out]gyro_dataArray to store gyroscope samples.
gyro_countMaximum number of gyroscope samples.
Returns
Number of samples read, or 0 on error.

Implements ImuBase.

Definition at line 933 of file SensorQMI8658.cpp.

References _accel_enabled, _accel_scale, _dyn_cal_enabled, _dyn_gyro_offset, _dyn_offset_applied, _fifo_buffer, _fifo_buffer_size, _fifo_enabled, _fifo_mode, _gyro_cali_offset, _gyro_enabled, _gyro_scale, _static_cali_complete, buffer_size, CTRL_CMD_REQ_FIFO, GyroscopeData::dps, getFifoStatus(), AccelerometerUtils::gToMps2(), DeviceBeginCommon::hal, i, AccelerometerData::mps2, AccelerometerData::raw, GyroscopeData::raw, readFromFifo(), SensorCommWrapper::readRegBuff(), SENSORLIB_LOG_D, SENSORLIB_LOG_E, writeCommand(), SensorCommWrapper::writeReg(), x, SensorVector::x, RawVector::x, y, SensorVector::y, RawVector::y, SensorVector::z, and RawVector::z.

Referenced by loop(), readFromFifo(), and readFromFifo().

◆ readFromFifo() [2/2]

uint16_t SensorQMI8658::readFromFifo ( IMUdata acc,
uint16_t  accLength,
IMUdata gyro,
uint16_t  gyrLength 
)
inline

readFromFifo

Note
Read the data in the FIFO buffer. configFIFO should be called before use.
Parameters
accPointer to store accelerometer data
accLengthLength of the accelerometer data array
gyroPointer to store gyroscope data
gyrLengthLength of the gyroscope data array
Return values
Numberof samples read per sensor

Definition at line 621 of file SensorQMI8658.hpp.

References _accel_enabled, _fifo_mode, _gyro_enabled, acc, FIFO_MODE_BYPASS, gyro, i, readFromFifo(), SENSORLIB_LOG_D, SENSORLIB_LOG_E, x, IMUdata::x, y, IMUdata::y, and IMUdata::z.

◆ readGyro()

bool SensorQMI8658::readGyro ( GyroscopeData out)
overridevirtual

◆ readGyroRaw()

bool SensorQMI8658::readGyroRaw ( int16_t &  x,
int16_t &  y,
int16_t &  z 
)
overridevirtual

Read raw gyroscope data without scaling.

Parameters
[out]xX-axis raw value.
[out]yY-axis raw value.
[out]zZ-axis raw value.
Returns
true if read successful, false otherwise.

Implements ImuBase.

Definition at line 533 of file SensorQMI8658.cpp.

References _gyro_enabled, SensorCommWrapper::readRegBuff(), x, and y.

Referenced by readGyro().

◆ reset() [1/2]

bool SensorQMI8658::reset ( )
overridevirtual

Reset the IMU sensor to its default state.

Returns
true if reset successful, false otherwise.

Implements ImuBase.

Definition at line 298 of file SensorQMI8658.cpp.

References DeviceBeginCommon::hal, SensorCommWrapper::readReg(), SENSORLIB_LOG_E, SensorCommWrapper::setRegBit(), and SensorCommWrapper::writeReg().

Referenced by configWakeOnMotion(), configWakeOnMotionAdvanced(), initImpl(), and setup().

◆ reset() [2/2]

bool SensorQMI8658::reset ( bool  waitResult = true,
uint32_t  timeout = 500 
)
inline

Reset the sensor.

Note
Call this function to reset the sensor to its default state
Parameters
waitResultTrue to wait for the reset result, false to return immediately
timeoutTimeout duration in milliseconds
Return values
trueon success, false on failure

Definition at line 256 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, DeviceBeginCommon::hal, QMI8658_REG_CTRL1, QMI8658_REG_RESET, QMI8658_REG_RESET_DEFAULT, QMI8658_REG_RST_RESULT, QMI8658_REG_RST_RESULT_VAL, and SENSORLIB_LOG_E.

◆ resetFifo()

bool SensorQMI8658::resetFifo ( )

Reset the FIFO.

Returns
true if successful, false otherwise.

Definition at line 923 of file SensorQMI8658.cpp.

References CTRL_CMD_RST_FIFO, and writeCommand().

Referenced by configFifo(), and configureFifo().

◆ resetStaticCalibration()

void SensorQMI8658::resetStaticCalibration ( )

◆ resetStepCount()

bool SensorQMI8658::resetStepCount ( )

Reset pedometer counter.

Returns
true if reset successful, false otherwise.

Definition at line 1876 of file SensorQMI8658.cpp.

References CTRL_CMD_RESET_PEDOMETER, and writeCommand().

Referenced by setup().

◆ selfTest()

bool SensorQMI8658::selfTest ( )
overridevirtual

Perform self-test on the IMU sensor.

Returns
true if self-test passed, false otherwise.

Implements ImuBase.

Definition at line 318 of file SensorQMI8658.cpp.

References selfTestAccel(), and selfTestGyro().

Referenced by setup().

◆ selfTestAccel() [1/2]

bool SensorQMI8658::selfTestAccel ( )

Perform accelerometer self-test.

Returns
true if self-test passed, false otherwise.

Definition at line 1208 of file SensorQMI8658.cpp.

References SensorCommWrapper::clrRegBit(), disableAccel(), disableGyro(), DeviceBeginCommon::hal, SensorCommWrapper::readReg(), SensorCommWrapper::readRegBuff(), SENSORLIB_LOG_E, SensorCommWrapper::updateBits(), and SensorCommWrapper::writeReg().

Referenced by selfTest(), and setup().

◆ selfTestAccel() [2/2]

bool SensorQMI8658::selfTestAccel ( )
inline

Perform self-test on the accelerometer.

Note
This function triggers a self-test on the accelerometer and checks the results
Return values
Trueif self-test passed, false otherwise

Definition at line 1830 of file SensorQMI8658.hpp.

References ACC_ODR_1000Hz, DeviceBeginCommon::comm, DeviceBeginCommon::hal, QMI8658_REG_CTRL2, QMI8658_REG_CTRL7, QMI8658_REG_DVX_L, QMI8658_REG_STATUS_INT, SENSORLIB_LOG_D, SENSORLIB_LOG_E, and SENSORLIB_LOG_I.

◆ selfTestGyro() [1/2]

bool SensorQMI8658::selfTestGyro ( )

◆ selfTestGyro() [2/2]

bool SensorQMI8658::selfTestGyro ( )
inline

Perform self-test on the gyroscope.

Note
This function triggers a self-test on the gyroscope and checks the results
Return values
Trueif self-test passed, false otherwise

Definition at line 1916 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, DeviceBeginCommon::hal, QMI8658_REG_CTRL3, QMI8658_REG_CTRL7, QMI8658_REG_DVX_L, QMI8658_REG_STATUS_INT, SENSORLIB_LOG_D, SENSORLIB_LOG_E, and SENSORLIB_LOG_I.

◆ setAccelDataReadyCallback()

void SensorQMI8658::setAccelDataReadyCallback ( DataReadyCallback  callback)

Set callback for accelerometer data ready.

Parameters
callbackCallback function.

Definition at line 1911 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onAccelDataReady.

◆ setAccelDataReadyEventCallBack()

void SensorQMI8658::setAccelDataReadyEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1699 of file SensorQMI8658.hpp.

◆ setAccelFullScaleRange()

bool SensorQMI8658::setAccelFullScaleRange ( AccelFullScaleRange  range)
overridevirtual

Set accelerometer full scale range.

Parameters
rangeFull scale range setting.
Returns
true if set successfully, false otherwise.

Implements ImuBase.

Definition at line 433 of file SensorQMI8658.cpp.

References _accel_range, _accel_scale, getAccelRangeRegValue(), getAccelScaleFromRange(), and SensorCommWrapper::updateBits().

◆ setAccelOffset() [1/2]

void SensorQMI8658::setAccelOffset ( int16_t  offset_x,
int16_t  offset_y,
int16_t  offset_z 
)
inline

Write accelerometer calibration offsets.

Note
This function writes the calibration offsets for the accelerometer , this offset change is lost when the sensor is power cycled, or the system is reset
Parameters
offset_xOffset value for the X axis
offset_yOffset value for the Y axis
offset_zOffset value for the Z axis
Return values
None

Definition at line 2001 of file SensorQMI8658.hpp.

References sensorlib::_highByte(), sensorlib::_lowByte(), DeviceBeginCommon::comm, CTRL_CMD_ACCEL_HOST_DELTA_OFFSET, QMI8658_REG_CAL1_L, QMI8658_REG_CAL2_L, QMI8658_REG_CAL3_L, and writeCommand().

◆ setAccelOffset() [2/2]

void SensorQMI8658::setAccelOffset ( int16_t  x,
int16_t  y,
int16_t  z 
)

Set accelerometer host delta offsets.

Parameters
xX-axis offset.
yY-axis offset.
zZ-axis offset.

Definition at line 1178 of file SensorQMI8658.cpp.

References CTRL_CMD_ACCEL_HOST_DELTA_OFFSET, writeCommand(), SensorCommWrapper::writeRegBuff(), x, and y.

◆ setAccelOutputDataRate()

bool SensorQMI8658::setAccelOutputDataRate ( float  data_rate_hz)
overridevirtual

Set accelerometer output data rate.

Parameters
data_rate_hzOutput data rate in Hz.
Returns
true if set successfully, false otherwise.

Implements ImuBase.

Definition at line 445 of file SensorQMI8658.cpp.

References _accel_odr, findClosestAccelOdr(), and SensorCommWrapper::updateBits().

◆ setAnyMotionCallback()

void SensorQMI8658::setAnyMotionCallback ( MotionCallback  callback)

Set callback for any-motion event.

Parameters
callbackCallback function.

Definition at line 1881 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onAnyMotion.

Referenced by setup().

◆ setAnyMotionEventCallBack()

void SensorQMI8658::setAnyMotionEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1684 of file SensorQMI8658.hpp.

◆ setAxisLayout()

void SensorQMI8658::setAxisLayout ( Layout  layout)

Set the sensor axis layout for coordinate transformation.

Parameters
layoutThe axis layout to apply.

Definition at line 2078 of file SensorQMI8658.cpp.

References _axis_layout.

Referenced by setup().

◆ setCallbacks()

void SensorQMI8658::setCallbacks ( const EventCallbacks cbs)

Set all event callbacks at once.

Definition at line 1926 of file SensorQMI8658.cpp.

References callbacks.

◆ setDataLockingCallback()

void SensorQMI8658::setDataLockingCallback ( DataReadyCallback  callback)

Set callback for data locking.

Parameters
callbackCallback function.

Definition at line 1921 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onDataLocking.

Referenced by setup().

◆ setDataLockingEventCallBack()

void SensorQMI8658::setDataLockingEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1704 of file SensorQMI8658.hpp.

Referenced by setup().

◆ setGyroDataReadyCallback()

void SensorQMI8658::setGyroDataReadyCallback ( DataReadyCallback  callback)

Set callback for gyroscope data ready.

Parameters
callbackCallback function.

Definition at line 1916 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onGyroDataReady.

◆ setGyroDataReadyCallBack()

void SensorQMI8658::setGyroDataReadyCallBack ( EventCallBack_t  cb)
inline

Definition at line 1694 of file SensorQMI8658.hpp.

◆ setGyroFullScaleRange()

bool SensorQMI8658::setGyroFullScaleRange ( GyroFullScaleRange  range)
overridevirtual

Set gyroscope full scale range.

Parameters
rangeFull scale range setting.
Returns
true if set successfully, false otherwise.

Implements ImuBase.

Definition at line 572 of file SensorQMI8658.cpp.

References _gyro_range, _gyro_scale, getGyroRangeRegValue(), getGyroScaleFromRange(), and SensorCommWrapper::updateBits().

◆ setGyroOffset() [1/2]

void SensorQMI8658::setGyroOffset ( int16_t  offset_x,
int16_t  offset_y,
int16_t  offset_z 
)
inline

Write gyroscope calibration offsets.

Note
This function writes the calibration offsets for the gyroscope, this offset change is lost when the sensor is power cycled, or the system is reset
Parameters
offset_xOffset value for the X axis
offset_yOffset value for the Y axis
offset_zOffset value for the Z axis
Return values
None

Definition at line 2025 of file SensorQMI8658.hpp.

References sensorlib::_highByte(), sensorlib::_lowByte(), DeviceBeginCommon::comm, CTRL_CMD_GYRO_HOST_DELTA_OFFSET, QMI8658_REG_CAL1_L, QMI8658_REG_CAL2_L, QMI8658_REG_CAL3_L, and writeCommand().

◆ setGyroOffset() [2/2]

void SensorQMI8658::setGyroOffset ( int16_t  x,
int16_t  y,
int16_t  z 
)

Set gyroscope host delta offsets.

Parameters
xX-axis offset.
yY-axis offset.
zZ-axis offset.

Definition at line 1193 of file SensorQMI8658.cpp.

References CTRL_CMD_GYRO_HOST_DELTA_OFFSET, writeCommand(), SensorCommWrapper::writeRegBuff(), x, and y.

◆ setGyroOutputDataRate()

bool SensorQMI8658::setGyroOutputDataRate ( float  data_rate_hz)
overridevirtual

Set gyroscope output data rate.

Parameters
data_rate_hzOutput data rate in Hz.
Returns
true if set successfully, false otherwise.

Implements ImuBase.

Definition at line 584 of file SensorQMI8658.cpp.

References _gyro_odr, findClosestGyroOdr(), and SensorCommWrapper::updateBits().

◆ setIntPin()

void SensorQMI8658::setIntPin ( int  pin)

Backward-compatible alias of setPins.

Parameters
pinGPIO pin number.

Definition at line 823 of file SensorQMI8658.cpp.

References setPins().

◆ setNoMotionCallback()

void SensorQMI8658::setNoMotionCallback ( MotionCallback  callback)

Set callback for no-motion event.

Parameters
callbackCallback function.

Definition at line 1886 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onNoMotion.

Referenced by setup().

◆ setNoMotionEventCallBack()

void SensorQMI8658::setNoMotionEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1679 of file SensorQMI8658.hpp.

◆ setOperationMode()

bool SensorQMI8658::setOperationMode ( OperationMode  mode)
overridevirtual

Set IMU operation mode.

Parameters
modeTarget operation mode.
Returns
true if mode switch successful, false otherwise.

Implements ImuBase.

Definition at line 338 of file SensorQMI8658.cpp.

References SensorCommWrapper::clrRegBit(), disableAccel(), disableGyro(), NORMAL, SensorCommWrapper::setRegBit(), and SUSPEND.

◆ setPedometerCallback()

void SensorQMI8658::setPedometerCallback ( MotionCallback  callback)

Set callback for pedometer event.

Parameters
callbackCallback function.

Definition at line 1906 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onPedometer.

Referenced by setup().

◆ setPedometerEventCallBack()

void SensorQMI8658::setPedometerEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1674 of file SensorQMI8658.hpp.

Referenced by setup().

◆ setPins() [1/2]

void SensorQMI8658::setPins ( int  _irq)
inline

Set sensor interrupt pins.

Note
This function sets the interrupt pins for the sensor.
Parameters
_irqInterrupt pin number
Return values
None

Definition at line 244 of file SensorQMI8658.hpp.

◆ setPins() [2/2]

void SensorQMI8658::setPins ( int  pin)

Set interrupt pin.

Parameters
pinGPIO pin number.

Definition at line 815 of file SensorQMI8658.cpp.

References _int_pin, and DeviceBeginCommon::hal.

Referenced by setIntPin(), and setup().

◆ setSignificantMotionCallback()

void SensorQMI8658::setSignificantMotionCallback ( MotionCallback  callback)

Set callback for significant motion event.

Parameters
callbackCallback function.

Definition at line 1891 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onSignificantMotion.

◆ setSignificantMotionEventCallBack()

void SensorQMI8658::setSignificantMotionEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1689 of file SensorQMI8658.hpp.

◆ setTapCallback()

void SensorQMI8658::setTapCallback ( TapCallback  callback)

Set callback for tap event.

Parameters
callbackCallback function.

Definition at line 1901 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onTap.

Referenced by setup().

◆ setTapEventCallBack()

void SensorQMI8658::setTapEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1669 of file SensorQMI8658.hpp.

Referenced by setup().

◆ setWakeOnMotionCallback()

void SensorQMI8658::setWakeOnMotionCallback ( MotionCallback  callback)

Set callback for wake-on-motion event.

Parameters
callbackCallback function.

Definition at line 1896 of file SensorQMI8658.cpp.

References callbacks, and SensorQMI8658::EventCallbacks::onWakeOnMotion.

Referenced by setup().

◆ setWakeupMotionEventCallBack()

void SensorQMI8658::setWakeupMotionEventCallBack ( EventCallBack_t  cb)
inline

Definition at line 1664 of file SensorQMI8658.hpp.

Referenced by setup().

◆ update() [1/2]

◆ update() [2/2]

uint16_t SensorQMI8658::update ( )
inline

Update sensor status.

Note
This function updates the sensor status by reading the interrupt status and status registers
Return values
Updatedsensor status

Definition at line 1552 of file SensorQMI8658.hpp.

References ASYNC_MODE, DeviceBeginCommon::comm, QMI8658_REG_STATUS_INT, STATUS0_ACCEL_DATA_READY, STATUS0_GYRO_DATA_READY, STATUS1_ANY_MOTION, STATUS1_NO_MOTION, STATUS1_PEDOMETER_MOTION, STATUS1_SIGNIFICANT_MOTION, STATUS1_TAP_MOTION, STATUS1_WOM_MOTION, STATUS_INT_AVAIL, STATUS_INT_CTRL9_CMD_DONE, and STATUS_INT_LOCKED.

◆ whoAmI()

int SensorQMI8658::whoAmI ( )
inline

Get the WHO_AM_I register value.

Note
This register is used to identify the device
Return values
WHO_AM_Iregister value

Definition at line 298 of file SensorQMI8658.hpp.

References DeviceBeginCommon::comm, and QMI8658_REG_WHOAMI.

Referenced by initImpl().

◆ writeCalibration() [1/2]

bool SensorQMI8658::writeCalibration ( uint16_t  gX_gain,
uint16_t  gY_gain,
uint16_t  gZ_gain 
)
inline

Write Gyroscope calibration gains.

Note
This function writes the calibration gains for the gyroscope
Parameters
gX_gainGain value for the X axis
gY_gainGain value for the Y axis
gZ_gainGain value for the Z axis
Return values
Trueif successful, false otherwise

Definition at line 1796 of file SensorQMI8658.hpp.

References sensorlib::_highByte(), sensorlib::_lowByte(), DeviceBeginCommon::comm, CTRL_CMD_APPLY_GYRO_GAINS, QMI8658_REG_CAL1_L, QMI8658_REG_CTRL7, and writeCommand().

◆ writeCalibration() [2/2]

bool SensorQMI8658::writeCalibration ( uint16_t  gyro_x_gain,
uint16_t  gyro_y_gain,
uint16_t  gyro_z_gain 
)

Write previously saved gyro calibration gains.

Parameters
gyro_x_gainX-axis gyro gain.
gyro_y_gainY-axis gyro gain.
gyro_z_gainZ-axis gyro gain.
Returns
true if write successful, false otherwise.

Definition at line 1155 of file SensorQMI8658.cpp.

References _accel_enabled, _gyro_enabled, CTRL_CMD_APPLY_GYRO_GAINS, disableAccel(), disableGyro(), writeCommand(), and SensorCommWrapper::writeRegBuff().

Referenced by setup().

◆ writeCommand()

Member Data Documentation

◆ _accel_cali_offset

int16_t SensorQMI8658::_accel_cali_offset[3]
protected

◆ _accel_cali_sum

int32_t SensorQMI8658::_accel_cali_sum[3]
protected

◆ _accel_enabled

◆ _accel_odr

float SensorQMI8658::_accel_odr
protected

Definition at line 979 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by configAccel(), and setAccelOutputDataRate().

◆ _accel_range

AccelFullScaleRange SensorQMI8658::_accel_range
protected

Definition at line 975 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by configAccel(), and setAccelFullScaleRange().

◆ _accel_scale

float SensorQMI8658::_accel_scale
protected

◆ _accel_speed_buffer

float SensorQMI8658::_accel_speed_buffer[DYN_CAL_BUFFER_SIZE]
protected

◆ _accel_static_deviation

float SensorQMI8658::_accel_static_deviation
protected

◆ _axis_layout

Layout SensorQMI8658::_axis_layout
protected

◆ _dyn_cal_enabled

bool SensorQMI8658::_dyn_cal_enabled
protected

◆ _dyn_cali_sample_count

uint8_t SensorQMI8658::_dyn_cali_sample_count
protected

◆ _dyn_gyro_offset

int16_t SensorQMI8658::_dyn_gyro_offset[3]
protected

◆ _dyn_gyro_sum

int32_t SensorQMI8658::_dyn_gyro_sum[3]
protected

◆ _dyn_offset_applied

uint8_t SensorQMI8658::_dyn_offset_applied
protected

◆ _dyn_static_delay

uint32_t SensorQMI8658::_dyn_static_delay
protected

◆ _dyn_static_flag

uint8_t SensorQMI8658::_dyn_static_flag
protected

◆ _fifo_buffer

uint8_t* SensorQMI8658::_fifo_buffer
protected

Definition at line 1014 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by readFromFifo(), and ~SensorQMI8658().

◆ _fifo_buffer_size

uint16_t SensorQMI8658::_fifo_buffer_size
protected

Definition at line 1015 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by readFromFifo(), and ~SensorQMI8658().

◆ _fifo_enabled

bool SensorQMI8658::_fifo_enabled
protected

Definition at line 995 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by configFifo(), configureFifo(), and readFromFifo().

◆ _fifo_mode

uint8_t SensorQMI8658::_fifo_mode = 0x00
protected

◆ _fifo_watermark

uint8_t SensorQMI8658::_fifo_watermark
protected

Definition at line 997 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by configFifo(), and configureFifo().

◆ _firmware_version

uint32_t SensorQMI8658::_firmware_version
protected

Definition at line 1009 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by getFirmwareVersion(), and initImpl().

◆ _gyro_cali_offset

int16_t SensorQMI8658::_gyro_cali_offset[3]
protected

◆ _gyro_cali_sum

int32_t SensorQMI8658::_gyro_cali_sum[3]
protected

◆ _gyro_enabled

◆ _gyro_odr

float SensorQMI8658::_gyro_odr
protected

Definition at line 980 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by configGyro(), and setGyroOutputDataRate().

◆ _gyro_range

GyroFullScaleRange SensorQMI8658::_gyro_range
protected

Definition at line 976 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by configGyro(), and setGyroFullScaleRange().

◆ _gyro_scale

float SensorQMI8658::_gyro_scale
protected

◆ _gyro_speed_buffer

float SensorQMI8658::_gyro_speed_buffer[DYN_CAL_BUFFER_SIZE]
protected

◆ _gyro_static_deviation

float SensorQMI8658::_gyro_static_deviation
protected

◆ _hw_st_accel_result

float SensorQMI8658::_hw_st_accel_result[3]
protected

◆ _hw_st_gyro_result

float SensorQMI8658::_hw_st_gyro_result[3]
protected

◆ _int_enabled

bool SensorQMI8658::_int_enabled
protected

◆ _int_pin

int SensorQMI8658::_int_pin
protected

Definition at line 999 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by initImpl(), isDataReady(), and setPins().

◆ _int_pin_mask

uint8_t SensorQMI8658::_int_pin_mask
protected

Definition at line 1000 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by disableInterrupt(), and enableInterrupt().

◆ _last_step_count

uint32_t SensorQMI8658::_last_step_count
protected

Definition at line 1002 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by enablePedometer(), and update().

◆ _last_tap_event

TapEvent SensorQMI8658::_last_tap_event
protected

Definition at line 1004 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ _last_tap_event_ms

uint32_t SensorQMI8658::_last_tap_event_ms
protected

Definition at line 1005 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ _last_timestamp

uint32_t SensorQMI8658::_last_timestamp
protected

Definition at line 1007 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by getTimestamp().

◆ _motion_any_configured

bool SensorQMI8658::_motion_any_configured
protected

◆ _motion_any_thr

uint8_t SensorQMI8658::_motion_any_thr[3]
protected

Definition at line 985 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by applyMotionConfig(), and configMotionDetect().

◆ _motion_any_window

uint8_t SensorQMI8658::_motion_any_window
protected

Definition at line 987 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by applyMotionConfig(), and configMotionDetect().

◆ _motion_no_configured

bool SensorQMI8658::_motion_no_configured
protected

◆ _motion_no_thr

uint8_t SensorQMI8658::_motion_no_thr[3]
protected

Definition at line 986 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by applyMotionConfig(), and configMotionDetect().

◆ _motion_no_window

uint8_t SensorQMI8658::_motion_no_window
protected

Definition at line 988 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by applyMotionConfig(), and configMotionDetect().

◆ _motion_sig_configured

bool SensorQMI8658::_motion_sig_configured
protected

◆ _motion_sig_confirm_window

uint16_t SensorQMI8658::_motion_sig_confirm_window
protected

Definition at line 990 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by applyMotionConfig(), and configMotionDetect().

◆ _motion_sig_wait_window

uint16_t SensorQMI8658::_motion_sig_wait_window
protected

Definition at line 989 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by applyMotionConfig().

◆ _static_cali_complete

bool SensorQMI8658::_static_cali_complete
protected

◆ _static_cali_enabled

bool SensorQMI8658::_static_cali_enabled
protected

◆ _static_cali_sample_count

uint16_t SensorQMI8658::_static_cali_sample_count
protected

◆ _sync_mode

bool SensorQMI8658::_sync_mode
protected

◆ _tap_event_active

bool SensorQMI8658::_tap_event_active
protected

Definition at line 1003 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ _usid

uint8_t SensorQMI8658::_usid[6]
protected

Definition at line 1010 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by getChipUsid(), initImpl(), and SensorQMI8658().

◆ callbacks

◆ DYN_CAL_BUFFER_SIZE

constexpr uint8_t SensorQMI8658::DYN_CAL_BUFFER_SIZE = 10
staticconstexprprotected

Definition at line 1028 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by processDynamicCalibration().

◆ DYN_CAL_STATIC_COUNT

constexpr uint8_t SensorQMI8658::DYN_CAL_STATIC_COUNT = 12
staticconstexprprotected

Definition at line 1029 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by processDynamicCalibration().

◆ HW_ST_ACCEL_THRESHOLD_MG

constexpr float SensorQMI8658::HW_ST_ACCEL_THRESHOLD_MG = 200.0f
staticconstexprprotected

Definition at line 1042 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by hardwareSelfTest().

◆ HW_ST_GYRO_THRESHOLD_DPS

constexpr float SensorQMI8658::HW_ST_GYRO_THRESHOLD_DPS = 300.0f
staticconstexprprotected

Definition at line 1043 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by hardwareSelfTest().

◆ MAX_STATIC_CALI_SAMPLES

constexpr uint16_t SensorQMI8658::MAX_STATIC_CALI_SAMPLES = 100
staticconstexprprotected

Definition at line 1019 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by processStaticCalibration().

◆ QMI8658_ACCEL_EN_MASK

constexpr uint8_t SensorQMI8658::QMI8658_ACCEL_EN_MASK = 0x01
staticconstexprprotected

Definition at line 2396 of file SensorQMI8658.hpp.

◆ QMI8658_ACCEL_GYRO_EN_MASK

constexpr uint8_t SensorQMI8658::QMI8658_ACCEL_GYRO_EN_MASK = 0x03
staticconstexprprotected

Definition at line 2398 of file SensorQMI8658.hpp.

◆ QMI8658_ACCEL_LPF_MASK

constexpr uint8_t SensorQMI8658::QMI8658_ACCEL_LPF_MASK = 0xF9
staticconstexprprotected

Definition at line 2393 of file SensorQMI8658.hpp.

Referenced by configAccelerometer().

◆ QMI8658_FIFO_MAP_INT1

constexpr uint8_t SensorQMI8658::QMI8658_FIFO_MAP_INT1 = 0x04
staticconstexprprotected

Definition at line 2401 of file SensorQMI8658.hpp.

◆ QMI8658_GYRO_EN_MASK

constexpr uint8_t SensorQMI8658::QMI8658_GYRO_EN_MASK = 0x02
staticconstexprprotected

Definition at line 2397 of file SensorQMI8658.hpp.

◆ QMI8658_GYRO_LPF_MASK

constexpr uint8_t SensorQMI8658::QMI8658_GYRO_LPF_MASK = 0x9F
staticconstexprprotected

Definition at line 2394 of file SensorQMI8658.hpp.

Referenced by configGyroscope().

◆ QMI8658_REG_AX_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_AX_H = 0x36
staticconstexprprotected

Definition at line 2347 of file SensorQMI8658.hpp.

◆ QMI8658_REG_AX_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_AX_L = 0x35
staticconstexprprotected

Definition at line 2346 of file SensorQMI8658.hpp.

Referenced by getAccelRaw().

◆ QMI8658_REG_AY_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_AY_H = 0x38
staticconstexprprotected

Definition at line 2349 of file SensorQMI8658.hpp.

◆ QMI8658_REG_AY_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_AY_L = 0x37
staticconstexprprotected

Definition at line 2348 of file SensorQMI8658.hpp.

◆ QMI8658_REG_AZ_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_AZ_H = 0x3A
staticconstexprprotected

Definition at line 2351 of file SensorQMI8658.hpp.

◆ QMI8658_REG_AZ_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_AZ_L = 0x39
staticconstexprprotected

Definition at line 2350 of file SensorQMI8658.hpp.

◆ QMI8658_REG_CAL1_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL1_H = 0x0C
staticconstexprprotected

Definition at line 2318 of file SensorQMI8658.hpp.

Referenced by configMotion(), configPedometer(), configTap(), and configWakeOnMotion().

◆ QMI8658_REG_CAL1_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL1_L = 0x0B
staticconstexprprotected

◆ QMI8658_REG_CAL2_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL2_H = 0x0E
staticconstexprprotected

Definition at line 2320 of file SensorQMI8658.hpp.

Referenced by configMotion(), configPedometer(), and configTap().

◆ QMI8658_REG_CAL2_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL2_L = 0x0D
staticconstexprprotected

◆ QMI8658_REG_CAL3_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL3_H = 0x10
staticconstexprprotected

Definition at line 2322 of file SensorQMI8658.hpp.

Referenced by configMotion(), configPedometer(), and configTap().

◆ QMI8658_REG_CAL3_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL3_L = 0x0F
staticconstexprprotected

◆ QMI8658_REG_CAL4_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL4_H = 0x12
staticconstexprprotected

Definition at line 2324 of file SensorQMI8658.hpp.

Referenced by configMotion(), configPedometer(), and configTap().

◆ QMI8658_REG_CAL4_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_CAL4_L = 0x11
staticconstexprprotected

Definition at line 2323 of file SensorQMI8658.hpp.

Referenced by configMotion(), and configPedometer().

◆ QMI8658_REG_COD_STATUS

constexpr uint8_t SensorQMI8658::QMI8658_REG_COD_STATUS = 0x46
staticconstexprprotected

Definition at line 2362 of file SensorQMI8658.hpp.

Referenced by calibration().

◆ QMI8658_REG_CTRL1

constexpr uint8_t SensorQMI8658::QMI8658_REG_CTRL1 = 0x02
staticconstexprprotected

Definition at line 2306 of file SensorQMI8658.hpp.

Referenced by configFIFO(), dumpCtrlRegister(), enableINT(), powerDown(), powerOn(), and reset().

◆ QMI8658_REG_CTRL2

constexpr uint8_t SensorQMI8658::QMI8658_REG_CTRL2 = 0x03
staticconstexprprotected

Definition at line 2307 of file SensorQMI8658.hpp.

Referenced by configAccelerometer(), configWakeOnMotion(), and selfTestAccel().

◆ QMI8658_REG_CTRL3

constexpr uint8_t SensorQMI8658::QMI8658_REG_CTRL3 = 0x04
staticconstexprprotected

Definition at line 2308 of file SensorQMI8658.hpp.

Referenced by configGyroscope(), and selfTestGyro().

◆ QMI8658_REG_CTRL5

constexpr uint8_t SensorQMI8658::QMI8658_REG_CTRL5 = 0x06
staticconstexprprotected

Definition at line 2310 of file SensorQMI8658.hpp.

Referenced by configAccelerometer(), and configGyroscope().

◆ QMI8658_REG_CTRL7

◆ QMI8658_REG_CTRL8

constexpr uint8_t SensorQMI8658::QMI8658_REG_CTRL8 = 0x09
staticconstexprprotected

◆ QMI8658_REG_CTRL9

constexpr uint8_t SensorQMI8658::QMI8658_REG_CTRL9 = 0x0A
staticconstexprprotected

Definition at line 2314 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DQW_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQW_H = 0x4A
staticconstexprprotected

Definition at line 2364 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DQW_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQW_L = 0x49
staticconstexprprotected

Definition at line 2363 of file SensorQMI8658.hpp.

Referenced by initImpl().

◆ QMI8658_REG_DQX_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQX_H = 0x4C
staticconstexprprotected

Definition at line 2366 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DQX_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQX_L = 0x4B
staticconstexprprotected

Definition at line 2365 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DQY_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQY_H = 0x4E
staticconstexprprotected

Definition at line 2369 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DQY_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQY_L = 0x4D
staticconstexprprotected

Definition at line 2368 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DQZ_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQZ_H = 0x50
staticconstexprprotected

Definition at line 2371 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DQZ_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_DQZ_L = 0x4F
staticconstexprprotected

Definition at line 2370 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DVX_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_DVX_H = 0x52
staticconstexprprotected

Definition at line 2374 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DVX_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_DVX_L = 0x51
staticconstexprprotected

Definition at line 2373 of file SensorQMI8658.hpp.

Referenced by calibration(), initImpl(), selfTestAccel(), and selfTestGyro().

◆ QMI8658_REG_DVY_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_DVY_H = 0x54
staticconstexprprotected

Definition at line 2376 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DVY_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_DVY_L = 0x53
staticconstexprprotected

Definition at line 2375 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DVZ_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_DVZ_H = 0x56
staticconstexprprotected

Definition at line 2378 of file SensorQMI8658.hpp.

◆ QMI8658_REG_DVZ_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_DVZ_L = 0x55
staticconstexprprotected

Definition at line 2377 of file SensorQMI8658.hpp.

◆ QMI8658_REG_FIFO_COUNT

constexpr uint8_t SensorQMI8658::QMI8658_REG_FIFO_COUNT = 0x15
staticconstexprprotected

Definition at line 2329 of file SensorQMI8658.hpp.

◆ QMI8658_REG_FIFO_CTRL

constexpr uint8_t SensorQMI8658::QMI8658_REG_FIFO_CTRL = 0x14
staticconstexprprotected

Definition at line 2328 of file SensorQMI8658.hpp.

Referenced by configFIFO(), and dumpCtrlRegister().

◆ QMI8658_REG_FIFO_DATA

constexpr uint8_t SensorQMI8658::QMI8658_REG_FIFO_DATA = 0x17
staticconstexprprotected

Definition at line 2331 of file SensorQMI8658.hpp.

◆ QMI8658_REG_FIFO_STATUS

constexpr uint8_t SensorQMI8658::QMI8658_REG_FIFO_STATUS = 0x16
staticconstexprprotected

Definition at line 2330 of file SensorQMI8658.hpp.

◆ QMI8658_REG_FIFO_WTM_TH

constexpr uint8_t SensorQMI8658::QMI8658_REG_FIFO_WTM_TH = 0x13
staticconstexprprotected

Definition at line 2327 of file SensorQMI8658.hpp.

Referenced by configFIFO().

◆ QMI8658_REG_GX_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_GX_H = 0x3C
staticconstexprprotected

Definition at line 2353 of file SensorQMI8658.hpp.

◆ QMI8658_REG_GX_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_GX_L = 0x3B
staticconstexprprotected

Definition at line 2352 of file SensorQMI8658.hpp.

Referenced by getGyroRaw().

◆ QMI8658_REG_GY_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_GY_H = 0x3E
staticconstexprprotected

Definition at line 2355 of file SensorQMI8658.hpp.

◆ QMI8658_REG_GY_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_GY_L = 0x3D
staticconstexprprotected

Definition at line 2354 of file SensorQMI8658.hpp.

◆ QMI8658_REG_GZ_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_GZ_H = 0x40
staticconstexprprotected

Definition at line 2357 of file SensorQMI8658.hpp.

◆ QMI8658_REG_GZ_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_GZ_L = 0x3F
staticconstexprprotected

Definition at line 2356 of file SensorQMI8658.hpp.

◆ QMI8658_REG_RESET

constexpr uint8_t SensorQMI8658::QMI8658_REG_RESET = 0x60
staticconstexprprotected

Definition at line 2385 of file SensorQMI8658.hpp.

Referenced by reset().

◆ QMI8658_REG_RESET_DEFAULT

constexpr uint8_t SensorQMI8658::QMI8658_REG_RESET_DEFAULT = 0xB0
staticconstexprprotected

Definition at line 2297 of file SensorQMI8658.hpp.

Referenced by reset().

◆ QMI8658_REG_REVISION

constexpr uint8_t SensorQMI8658::QMI8658_REG_REVISION = 0x01
staticconstexprprotected

Definition at line 2302 of file SensorQMI8658.hpp.

Referenced by getChipID().

◆ QMI8658_REG_RST_RESULT

constexpr uint8_t SensorQMI8658::QMI8658_REG_RST_RESULT = 0x4D
staticconstexprprotected

Definition at line 2388 of file SensorQMI8658.hpp.

Referenced by reset().

◆ QMI8658_REG_RST_RESULT_VAL

constexpr uint8_t SensorQMI8658::QMI8658_REG_RST_RESULT_VAL = 0x80
staticconstexprprotected

Definition at line 2389 of file SensorQMI8658.hpp.

Referenced by reset().

◆ QMI8658_REG_STATUS0

constexpr uint8_t SensorQMI8658::QMI8658_REG_STATUS0 = 0x2E
staticconstexprprotected

Definition at line 2335 of file SensorQMI8658.hpp.

Referenced by getDataReady().

◆ QMI8658_REG_STATUS1

constexpr uint8_t SensorQMI8658::QMI8658_REG_STATUS1 = 0x2F
staticconstexprprotected

Definition at line 2336 of file SensorQMI8658.hpp.

Referenced by getStatusRegister().

◆ QMI8658_REG_STATUS_DEFAULT

constexpr uint8_t SensorQMI8658::QMI8658_REG_STATUS_DEFAULT = 0x03
staticconstexprprotected

Definition at line 2296 of file SensorQMI8658.hpp.

◆ QMI8658_REG_STATUS_INT

constexpr uint8_t SensorQMI8658::QMI8658_REG_STATUS_INT = 0x2D
staticconstexprprotected

Definition at line 2334 of file SensorQMI8658.hpp.

Referenced by getDataReady(), getIrqStatus(), selfTestAccel(), selfTestGyro(), and update().

◆ QMI8658_REG_STEP_CNT_HIGH

constexpr uint8_t SensorQMI8658::QMI8658_REG_STEP_CNT_HIGH = 0x5C
staticconstexprprotected

Definition at line 2384 of file SensorQMI8658.hpp.

◆ QMI8658_REG_STEP_CNT_LOW

constexpr uint8_t SensorQMI8658::QMI8658_REG_STEP_CNT_LOW = 0x5A
staticconstexprprotected

Definition at line 2382 of file SensorQMI8658.hpp.

Referenced by getPedometerCounter().

◆ QMI8658_REG_STEP_CNT_MID

constexpr uint8_t SensorQMI8658::QMI8658_REG_STEP_CNT_MID = 0x5B
staticconstexprprotected

Definition at line 2383 of file SensorQMI8658.hpp.

◆ QMI8658_REG_TAP_STATUS

constexpr uint8_t SensorQMI8658::QMI8658_REG_TAP_STATUS = 0x59
staticconstexprprotected

Definition at line 2381 of file SensorQMI8658.hpp.

Referenced by getTapStatus().

◆ QMI8658_REG_TEMPERATURE_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_TEMPERATURE_H = 0x34
staticconstexprprotected

Definition at line 2345 of file SensorQMI8658.hpp.

◆ QMI8658_REG_TEMPERATURE_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_TEMPERATURE_L = 0x33
staticconstexprprotected

Definition at line 2344 of file SensorQMI8658.hpp.

Referenced by getTemperature_C().

◆ QMI8658_REG_TIMESTAMP_H

constexpr uint8_t SensorQMI8658::QMI8658_REG_TIMESTAMP_H = 0x32
staticconstexprprotected

Definition at line 2341 of file SensorQMI8658.hpp.

◆ QMI8658_REG_TIMESTAMP_L

constexpr uint8_t SensorQMI8658::QMI8658_REG_TIMESTAMP_L = 0x30
staticconstexprprotected

Definition at line 2339 of file SensorQMI8658.hpp.

Referenced by getTimestamp().

◆ QMI8658_REG_TIMESTAMP_M

constexpr uint8_t SensorQMI8658::QMI8658_REG_TIMESTAMP_M = 0x31
staticconstexprprotected

Definition at line 2340 of file SensorQMI8658.hpp.

◆ QMI8658_REG_WHOAMI

constexpr uint8_t SensorQMI8658::QMI8658_REG_WHOAMI = 0x00
staticconstexprprotected

Definition at line 2301 of file SensorQMI8658.hpp.

Referenced by whoAmI().

◆ QMI8658_REG_WHOAMI_DEFAULT

constexpr uint8_t SensorQMI8658::QMI8658_REG_WHOAMI_DEFAULT = 0x05
staticconstexprprotected

Definition at line 2295 of file SensorQMI8658.hpp.

Referenced by initImpl().

◆ STATUS0_ACCEL_AVAIL

constexpr uint8_t SensorQMI8658::STATUS0_ACCEL_AVAIL = 0x01
staticconstexprprotected

Definition at line 2391 of file SensorQMI8658.hpp.

◆ STATUS0_GYRO_AVAIL

constexpr uint8_t SensorQMI8658::STATUS0_GYRO_AVAIL = 0x02
staticconstexprprotected

Definition at line 2392 of file SensorQMI8658.hpp.

◆ STATUS_ANY_MOTION_EVENT

constexpr uint8_t SensorQMI8658::STATUS_ANY_MOTION_EVENT = sensorlib::_bv(5)
staticconstexprprotected

Definition at line 971 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ STATUS_NO_MOTION_EVENT

constexpr uint8_t SensorQMI8658::STATUS_NO_MOTION_EVENT = sensorlib::_bv(6)
staticconstexprprotected

Definition at line 972 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ STATUS_PEDOMETER_EVENT

constexpr uint8_t SensorQMI8658::STATUS_PEDOMETER_EVENT = sensorlib::_bv(4)
staticconstexprprotected

Definition at line 970 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ STATUS_SIGNIFICANT_MOTION

constexpr uint8_t SensorQMI8658::STATUS_SIGNIFICANT_MOTION = sensorlib::_bv(7)
staticconstexprprotected

Definition at line 973 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ STATUS_TAP_EVENT

constexpr uint8_t SensorQMI8658::STATUS_TAP_EVENT = sensorlib::_bv(1)
staticconstexprprotected

Definition at line 968 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().

◆ STATUS_WOM_EVENT

constexpr uint8_t SensorQMI8658::STATUS_WOM_EVENT = sensorlib::_bv(2)
staticconstexprprotected

Definition at line 969 of file sensor/imu/qmi8658/SensorQMI8658.hpp.

Referenced by update().


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