57#if !defined(USE_I2C_INTERFACE) && !defined(USE_SPI_INTERFACE)
58#define USE_I2C_INTERFACE
61#if defined(USE_SPI_INTERFACE)
95#ifdef ARDUINO_T_BEAM_S3_SUPREME
96#include <XPowersAXP2101.tpp>
99static void serialPrintFmt(
const char *fmt, ...)
104 vsnprintf(
buf,
sizeof(
buf), fmt, args);
111#if defined(ARDUINO_T_BEAM_S3_SUPREME)
112 XPowersAXP2101 power;
113 power.begin(Wire1, AXP2101_SLAVE_ADDRESS, 42, 41);
114 power.disableALDO1();
115 power.disableALDO2();
117 power.setALDO1Voltage(3300);
119 power.setALDO2Voltage(3300);
124static constexpr uint16_t MAX_FIFO_SAMPLES = 32;
125static uint8_t fifoWarmupDiscard = 8;
135 Serial.begin(115200);
140 Serial.println(
"QMI8658 FIFO Read Example");
142#ifdef USE_I2C_INTERFACE
144 Serial.println(
"Failed to initialize QMI8658!");
151#ifdef USE_SPI_INTERFACE
154 Serial.println(
"Failed to initialize QMI8658!");
185 Serial.println(
"FIFO configured. Waiting for data...");
186 Serial.println(
"Note: FIFO mode disables DRDY; polling FIFO/STATUS is used here.");
197 if (fifoWarmupDiscard > 0) {
202 serialPrintFmt(
"Read %u samples from FIFO:\n", samples);
204 for (uint16_t
i = 0;
i < samples &&
i < 5; ++
i) {
205 serialPrintFmt(
" [%u] Accel: %7.3f %7.3f %7.3f | Gyro: %8.3f %8.3f %8.3f\n",
bool begin(CommInterface interface, SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr=0)
Initialize the sensor using custom callback interface.
QMI8658 IMU sensor driver class.
bool configGyro(GyroFullScaleRange range, float data_rate_hz, LpfMode lpf=LpfMode::MODE_0)
Configure the gyroscope with specified parameters.
bool enableAccel() override
Enable the accelerometer.
bool configFifo(FifoMode mode, FifoSamples samples=FifoSamples::SAMPLES_16, uint8_t watermark_samples=16)
Configure FIFO with specified mode.
@ STREAM
Stream mode (overwrites oldest)
bool enableGyro() override
Enable the gyroscope.
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.
void setPins(int pin)
Set interrupt pin.
GyroscopeData gyroFifo[MAX_FIFO_SAMPLES]
AccelerometerData accelFifo[MAX_FIFO_SAMPLES]
Structure representing accelerometer data.
SensorVector mps2
Acceleration in meters per second squared (m/s²)
Structure representing gyroscope data.
SensorVector dps
Angular velocity in degrees per second (°/s)