33#if !SENSORLIB_EXCLUDE_QMI8658
35#pragma message("Warning: Please replace with a new driver. Please refer to the examples/QMI8658 example. SensorQMI8658.hpp will be removed in the next version.")
40static constexpr uint8_t QMI8658_L_SLAVE_ADDRESS = (0x6B);
41static constexpr uint8_t QMI8658_H_SLAVE_ADDRESS = (0x6A);
256 bool reset(
bool waitResult =
true, uint32_t timeout = 500)
262 uint32_t start =
hal->millis();
263 while (
hal->millis() - start < timeout) {
274 SENSORLIB_LOG_E(
"Reset chip failed, Response val = %d - 0x%X", val, val);
313 timestamp = (uint32_t)(((uint32_t)buffer[2] << 16) |
314 ((uint32_t)buffer[1] << 8) | buffer[0]);
318 lastTimestamp = (
timestamp + 0x1000000 - lastTimestamp);
321 return lastTimestamp;
332 return (
float)buffer[1] + ((float)buffer[0] / 256.0);
347 _irq_enable_mask = enable ? _irq_enable_mask | 0x01 : _irq_enable_mask & 0xFE;
351 _irq_enable_mask = enable ? _irq_enable_mask | 0x02 : _irq_enable_mask & 0xFD;
404 accelScales = 2.0 / 32768.0;
407 accelScales = 4.0 / 32768.0;
410 accelScales = 8.0 / 32768.0;
413 accelScales = 16.0 / 32768.0;
472 gyroScales = 16.0 / 32768.0;
475 gyroScales = 32.0 / 32768.0;
478 gyroScales = 64.0 / 32768.0;
481 gyroScales = 128.0 / 32768.0;
484 gyroScales = 256.0 / 32768.0;
487 gyroScales = 512.0 / 32768.0;
490 gyroScales = 1024.0 / 32768.0;
550 _fifo_interrupt =
true;
561 _fifo_interrupt =
false;
591 if ((res & 0x02) == 0x02) {
593 }
else if ((res & 0x01) == 0x01) {
595 }
else if ((res & 0x03) == 0x00) {
599 if ((res & 0x03) == 0x03) {
601 }
else if ((res & 0x02) == 0x02) {
603 }
else if ((res & 0x01) == 0x01) {
605 }
else if ((res & 0x03) == 0x00) {
634 if (data_bytes == 0) {
644 uint16_t samples_per_sensor = data_bytes / (6 * enabled_sensor_count);
645 uint16_t total_samples = samples_per_sensor * enabled_sensor_count;
649 uint16_t accel_index = 0;
650 uint16_t gyro_index = 0;
652 for (uint16_t
i = 0;
i < total_samples; ++
i) {
653 auto data =
reinterpret_cast < int16_t *
> (&fifo_buffer[
i * 6]);
661 if (accel_index < accLength) {
662 acc[accel_index].
x =
x * accelScales;
663 acc[accel_index].
y =
y * accelScales;
664 acc[accel_index].
z = z * accelScales;
669 if (gyro_index < gyrLength) {
670 gyro[gyro_index].
x =
x * gyroScales;
671 gyro[gyro_index].
y =
y * gyroScales;
672 gyro[gyro_index].
z = z * gyroScales;
677 if (accel_index < accLength) {
678 acc[accel_index].
x =
x * accelScales;
679 acc[accel_index].
y =
y * accelScales;
680 acc[accel_index].
z = z * accelScales;
684 if (gyro_index < gyrLength) {
685 gyro[gyro_index].
x =
x * gyroScales;
686 gyro[gyro_index].
y =
y * gyroScales;
687 gyro[gyro_index].
z = z * gyroScales;
692 return samples_per_sensor;
780 uint8_t buffer[6] = {0};
782 rawBuffer[0] = (int16_t)(buffer[1] << 8) | (buffer[0]);
783 rawBuffer[1] = (int16_t)(buffer[3] << 8) | (buffer[2]);
784 rawBuffer[2] = (int16_t)(buffer[5] << 8) | (buffer[4]);
806 x = raw[0] * accelScales;
807 y = raw[1] * accelScales;
808 z = raw[2] * accelScales;
845 uint8_t buffer[6] = {0};
847 rawBuffer[0] = (int16_t)(buffer[1] << 8) | (buffer[0]);
848 rawBuffer[1] = (int16_t)(buffer[3] << 8) | (buffer[2]);
849 rawBuffer[2] = (int16_t)(buffer[5] << 8) | (buffer[4]);
871 x = raw[0] * gyroScales;
872 y = raw[1] * gyroScales;
873 z = raw[2] * gyroScales;
886 if ((_irq_enable_mask & 0x03) && (_irq != -1)) {
887 if (
hal->digitalRead(_irq)) {
892 switch (sampleMode) {
970 for (
int i = 0;
i < 9; ++
i) {
1050 bool configPedometer(uint16_t ped_sample_cnt, uint16_t ped_fix_peak2peak, uint16_t ped_fix_peak,
1051 uint16_t ped_time_up, uint8_t ped_time_low = 0x14, uint8_t ped_time_cnt_entry = 0x0A, uint8_t ped_fix_precision = 0x00,
1052 uint8_t ped_sig_count = 0x04)
1109 return (uint32_t)(((uint32_t)buffer[2] << 16) | ((uint32_t)buffer[1] << 8) | buffer[0]);
1186 float alpha,
float gamma,
float peakMagThr,
float UDMThr)
1216 uint8_t alphaHex = (uint8_t)(alpha * 128);
1220 uint8_t gammaHex = (uint8_t)(gamma * 128);
1223 const double g = 9.81;
1224 double resolution = 0.001 * g * g;
1226 double acceleration_square = peakMagThr * g * g;
1227 uint16_t value = (uint16_t)(acceleration_square / resolution);
1232 acceleration_square = UDMThr * g * g;
1233 value = (uint16_t)(acceleration_square / resolution);
1293 SENSORLIB_LOG_I(
"Tap was detected on the negative direction of the Tap axis");
1295 SENSORLIB_LOG_I(
"Tap was detected on the positive direction of the Tap axis");
1297 uint8_t t = (val >> 4) & 0x03;
1337 float AnyMotionXThr,
1339 float AnyMotionYThr,
1341 float AnyMotionZThr,
1344 uint8_t AnyMotionWindow,
1353 uint8_t NoMotionWindow,
1356 uint16_t SigMotionWaitWindow,
1359 uint16_t SigMotionConfirmWindow)
1468 uint8_t defaultPinValue = 1,
1469 uint8_t blankingTime = 0x20,
1499 val = defaultPinValue ? 0x02 : 0x00;
1501 val = defaultPinValue ? 0x03 : 0x01;
1505 val |= (blankingTime & 0x3F);
1533 memcpy(buffer, usid, length);
1554 uint16_t result = 0;
1572 if (status[0] & 0x80) {
1579 if (status[0] & 0x02) {
1586 if (status[0] & 0x01) {
1593 if ((status[0] & 0x03) == 0x03) {
1594 if (eventDataLocking)eventDataLocking();
1603 if (status[1] & 0x02) {
1605 if (eventGyroDataReady)eventGyroDataReady();
1611 if (status[1] & 0x01) {
1613 if (eventAccelDataReady)eventAccelDataReady();
1622 if (status[2] & 0x80) {
1624 if (eventSignificantMotion)eventSignificantMotion();
1629 if (status[2] & 0x40) {
1631 if (eventNoMotionEvent)eventNoMotionEvent();
1636 if (status[2] & 0x20) {
1638 if (eventAnyMotionEvent)eventAnyMotionEvent();
1643 if (status[2] & 0x10) {
1645 if (eventPedometerEvent)eventPedometerEvent();
1650 if (status[2] & 0x04) {
1652 if (eventWomEvent)eventWomEvent();
1657 if (status[2] & 0x02) {
1659 if (eventTagEvent)eventTagEvent();
1676 eventPedometerEvent = cb;
1681 eventNoMotionEvent = cb;
1686 eventAnyMotionEvent = cb;
1691 eventSignificantMotion = cb;
1696 eventGyroDataReady = cb;
1701 eventAccelDataReady = cb;
1706 eventDataLocking = cb;
1718 bool calibration(uint16_t *gX_gain = NULL, uint16_t *gY_gain = NULL, uint16_t *gZ_gain = NULL)
1736 if (result == -1)
return false;
1741 SENSORLIB_LOG_E(
"COD failed for checking low sensitivity limit of X axis of gyroscope");
1745 SENSORLIB_LOG_E(
"COD failed for checking high sensitivity limit of X axis of gyroscope");
1749 SENSORLIB_LOG_E(
"COD failed for checking low sensitivity limit of Y axis of gyroscope");
1753 SENSORLIB_LOG_E(
"COD failed for checking high sensitivity limit of Y axis of gyroscope");
1757 SENSORLIB_LOG_E(
"Accelerometer checked failed (significant vibration happened during COD)");
1761 SENSORLIB_LOG_E(
"Gyroscope startup failure happened when COD was called");
1765 SENSORLIB_LOG_E(
"COD was called while gyroscope was enabled, COD return failure");
1774 if (gX_gain && gY_gain && gZ_gain) {
1775 uint8_t rawBuffer[6] = {0};
1779 *gX_gain = ((uint16_t)rawBuffer[0]) | (uint16_t)(rawBuffer[1] << 8);
1780 *gY_gain = ((uint16_t)rawBuffer[2]) | (uint16_t)(rawBuffer[3] << 8);
1781 *gZ_gain = ((uint16_t)rawBuffer[4]) | (uint16_t)(rawBuffer[5] << 8);
1803 uint8_t buffer[] = {
1844 int dataReady = 0x00;
1845 while (dataReady != 0x01) {
1848 dataReady = reg_var & 0x01;
1864 while (dataReady == 0x01) {
1867 dataReady = (reg_var & 0x01);
1883 uint8_t rawBuffer[6];
1889 int16_t dVX = (int16_t)(rawBuffer[0]) | (int16_t)(((int16_t)rawBuffer[1]) << 8);
1890 int16_t dVY = (int16_t)(rawBuffer[2]) | (int16_t)(((int16_t)rawBuffer[3]) << 8);
1891 int16_t dVZ = (int16_t)(rawBuffer[4]) | (int16_t)(((int16_t)rawBuffer[5]) << 8);
1894 float dVX_mg = dVX * 0.5;
1895 float dVY_mg = dVY * 0.5;
1896 float dVZ_mg = dVZ * 0.5;
1898 SENSORLIB_LOG_D(
"\n\tdVX_mg:%05.11f \n\tdVY_mg:%05.11f \n\tdVZ_mg:%05.11f", dVX_mg, dVY_mg, dVZ_mg);
1901 if (abs(dVX_mg) > 200 && abs(dVY_mg) > 200 && abs(dVZ_mg) > 200) {
1928 int dataReady = 0x00;
1929 while (dataReady != 0x01) {
1945 while (dataReady != 0x00) {
1961 uint8_t rawBuffer[6];
1970 float dVX = (((int16_t)rawBuffer[0]) << 12) | ((int16_t)(rawBuffer[1]) >> 4);
1971 float dVY = (((int16_t)rawBuffer[2]) << 12) | ((int16_t)(rawBuffer[3]) >> 4);
1972 float dVZ = (((int16_t)rawBuffer[4]) << 12) | ((int16_t)(rawBuffer[5]) >> 4);
1974 dVX *= (1.0 / (1 << 4));
1975 dVY *= (1.0 / (1 << 4));
1976 dVZ *= (1.0 / (1 << 4));
1978 SENSORLIB_LOG_D(
"\n\tdVX:%12.4f \n\tdVY:%12.4f \n\tdVZ:%12.4f", dVX, dVY, dVZ);
1982 if (abs(dVX) > 300 && abs(dVY) > 300 && abs(dVZ) > 300) {
2047 uint16_t getFifoNeedBytes()
2049 uint8_t sam[] = {16, 32, 64, 128};
2050 uint8_t sensors = 0;
2056 uint8_t samples = ((
_fifo_mode >> 2) & 0x03) ;
2057 return sam[samples] * 6 * sensors;
2069 uint16_t fifo_bytes = 0;
2071 if ((_irq != -1) && _fifo_interrupt) {
2078 if (
hal->digitalRead(_irq) == LOW) {
2083 size_t alloc_size = getFifoNeedBytes();
2085 fifo_buffer = (uint8_t *)calloc(alloc_size,
sizeof(uint8_t));
2090 _fifo_size = alloc_size;
2092 }
else if (alloc_size > _fifo_size) {
2093 fifo_buffer = (uint8_t *)realloc(fifo_buffer, alloc_size);
2112 SENSORLIB_LOG_D(
"FIFO Overflow condition has happened (data dropping happened)");
2129 fifo_bytes = 2 * (((status[1] & 0x03)) << 8 | status[0]);
2169 uint32_t startMillis;
2173 startMillis =
hal->millis();
2177 if (
hal->millis() - startMillis > wait_ms) {
2181 }
while (val != -1 && !(val & 0x80));
2187 startMillis =
hal->millis();
2191 if (
hal->millis() - startMillis > wait_ms) {
2195 }
while (val != -1 && (val & 0x80));
2209 float g = mg / 1000.0;
2210 int units = (int)round(g / 0.03125);
2211 return (units & 0x1F) << 3;
2216 float accelScales = 0.0f, gyroScales = 0.0f;
2219 bool _gDataReady =
false;
2220 bool _aDataReady =
false;
2221 bool _fifo_interrupt =
false;
2225 uint8_t _irq_enable_mask =
false;
2227 uint8_t *fifo_buffer = NULL;
2228 uint16_t _fifo_size = 0;
2230 uint32_t lastTimestamp = 0;
2231 uint32_t revisionID = 0x00;
2248 uint8_t buffer[6] = {0};
2252 hal->pinMode(_irq, INPUT);
2261 SENSORLIB_LOG_E(
"ERROR! ID NOT MATCH QMI8658 , Response id is 0x%x",
id);
2281 revisionID = buffer[0] | (uint32_t)(buffer[1] << 8) | (uint32_t)(buffer[2] << 16);
2282 SENSORLIB_LOG_D(
"FW Version :0x%02X%02X%02X", buffer[0], buffer[1], buffer[2]);
2287 usid[0], usid[1], usid[2],
2288 usid[3], usid[4], usid[5]);
#define SENSORLIB_LOG_I(...)
#define SENSORLIB_LOG_E(...)
#define SENSORLIB_LOG_D(...)
std::unique_ptr< SensorCommBase > comm
std::unique_ptr< SensorHal > hal
QMI8658 IMU sensor driver class.
GyroODR
Gyroscope output data rate enumeration.
bool enableSyncSampleMode()
Enable the synchronous sample mode.
bool reset() override
Reset the IMU sensor to its default state.
void setPedometerEventCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_TIMESTAMP_M
bool getGyroscope(float &x, float &y, float &z)
Get the raw gyroscope data.
void setAccelOffset(int16_t offset_x, int16_t offset_y, int16_t offset_z)
Write accelerometer calibration offsets.
void powerDown()
Power down the sensor.
static constexpr uint8_t QMI8658_REG_TIMESTAMP_L
@ EVENT_SIGNIFICANT_MOTION
@ CTRL_CMD_CONFIGURE_MOTION
@ CTRL_CMD_APPLY_GYRO_GAINS
@ CTRL_CMD_GYRO_HOST_DELTA_OFFSET
@ CTRL_CMD_ON_DEMAND_CALIBRATION
@ CTRL_CMD_WRITE_WOM_SETTING
@ CTRL_CMD_AHB_CLOCK_GATING
@ CTRL_CMD_RESET_PEDOMETER
@ CTRL_CMD_CONFIGURE_PEDOMETER
@ CTRL_CMD_ACCEL_HOST_DELTA_OFFSET
bool disableTap()
Disable tap detection.
float getTemperature_C()
Get the temperature in degree Celsius.
static constexpr uint8_t QMI8658_REG_WHOAMI_DEFAULT
static constexpr uint8_t QMI8658_REG_CAL2_L
static constexpr uint8_t QMI8658_ACCEL_GYRO_EN_MASK
static constexpr uint8_t QMI8658_REG_DVY_H
static constexpr uint8_t QMI8658_REG_TIMESTAMP_H
static constexpr uint8_t QMI8658_REG_STATUS_INT
static constexpr uint8_t QMI8658_REG_FIFO_WTM_TH
static constexpr uint8_t QMI8658_REG_DVZ_H
static constexpr uint8_t QMI8658_REG_COD_STATUS
uint8_t getChipID()
Get the chip ID.
void setGyroDataReadyCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_DQZ_L
static constexpr uint8_t QMI8658_REG_AX_L
static constexpr uint8_t QMI8658_REG_GY_H
bool configTap(uint8_t priority, uint8_t peakWindow, uint16_t tapWindow, uint16_t dTapWindow, float alpha, float gamma, float peakMagThr, float UDMThr)
configTap
static constexpr uint8_t QMI8658_REG_FIFO_DATA
bool disableMotionDetect()
Disable motion detection.
static constexpr uint8_t QMI8658_GYRO_EN_MASK
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)
static constexpr uint8_t QMI8658_REG_STEP_CNT_LOW
void dumpCtrlRegister()
Dump the control register values.
SensorQMI8658()=default
Constructor for SensorQMI8658.
int writeCommand(uint8_t cmd, uint32_t timeout_ms=1000)
static constexpr uint8_t QMI8658_REG_CTRL7
static constexpr uint8_t QMI8658_FIFO_MAP_INT1
static constexpr uint8_t QMI8658_REG_GX_H
void setAnyMotionEventCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_CTRL5
static constexpr uint8_t QMI8658_REG_RESET
uint8_t getIrqStatus()
Get the IRQ status.
bool enableMotionDetect(IntPin pin=INTERRUPT_PIN_1)
Enable motion detection.
static constexpr uint8_t QMI8658_REG_AX_H
static constexpr uint8_t QMI8658_REG_CTRL9
static constexpr uint8_t QMI8658_REG_DQY_H
static constexpr uint8_t QMI8658_REG_GY_L
static constexpr uint8_t QMI8658_REG_CTRL2
static constexpr uint8_t QMI8658_GYRO_LPF_MASK
float getGyroscopeScales()
Get the gyroscope scales.
bool disableGyroscope()
Disable the gyroscope.
void setWakeupMotionEventCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_CAL2_H
static constexpr uint8_t QMI8658_REG_DVY_L
static constexpr uint8_t QMI8658_REG_RST_RESULT
void setTapEventCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_DQW_L
static constexpr uint8_t QMI8658_REG_DQY_L
static constexpr uint8_t QMI8658_REG_STEP_CNT_MID
static constexpr uint8_t QMI8658_REG_DVX_H
void enableINT(IntPin pin, bool enable=true)
Enable or disable the interrupt.
static constexpr uint8_t QMI8658_REG_CAL4_H
AccelODR
Accelerometer output data rate enumeration.
bool getAccelRaw(int16_t *rawBuffer)
Get the raw accelerometer data.
uint16_t readFromFifo(IMUdata *acc, uint16_t accLength, IMUdata *gyro, uint16_t gyrLength)
readFromFifo
bool disableLockingMechanism()
Disable the locking mechanism.
static constexpr uint8_t QMI8658_REG_CAL3_L
bool selfTestGyro()
Perform self-test on the gyroscope.
static constexpr uint8_t QMI8658_REG_STATUS0
static constexpr uint8_t QMI8658_REG_STATUS1
static constexpr uint8_t QMI8658_REG_AY_H
static constexpr uint8_t QMI8658_REG_AZ_L
static constexpr uint8_t QMI8658_REG_DQW_H
static constexpr uint8_t QMI8658_ACCEL_EN_MASK
static constexpr uint8_t QMI8658_REG_CAL3_H
uint16_t readFromFifo(AccelerometerData *accel_data, uint16_t accel_count, GyroscopeData *gyro_data, uint16_t gyro_count) override
Read data from FIFO buffer.
static constexpr uint8_t QMI8658_REG_CTRL8
bool clearPedometerCounter()
Clear the Pedometer counter.
bool enableLockingMechanism()
Enable the locking mechanism.
static constexpr uint8_t QMI8658_REG_DQZ_H
void enableDataReadyINT(bool enable=true)
Enable or disable the Data Ready interrupt.
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
GyroRange
Gyroscope full-scale range enumeration.
static constexpr uint8_t QMI8658_REG_AY_L
bool configAccelerometer(AccelRange range, AccelODR odr, LpfMode lpfOdr=LPF_MODE_0)
Configure the accelerometer.
void setAccelDataReadyEventCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_AZ_H
uint32_t getChipFirmwareVersion()
Get Sensor chip firmware version.
void setPins(int _irq)
Set sensor interrupt pins.
void powerOn()
Power on the sensor.
static constexpr uint8_t QMI8658_REG_WHOAMI
LpfMode
Low-pass filter mode enumeration.
AccelRange
Accelerometer full-scale range enumeration.
static constexpr uint8_t QMI8658_REG_DVX_L
static constexpr uint8_t QMI8658_REG_CAL1_H
bool writeCalibration(uint16_t gX_gain, uint16_t gY_gain, uint16_t gZ_gain)
Write Gyroscope calibration gains.
void setSignificantMotionEventCallBack(EventCallBack_t cb)
bool configGyroscope(GyroRange range, GyroODR odr, LpfMode lpfOdr=LPF_MODE_0)
Configure the gyroscope.
static constexpr uint8_t QMI8658_REG_STATUS_DEFAULT
static constexpr uint8_t QMI8658_REG_REVISION
void(* EventCallBack_t)(void)
bool isEnableAccelerometer()
Check if the accelerometer is enabled.
static constexpr uint8_t QMI8658_REG_STEP_CNT_HIGH
uint32_t getPedometerCounter()
Get the Pedometer counter.
bool initImpl(uint8_t param) override
static constexpr uint8_t QMI8658_REG_CAL1_L
TapEvent getTapStatus()
Get the current tap status.
int configActivityInterruptMap(IntPin pin)
Config activity interrupt pin mapping.
void setGyroOffset(int16_t offset_x, int16_t offset_y, int16_t offset_z)
Write gyroscope calibration offsets.
bool getGyroRaw(int16_t *rawBuffer)
Get the raw gyroscope data.
void setNoMotionEventCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_DQX_L
static constexpr uint8_t STATUS0_GYRO_AVAIL
float getAccelerometerScales()
Get the accelerometer scales.
bool disableSyncSampleMode()
Disable the synchronous sample mode.
static constexpr uint8_t QMI8658_REG_CAL4_L
@ STATUS0_GYRO_DATA_READY
@ STATUS1_PEDOMETER_MOTION
@ STATUS0_ACCEL_DATA_READY
@ STATUS1_SIGNIFICANT_MOTION
@ STATUS_INT_CTRL9_CMD_DONE
static constexpr uint8_t STATUS0_ACCEL_AVAIL
bool isEnableGyroscope()
Check if the gyroscope is enabled.
static constexpr uint8_t QMI8658_REG_FIFO_CTRL
~SensorQMI8658()
Destructor for SensorQMI8658.
int whoAmI()
Get the WHO_AM_I register value.
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 update()
Update sensor status.
bool enableGyroscope()
Enable the gyroscope.
static constexpr uint8_t QMI8658_REG_GX_L
int getStatusRegister()
Get the Pedometer counter.
void setDataLockingEventCallBack(EventCallBack_t cb)
static constexpr uint8_t QMI8658_REG_DQX_H
static constexpr uint8_t QMI8658_REG_GZ_L
bool enableAccelerometer()
Enable the accelerometer.
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
static constexpr uint8_t QMI8658_REG_FIFO_COUNT
bool reset(bool waitResult=true, uint32_t timeout=500)
Reset the sensor.
static constexpr uint8_t QMI8658_REG_DVZ_L
static constexpr uint8_t QMI8658_REG_RST_RESULT_VAL
bool getDataReady()
Check if new data is available.
static constexpr uint8_t QMI8658_ACCEL_LPF_MASK
bool selfTestAccel()
Perform self-test on the accelerometer.
bool enableTap(IntPin pin=INTERRUPT_PIN_1)
Enable tap detection.
static constexpr uint8_t QMI8658_REG_TEMPERATURE_L
bool enablePedometer(IntPin pin=INTERRUPT_PIN_DISABLE)
enablePedometer
static constexpr uint8_t QMI8658_REG_CTRL1
bool calibration(uint16_t *gX_gain=NULL, uint16_t *gY_gain=NULL, uint16_t *gZ_gain=NULL)
Set Gyroscope calibration gains.
void getChipUsid(uint8_t *buffer, uint8_t length)
Get Sensor chip USID.
uint32_t getTimestamp()
Get the timestamp.
static constexpr uint8_t QMI8658_REG_GZ_H
static constexpr uint8_t QMI8658_REG_RESET_DEFAULT
bool getAccelerometer(float &x, float &y, float &z)
Get the accelerometer data.
uint8_t mgToBytes(float mg)
static constexpr uint8_t QMI8658_REG_FIFO_STATUS
static constexpr uint8_t QMI8658_REG_TEMPERATURE_H
bool disableAccelerometer()
Disable the accelerometer.
static constexpr uint8_t QMI8658_REG_CTRL3
static constexpr uint8_t QMI8658_REG_TAP_STATUS
constexpr uint32_t _bv(uint8_t b)
constexpr uint8_t _lowByte(uint16_t w)
constexpr uint8_t _highByte(uint16_t w)
IMUdata gyro[buffer_size]