53#if !defined(USE_I2C_INTERFACE) && !defined(USE_SPI_INTERFACE)
54#define USE_I2C_INTERFACE
57#if defined(USE_SPI_INTERFACE)
83#ifdef ARDUINO_T_BEAM_S3_SUPREME
84#include <XPowersAXP2101.tpp>
87static void serialPrintFmt(
const char *fmt, ...)
92 vsnprintf(
buf,
sizeof(
buf), fmt, args);
99#if defined(ARDUINO_T_BEAM_S3_SUPREME)
100 XPowersAXP2101 power;
101 power.begin(Wire1, AXP2101_SLAVE_ADDRESS, 42, 41);
102 power.disableALDO1();
103 power.disableALDO2();
105 power.setALDO1Voltage(3300);
107 power.setALDO2Voltage(3300);
131 Serial.
begin(115200);
135 Serial.println(
"QMI8658 No-Motion Example");
137#ifdef USE_I2C_INTERFACE
139 Serial.println(
"Failed to initialize QMI8658!");
140 while (1) delay(1000);
144#ifdef USE_SPI_INTERFACE
146 Serial.println(
"Failed to initialize QMI8658!");
147 while (1) delay(1000);
167 int irq = digitalPinToInterrupt(
IMU_IRQ);
169 attachInterrupt(irq, +[]() {
174 serialPrintFmt(
"No-Motion config any=%s no=%s enable=%s\n",
175 cfgAny ?
"OK" :
"FAIL",
178 Serial.println(
"Keep sensor still to trigger No-Motion.");
182 Serial.println(
"[EVENT] No motion detected!");
190 bool doUpdate =
false;
196 uint32_t now = millis();
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 enableAccel() override
Enable the accelerometer.
void setNoMotionCallback(MotionCallback callback)
Set callback for no-motion event.
bool enableMotionDetect(IntPin pin=IntPin::PIN1)
Enable motion detection on specified pin.
@ ANY_MOTION
Any motion detection.
@ NO_MOTION
No motion detection.
bool configAccel(AccelFullScaleRange range, float data_rate_hz, LpfMode lpf=LpfMode::MODE_0)
Configure the accelerometer with specified parameters.
uint16_t update()
Update sensor status and process events.
void setPins(int pin)
Set interrupt pin.
bool configMotionDetect(MotionType type, float threshold_x, float threshold_y, float threshold_z, uint8_t duration)
Configure motion detection parameters.
constexpr uint8_t kNoWindow
constexpr float kAccelOdrHz
constexpr float kNoThresholdMg
constexpr uint8_t kAnyWindow
volatile bool irqTriggered
constexpr uint32_t kPollIntervalMs
constexpr float kAnyThresholdMg