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)
263 uint32_t start =
hal->millis();
264 while (
hal->millis() - start < timeout) {
275 SENSORLIB_LOG_E(
"Reset chip failed, Response val = %d - 0x%X", val, val);
314 timestamp = (uint32_t)(((uint32_t)buffer[2] << 16) |
315 ((uint32_t)buffer[1] << 8) | buffer[0]);
319 lastTimestamp = (
timestamp + 0x1000000 - lastTimestamp);
322 return lastTimestamp;
333 return (
float)buffer[1] + ((float)buffer[0] / 256.0);
348 _irq_enable_mask = enable ? _irq_enable_mask | 0x01 : _irq_enable_mask & 0xFE;
352 _irq_enable_mask = enable ? _irq_enable_mask | 0x02 : _irq_enable_mask & 0xFD;
405 accelScales = 2.0 / 32768.0;
408 accelScales = 4.0 / 32768.0;
411 accelScales = 8.0 / 32768.0;
414 accelScales = 16.0 / 32768.0;
473 gyroScales = 16.0 / 32768.0;
476 gyroScales = 32.0 / 32768.0;
479 gyroScales = 64.0 / 32768.0;
482 gyroScales = 128.0 / 32768.0;
485 gyroScales = 256.0 / 32768.0;
488 gyroScales = 512.0 / 32768.0;
491 gyroScales = 1024.0 / 32768.0;
551 _fifo_interrupt =
true;
562 _fifo_interrupt =
false;
592 if ((res & 0x02) == 0x02) {
594 }
else if ((res & 0x01) == 0x01) {
596 }
else if ((res & 0x03) == 0x00) {
600 if ((res & 0x03) == 0x03) {
602 }
else if ((res & 0x02) == 0x02) {
604 }
else if ((res & 0x01) == 0x01) {
606 }
else if ((res & 0x03) == 0x00) {
635 if (data_bytes == 0) {
645 uint16_t samples_per_sensor = data_bytes / (6 * enabled_sensor_count);
646 uint16_t total_samples = samples_per_sensor * enabled_sensor_count;
650 uint16_t accel_index = 0;
651 uint16_t gyro_index = 0;
653 for (uint16_t
i = 0;
i < total_samples; ++
i) {
654 auto data =
reinterpret_cast < int16_t *
> (&fifo_buffer[
i * 6]);
662 if (accel_index < accLength) {
663 acc[accel_index].
x =
x * accelScales;
664 acc[accel_index].
y =
y * accelScales;
665 acc[accel_index].
z = z * accelScales;
670 if (gyro_index < gyrLength) {
671 gyro[gyro_index].
x =
x * gyroScales;
672 gyro[gyro_index].
y =
y * gyroScales;
673 gyro[gyro_index].
z = z * gyroScales;
678 if (accel_index < accLength) {
679 acc[accel_index].
x =
x * accelScales;
680 acc[accel_index].
y =
y * accelScales;
681 acc[accel_index].
z = z * accelScales;
685 if (gyro_index < gyrLength) {
686 gyro[gyro_index].
x =
x * gyroScales;
687 gyro[gyro_index].
y =
y * gyroScales;
688 gyro[gyro_index].
z = z * gyroScales;
693 return samples_per_sensor;
781 uint8_t buffer[6] = {0};
783 rawBuffer[0] = (int16_t)(buffer[1] << 8) | (buffer[0]);
784 rawBuffer[1] = (int16_t)(buffer[3] << 8) | (buffer[2]);
785 rawBuffer[2] = (int16_t)(buffer[5] << 8) | (buffer[4]);
807 x = raw[0] * accelScales;
808 y = raw[1] * accelScales;
809 z = raw[2] * accelScales;
846 uint8_t buffer[6] = {0};
848 rawBuffer[0] = (int16_t)(buffer[1] << 8) | (buffer[0]);
849 rawBuffer[1] = (int16_t)(buffer[3] << 8) | (buffer[2]);
850 rawBuffer[2] = (int16_t)(buffer[5] << 8) | (buffer[4]);
872 x = raw[0] * gyroScales;
873 y = raw[1] * gyroScales;
874 z = raw[2] * gyroScales;
887 if ((_irq_enable_mask & 0x03) && (_irq != -1)) {
888 if (
hal->digitalRead(_irq)) {
893 switch (sampleMode) {
971 for (
int i = 0;
i < 9; ++
i) {
1051 bool configPedometer(uint16_t ped_sample_cnt, uint16_t ped_fix_peak2peak, uint16_t ped_fix_peak,
1052 uint16_t ped_time_up, uint8_t ped_time_low = 0x14, uint8_t ped_time_cnt_entry = 0x0A, uint8_t ped_fix_precision = 0x00,
1053 uint8_t ped_sig_count = 0x04)
1110 return (uint32_t)(((uint32_t)buffer[2] << 16) | ((uint32_t)buffer[1] << 8) | buffer[0]);
1187 float alpha,
float gamma,
float peakMagThr,
float UDMThr)
1217 uint8_t alphaHex = (uint8_t)(alpha * 128);
1221 uint8_t gammaHex = (uint8_t)(gamma * 128);
1224 const double g = 9.81;
1225 double resolution = 0.001 * g * g;
1227 double acceleration_square = peakMagThr * g * g;
1228 uint16_t value = (uint16_t)(acceleration_square / resolution);
1233 acceleration_square = UDMThr * g * g;
1234 value = (uint16_t)(acceleration_square / resolution);
1294 SENSORLIB_LOG_I(
"Tap was detected on the negative direction of the Tap axis");
1296 SENSORLIB_LOG_I(
"Tap was detected on the positive direction of the Tap axis");
1298 uint8_t t = (val >> 4) & 0x03;
1338 float AnyMotionXThr,
1340 float AnyMotionYThr,
1342 float AnyMotionZThr,
1345 uint8_t AnyMotionWindow,
1354 uint8_t NoMotionWindow,
1357 uint16_t SigMotionWaitWindow,
1360 uint16_t SigMotionConfirmWindow)
1469 uint8_t defaultPinValue = 1,
1470 uint8_t blankingTime = 0x20,
1500 val = defaultPinValue ? 0x02 : 0x00;
1502 val = defaultPinValue ? 0x03 : 0x01;
1506 val |= (blankingTime & 0x3F);
1534 memcpy(buffer, usid, length);
1555 uint16_t result = 0;
1573 if (status[0] & 0x80) {
1580 if (status[0] & 0x02) {
1587 if (status[0] & 0x01) {
1594 if ((status[0] & 0x03) == 0x03) {
1595 if (eventDataLocking)eventDataLocking();
1604 if (status[1] & 0x02) {
1606 if (eventGyroDataReady)eventGyroDataReady();
1612 if (status[1] & 0x01) {
1614 if (eventAccelDataReady)eventAccelDataReady();
1623 if (status[2] & 0x80) {
1625 if (eventSignificantMotion)eventSignificantMotion();
1630 if (status[2] & 0x40) {
1632 if (eventNoMotionEvent)eventNoMotionEvent();
1637 if (status[2] & 0x20) {
1639 if (eventAnyMotionEvent)eventAnyMotionEvent();
1644 if (status[2] & 0x10) {
1646 if (eventPedometerEvent)eventPedometerEvent();
1651 if (status[2] & 0x04) {
1653 if (eventWomEvent)eventWomEvent();
1658 if (status[2] & 0x02) {
1660 if (eventTagEvent)eventTagEvent();
1677 eventPedometerEvent = cb;
1682 eventNoMotionEvent = cb;
1687 eventAnyMotionEvent = cb;
1692 eventSignificantMotion = cb;
1697 eventGyroDataReady = cb;
1702 eventAccelDataReady = cb;
1707 eventDataLocking = cb;
1719 bool calibration(uint16_t *gX_gain = NULL, uint16_t *gY_gain = NULL, uint16_t *gZ_gain = NULL)
1737 if (result == -1)
return false;
1742 SENSORLIB_LOG_E(
"COD failed for checking low sensitivity limit of X axis of gyroscope");
1746 SENSORLIB_LOG_E(
"COD failed for checking high sensitivity limit of X axis of gyroscope");
1750 SENSORLIB_LOG_E(
"COD failed for checking low sensitivity limit of Y axis of gyroscope");
1754 SENSORLIB_LOG_E(
"COD failed for checking high sensitivity limit of Y axis of gyroscope");
1758 SENSORLIB_LOG_E(
"Accelerometer checked failed (significant vibration happened during COD)");
1762 SENSORLIB_LOG_E(
"Gyroscope startup failure happened when COD was called");
1766 SENSORLIB_LOG_E(
"COD was called while gyroscope was enabled, COD return failure");
1775 if (gX_gain && gY_gain && gZ_gain) {
1776 uint8_t rawBuffer[6] = {0};
1780 *gX_gain = ((uint16_t)rawBuffer[0]) | (uint16_t)(rawBuffer[1] << 8);
1781 *gY_gain = ((uint16_t)rawBuffer[2]) | (uint16_t)(rawBuffer[3] << 8);
1782 *gZ_gain = ((uint16_t)rawBuffer[4]) | (uint16_t)(rawBuffer[5] << 8);
1804 uint8_t buffer[] = {
1845 int dataReady = 0x00;
1846 while (dataReady != 0x01) {
1849 dataReady = reg_var & 0x01;
1865 while (dataReady == 0x01) {
1868 dataReady = (reg_var & 0x01);
1884 uint8_t rawBuffer[6];
1890 int16_t dVX = (int16_t)(rawBuffer[0]) | (int16_t)(((int16_t)rawBuffer[1]) << 8);
1891 int16_t dVY = (int16_t)(rawBuffer[2]) | (int16_t)(((int16_t)rawBuffer[3]) << 8);
1892 int16_t dVZ = (int16_t)(rawBuffer[4]) | (int16_t)(((int16_t)rawBuffer[5]) << 8);
1895 float dVX_mg = dVX * 0.5;
1896 float dVY_mg = dVY * 0.5;
1897 float dVZ_mg = dVZ * 0.5;
1899 SENSORLIB_LOG_D(
"\n\tdVX_mg:%05.11f \n\tdVY_mg:%05.11f \n\tdVZ_mg:%05.11f", dVX_mg, dVY_mg, dVZ_mg);
1902 if (abs(dVX_mg) > 200 && abs(dVY_mg) > 200 && abs(dVZ_mg) > 200) {
1929 int dataReady = 0x00;
1930 while (dataReady != 0x01) {
1946 while (dataReady != 0x00) {
1962 uint8_t rawBuffer[6];
1971 float dVX = (((int16_t)rawBuffer[0]) << 12) | ((int16_t)(rawBuffer[1]) >> 4);
1972 float dVY = (((int16_t)rawBuffer[2]) << 12) | ((int16_t)(rawBuffer[3]) >> 4);
1973 float dVZ = (((int16_t)rawBuffer[4]) << 12) | ((int16_t)(rawBuffer[5]) >> 4);
1975 dVX *= (1.0 / (1 << 4));
1976 dVY *= (1.0 / (1 << 4));
1977 dVZ *= (1.0 / (1 << 4));
1979 SENSORLIB_LOG_D(
"\n\tdVX:%12.4f \n\tdVY:%12.4f \n\tdVZ:%12.4f", dVX, dVY, dVZ);
1983 if (abs(dVX) > 300 && abs(dVY) > 300 && abs(dVZ) > 300) {
2048 uint16_t getFifoNeedBytes()
2050 uint8_t sam[] = {16, 32, 64, 128};
2051 uint8_t sensors = 0;
2057 uint8_t samples = ((
_fifo_mode >> 2) & 0x03) ;
2058 return sam[samples] * 6 * sensors;
2070 uint16_t fifo_bytes = 0;
2072 if ((_irq != -1) && _fifo_interrupt) {
2079 if (
hal->digitalRead(_irq) == LOW) {
2084 size_t alloc_size = getFifoNeedBytes();
2086 fifo_buffer = (uint8_t *)calloc(alloc_size,
sizeof(uint8_t));
2091 _fifo_size = alloc_size;
2093 }
else if (alloc_size > _fifo_size) {
2094 fifo_buffer = (uint8_t *)realloc(fifo_buffer, alloc_size);
2113 SENSORLIB_LOG_D(
"FIFO Overflow condition has happened (data dropping happened)");
2130 fifo_bytes = 2 * (((status[1] & 0x03)) << 8 | status[0]);
2170 uint32_t startMillis;
2174 startMillis =
hal->millis();
2178 if (
hal->millis() - startMillis > wait_ms) {
2182 }
while (val != -1 && !(val & 0x80));
2188 startMillis =
hal->millis();
2192 if (
hal->millis() - startMillis > wait_ms) {
2196 }
while (val != -1 && (val & 0x80));
2210 float g = mg / 1000.0;
2211 int units = (int)round(g / 0.03125);
2212 return (units & 0x1F) << 3;
2217 float accelScales = 0.0f, gyroScales = 0.0f;
2220 bool _gDataReady =
false;
2221 bool _aDataReady =
false;
2222 bool _fifo_interrupt =
false;
2226 uint8_t _irq_enable_mask =
false;
2228 uint8_t *fifo_buffer = NULL;
2229 uint16_t _fifo_size = 0;
2231 uint32_t lastTimestamp = 0;
2232 uint32_t revisionID = 0x00;
2249 uint8_t buffer[6] = {0};
2253 hal->pinMode(_irq, INPUT);
2262 SENSORLIB_LOG_E(
"ERROR! ID NOT MATCH QMI8658 , Response id is 0x%x",
id);
2282 revisionID = buffer[0] | (uint32_t)(buffer[1] << 8) | (uint32_t)(buffer[2] << 16);
2283 SENSORLIB_LOG_D(
"FW Version :0x%02X%02X%02X", buffer[0], buffer[1], buffer[2]);
2288 usid[0], usid[1], usid[2],
2289 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]