49 Serial.print(
"Data ready: ");
50 Serial.print(
"Temperature: ");
52 Serial.print(
" °C, Acc_Raw: (");
53 Serial.print(data.
raw.
x);
55 Serial.print(data.
raw.
y);
57 Serial.print(data.
raw.
z);
58 Serial.print(
"), Acc_mps2: (");
59 Serial.print(data.
mps2.
x);
61 Serial.print(data.
mps2.
y);
63 Serial.print(data.
mps2.
z);
83 Serial.println(
"BMA4xx sensor initialization failed");
89 Serial.println(
" Sensor initialized successfully");
94 Serial.println(
"Failed to set remap axes");
105 float data_rate_hz = 100.0f;
110 Serial.println(
"Failed to configure accelerometer");
114 bool feature_enable =
true;
124 Serial.println(
"Failed to set interrupt pin configuration");
131 Serial.println(
"Failed to enable data ready");
140 Serial.println(
"Now you can move the sensor.");
OperationMode
Enumeration of sensor operation modes.
AccelFullScaleRange
Enumeration of accelerometer full-scale range settings.
InterruptPinMap
Enumeration of interrupt pin mapping options.
volatile bool isInterruptTriggered
void onDataReady(AccelerometerData data)
bool begin(CommInterface interface, SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr=0)
Initialize the sensor using custom callback interface.
void setOnDataReadyCallback(std::function< void(AccelerometerData)> cb)
Set the callback for data ready events.
bool enableDataReady(bool enable=true, InterruptPinMap pin_map=InterruptPinMap::PIN1) override
Enable data ready interrupt.
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.
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.
Structure representing accelerometer data.
SensorVector mps2
Acceleration in meters per second squared (m/s²)
float temperature
Temperature in degrees Celsius (if available)
RawVector raw
Raw sensor values in LSB (least significant bits)
int16_t x
X-axis raw value.
int16_t y
Y-axis raw value.
int16_t z
Z-axis raw value.