51 Serial.print(
"Tap detected: ");
54 Serial.println(
"Single Tap");
57 Serial.println(
"Double Tap");
60 Serial.println(
"Triple Tap");
63 Serial.println(
"No Tap");
84 Serial.println(
"BMA4xx sensor initialization failed");
90 Serial.println(
" Sensor initialized successfully");
95 Serial.println(
"Failed to set remap axes");
106 float data_rate_hz = 200.0f;
111 Serial.println(
"Failed to configure accelerometer");
115 bool feature_enable =
true;
116 bool interrupt_enable =
true;
126 Serial.println(
"Failed to set interrupt pin configuration");
133 Serial.println(
"Failed to enable tap detector");
142 Serial.println(
"Now you can tap once, twice, or three times.");
OperationMode
Enumeration of sensor operation modes.
AccelFullScaleRange
Enumeration of accelerometer full-scale range settings.
InterruptPinMap
Enumeration of interrupt pin mapping options.
SensorBMA456H accelSensor
void onTapDetected(TapType tap)
volatile bool isInterruptTriggered
bool begin(CommInterface interface, SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr=0)
Initialize the sensor using custom callback interface.
void setOnTapCallback(std::function< void(TapType)> cb)
Set the callback for tap events.
bool enableTapDetector(bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1) override
Enable or disable tap detection.
void update() override
Update sensor state and process interrupts.
virtual bool setRemapAxes(SensorRemap remap)
Set the remapping of axes for the BMA4XX sensor.
bool setInterruptPinConfig(InterruptPinMap pin_map, bool edge_trigger=false, bool active_low=true, bool output_en=true, bool input_en=false)
Configure the electrical properties of an interrupt pin.
const char * getModelName() const
Get the model name of the BMA4XX sensor.
bool configAccelerometer(OperationMode mode, AccelFullScaleRange range, float data_rate_hz, AccelBandwidth bandwidth, AccelPerfMode perf_mode)
Configure the accelerometer.
AccelBandwidth
BMA4 Accelerometer averaging filter configuration These values configure the internal averaging filte...
@ OSR2_AVG2
OSR2 mode with 2 samples averaged.
TapType
Tap detection type.
AccelPerfMode
BMA4 Accelerometer performance mode configuration Configures the internal filter behavior for sample ...
@ CIC_AVG_MODE
Averaging filter mode: samples are averaged based on configured bandwidth and ODR.