SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
SensorBMA422 Class Reference

#include <SensorBMA422.hpp>

Inheritance diagram for SensorBMA422:
[legend]

Classes

struct  EventCallbacks
 Event callbacks for the sensor. More...
 

Public Member Functions

 SensorBMA422 ()
 Constructor for the SensorBMA422 class.
 
 ~SensorBMA422 ()=default
 Destructor for the SensorBMA422 class.
 
BMA4XXCapability::Capability getCapabilities () const override
 Get supported capabilities.
 
void setOnAnyMotionCallback (std::function< void(void)> cb)
 Set the any-motion callback for motion events.
 
void setOnNoMotionCallback (std::function< void(void)> cb)
 Set the callback for no-motion events.
 
void setOnDataReadyCallback (std::function< void(AccelerometerData)> cb)
 Set the callback for data ready events.
 
void setCallbacks (const EventCallbacks &cbs)
 Set all callbacks at once.
 
EventCallbacksgetCallbacks ()
 Get the current callbacks.
 
const EventCallbacksgetCallbacks () const
 Get the current callbacks (const version)
 
bool enableDataReady (bool enable=true, InterruptPinMap pin_map=InterruptPinMap::PIN1) override
 Enable data ready interrupt.
 
bool enableAnyMotionDetection (const MotionAxesConfig &cfg, bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1) override
 Enable or disable any-motion detection.
 
bool enableNoMotionDetection (const MotionAxesConfig &cfg, bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1) override
 Enable or disable no-motion detection.
 
bool configNoMotion (uint16_t threshold, uint16_t duration) override
 Configure no-motion detection parameters with detailed unit conversion.
 
bool configAnyMotion (uint16_t threshold, uint16_t duration) override
 Configure any-motion detection parameters with detailed unit conversion.
 
bool configMotion (bool any_motion, uint16_t threshold, uint16_t duration) override
 Configure any-motion or no-motion detection parameters with detailed unit conversion.
 
bool configAnyMotionInPhysicalUnits (float threshold_mg, float duration_ms) override
 Configure any-motion detection using physical units.
 
bool configNoMotionInPhysicalUnits (float threshold_mg, float duration_ms) override
 Configure no-motion detection using physical units.
 
bool getAnyMotionConfig (float &threshold_mg, float &duration_ms)
 Get current motion detection configuration.
 
bool getNoMotionConfig (float &threshold_mg, float &duration_ms)
 Get current no-motion detection configuration.
 
void update () override
 Update sensor state and process interrupts.
 
- Public Member Functions inherited from SensorBMA4XX
bool readData (AccelerometerData &data) override
 Get the accelerometer data.
 
bool isDataReady () override
 Check if new accelerometer data is available.
 
bool reset () override
 Reset the sensor.
 
bool selfTest () override
 Perform a self-test on the sensor.
 
bool setFullScaleRange (AccelFullScaleRange range) override
 Set the full-scale range of the accelerometer.
 
bool setOutputDataRate (float data_rate_hz) override
 Set the output data rate of the accelerometer.
 
bool setBandwidth (AccelBandwidth bandwidth)
 Set the bandwidth of the accelerometer.
 
bool setPerformanceMode (AccelPerfMode mode)
 Set the performance mode of the accelerometer.
 
bool setOperationMode (OperationMode mode) override
 Set the operation mode of the accelerometer.
 
bool configAccelerometer (OperationMode mode, AccelFullScaleRange range, float data_rate_hz, AccelBandwidth bandwidth, AccelPerfMode perf_mode)
 Configure the accelerometer.
 
float getTemperature () const
 Get the temperature reading from the sensor.
 
uint16_t getInterruptStatus ()
 Get the current interrupt status flags.
 
bool isInterruptActive (uint16_t interrupt_mask)
 Check if a specific interrupt is active.
 
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.
 
bool enableInterrupt (InterruptPinMap pin_map, uint16_t interrupt_sources, bool enable)
 Enable or disable specific interrupt sources on a pin.
 
virtual bool setRemapAxes (SensorRemap remap)
 Set the remapping of axes for the BMA4XX sensor.
 
const char * getModelName () const
 Get the model name of the BMA4XX sensor.
 
bma4_dev_tgetDev ()
 Get the device structure for the BMA4XX sensor.
 
uint32_t getTimeSampleMs () const
 Get the current sensor time in milliseconds.
 
virtual bool enableTapDetector (bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1)
 Enable or disable tap detection (default: not supported)
 
virtual bool enableStepCounter (bool enable, uint16_t step_counter_wm=1, bool reset_counter=false)
 Enable or disable step counter (default: not supported)
 
virtual bool enableStepDetector (bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1)
 Enable or disable step detector (default: not supported)
 
virtual bool enableActivityRecognition (bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1)
 Enable or disable activity recognition (default: not supported)
 
virtual bool enableTiltDetector (bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1)
 Enable or disable tilt detection (default: not supported)
 
- Public Member Functions inherited from AccelerometerBase
virtual float getFullScaleRange () const
 Get current full-scale range setting.
 
virtual float getOutputDataRate () const
 Get current output data rate setting.
 
virtual OperationMode getOperationMode () const
 Get current operation mode setting.
 
- Public Member Functions inherited from SensorBase< AccelerometerData >
 SensorBase (const SensorBase &)=delete
 
SensorBaseoperator= (const SensorBase &)=delete
 
void setOffset (int16_t x, int16_t y, int16_t z)
 Set sensor calibration offsets.
 
float getSensitivity () const
 Get sensor sensitivity.
 
SensorInfo getSensorInfo () const
 Get sensor information.
 
virtual SensorConfig getConfig () const
 Get current sensor configuration.
 
- Public Member Functions inherited from ComplexStaticDeviceWithHal
bool begin (CommInterface interface, SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr=0)
 Initialize the sensor using custom callback interface.
 
- Public Member Functions inherited from DeviceBeginCommon
virtual ~DeviceBeginCommon ()
 
uint8_t getAddress () const
 
uint8_t getInterface () const
 
- Public Member Functions inherited from SensorCommWrapper
 SensorCommWrapper ()=default
 
int readReg (uint8_t reg) const
 
int readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const
 
int readBuff (uint8_t *buf, size_t len) const
 
int writeReg (uint8_t reg, uint8_t val)
 
int writeRegBuff (uint8_t reg, uint8_t *buf, size_t len)
 
int writeBuff (uint8_t *buf, size_t len)
 
int writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len)
 
bool setRegBit (uint8_t reg, uint8_t bit)
 
bool clrRegBit (uint8_t reg, uint8_t bit)
 
bool getRegBit (uint8_t reg, uint8_t bit)
 
int updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted)
 
void setAddress (uint8_t address)
 
void setAck (bool enable)
 
- Public Member Functions inherited from SensorCommInterface
virtual ~SensorCommInterface ()=default
 

Protected Attributes

EventCallbacks callbacks
 
uint16_t _status
 
- Protected Attributes inherited from SensorBMA4XX
std::unique_ptr< struct bma4_dev > dev
 
struct bma4_accel_config _accel_conf
 
uint8_t _remap_reg_offset
 
float _half_scale
 
- Protected Attributes inherited from SensorBase< AccelerometerData >
SensorConfig _config
 Current configuration.
 
SensorInfo _info
 Sensor information.
 
int16_t _x_offset
 
int16_t _y_offset
 
int16_t _z_offset
 
float _sensitivity
 
- Protected Attributes inherited from DeviceBeginCommon
std::unique_ptr< SensorCommBasecomm
 
std::unique_ptr< SensorHalhal
 
std::unique_ptr< SensorCommStaticstaticComm
 
uint8_t _addr = 0
 
uint8_t _iface = COMM_CUSTOM
 

Additional Inherited Members

- Public Types inherited from SensorBMA4XX
enum  BMA4XXModel { BMA422 = 0x12 , BMA423 = 0x13 , BMA456 = 0x16 , BMA456_AN_SEC = 0x1A }
 Enumeration of BMA4XX models. More...
 
using bma4_dev_t = bma4_dev
 typedef for BMA4 device structure
 
- Protected Member Functions inherited from SensorBMA4XX
 SensorBMA4XX ()
 Constructor for the SensorBMA4XX class.
 
 ~SensorBMA4XX ()=default
 Destructor for the SensorBMA4XX class.
 
- Protected Member Functions inherited from AccelerometerBase
 AccelerometerBase ()
 Construct a new AccelerometerBase object.
 
virtual ~AccelerometerBase ()=default
 Destroy the AccelerometerBase object.
 
 AccelerometerBase (const AccelerometerBase &)=delete
 
AccelerometerBaseoperator= (const AccelerometerBase &)=delete
 
- Protected Member Functions inherited from SensorBase< AccelerometerData >
 SensorBase (SensorType sensor_type=SensorType::UNKNOWN)
 Construct a new SensorBase object.
 
virtual ~SensorBase ()=default
 Virtual destructor for proper polymorphic cleanup.
 
- Protected Member Functions inherited from ComplexStaticDeviceWithHal
bool ensureValid () const override
 Ensure the communication interface is valid.
 
- Protected Member Functions inherited from DeviceBeginCommon
 DeviceBeginCommon ()=default
 
virtual SensorCommBasegetComm () const override
 
virtual void beforeBegin ()
 
virtual void afterCommReady ()
 
virtual void afterInitSuccess (uint8_t param)
 
virtual void onBeginFail ()
 
bool fail ()
 
void clearCommState ()
 
template<typename CreateComm >
bool beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm)
 

Detailed Description

Definition at line 39 of file sensor/accelerometer/bma/SensorBMA422.hpp.

Constructor & Destructor Documentation

◆ SensorBMA422()

SensorBMA422::SensorBMA422 ( )
inline

Constructor for the SensorBMA422 class.

Note
Initializes the sensor with default settings and sets the remap offset for BMA422 specific features.

Definition at line 60 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References SensorBMA4XX::_remap_reg_offset.

◆ ~SensorBMA422()

SensorBMA422::~SensorBMA422 ( )
default

Destructor for the SensorBMA422 class.

Note
Cleans up the sensor resources (default implementation).

Member Function Documentation

◆ configAnyMotion()

bool SensorBMA422::configAnyMotion ( uint16_t  threshold,
uint16_t  duration 
)
inlineoverridevirtual

Configure any-motion detection parameters with detailed unit conversion.

Note
This function sets both the threshold (sensitivity) and duration (time) for any-motion detection.

= Threshold Units = The threshold is specified in LSB (Least Significant Bits), where: 1 LSB = 0.48 mG = 0.48 × 0.001 g = 0.00048 g ≈ 0.0047 m/s²

To convert from milli-g to LSB: LSB = mg_value / 0.48

Example conversions:

  • 10 LSB = 10 × 0.48 mG = 4.8 mG = 0.0048 g
  • 100 mG = 100 / 0.48 ≈ 208 LSB

= Duration Units = The duration is specified in LSB, where at 50Hz ODR: 1 LSB = 20 milliseconds

Duration in seconds = duration_LSB × 0.020

Example conversions:

  • 4 LSB = 4 × 20ms = 80ms = 0.08s
  • 50ms = 50 / 20 = 2.5 LSB (round to nearest integer)
Warning
The duration unit (20ms/LSB) is only accurate at 50Hz ODR. For other ODR settings, the time per sample changes. Time per sample = 1 / ODR Example at 100Hz ODR: 1 sample = 10ms, so duration = LSB × 10ms
Parameters
thresholdMotion detection threshold in LSB units (1 LSB = 0.48 mG) Recommended range: 10-200 (4.8-96 mG) Higher values = less sensitive, lower values = more sensitive
durationDetection duration in LSB units (1 LSB = 20ms at 50Hz ODR) Recommended range: 1-20 (20ms to 400ms) Longer duration = more stable detection, less false positives
Returns
true if configuration successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 311 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References configMotion().

Referenced by configAnyMotionInPhysicalUnits(), and setup().

◆ configAnyMotionInPhysicalUnits()

bool SensorBMA422::configAnyMotionInPhysicalUnits ( float  threshold_mg,
float  duration_ms 
)
inlineoverridevirtual

Configure any-motion detection using physical units.

Note
Easier to use than configAnyMotion() as it accepts physical units
Parameters
threshold_mgThreshold in milli-g (1 mG = 0.001 g) Will be converted to LSB: LSB = threshold_mg / 0.48
duration_msDuration in milliseconds (at 50Hz ODR) Will be converted to LSB: LSB = duration_ms / 20
Returns
true if successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 419 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References configAnyMotion(), and SENSORLIB_LOG_D.

◆ configMotion()

bool SensorBMA422::configMotion ( bool  any_motion,
uint16_t  threshold,
uint16_t  duration 
)
inlineoverridevirtual

Configure any-motion or no-motion detection parameters with detailed unit conversion.

Note
This function sets both the threshold (sensitivity) and duration (time) for any-motion/no-motion detection.

= Threshold Units = The threshold is specified in LSB (Least Significant Bits), where: 1 LSB = 0.48 mG = 0.48 × 0.001 g = 0.00048 g ≈ 0.0047 m/s²

To convert from milli-g to LSB: LSB = mg_value / 0.48

Example conversions:

  • 10 LSB = 10 × 0.48 mG = 4.8 mG = 0.0048 g
  • 100 mG = 100 / 0.48 ≈ 208 LSB

= Duration Units = The duration is specified in LSB, where at 50Hz ODR: 1 LSB = 20 milliseconds

Duration in seconds = duration_LSB × 0.020

Example conversions:

  • 4 LSB = 4 × 20ms = 80ms = 0.08s
  • 50ms = 50 / 20 = 2.5 LSB (round to nearest integer)
Warning
The duration unit (20ms/LSB) is only accurate at 50Hz ODR. For other ODR settings, the time per sample changes. Time per sample = 1 / ODR Example at 100Hz ODR: 1 sample = 10ms, so duration = LSB × 10ms
Parameters
any_motiontrue to configure any-motion, false for no-motion
thresholdMotion detection threshold in LSB units (1 LSB = 0.48 mG) Recommended range: 10-200 (4.8-96 mG) Higher values = less sensitive, lower values = more sensitive
durationDetection duration in LSB units (1 LSB = 20ms at 50Hz ODR) Recommended range: 1-20 (20ms to 400ms) Longer duration = more stable detection, less false positives
Returns
true if configuration successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 359 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References SensorBMA4XX::dev, SENSORLIB_LOG_D, and SENSORLIB_LOG_E.

Referenced by configAnyMotion(), and configNoMotion().

◆ configNoMotion()

bool SensorBMA422::configNoMotion ( uint16_t  threshold,
uint16_t  duration 
)
inlineoverridevirtual

Configure no-motion detection parameters with detailed unit conversion.

Note
This function sets both the threshold (sensitivity) and duration (time) for no-motion detection.

= Threshold Units = The threshold is specified in LSB (Least Significant Bits), where: 1 LSB = 0.48 mG = 0.48 × 0.001 g = 0.00048 g ≈ 0.0047 m/s²

To convert from milli-g to LSB: LSB = mg_value / 0.48

Example conversions:

  • 10 LSB = 10 × 0.48 mG = 4.8 mG = 0.0048 g
  • 100 mG = 100 / 0.48 ≈ 208 LSB

= Duration Units = The duration is specified in LSB, where at 50Hz ODR: 1 LSB = 20 milliseconds

Duration in seconds = duration_LSB × 0.020

Example conversions:

  • 4 LSB = 4 × 20ms = 80ms = 0.08s
  • 50ms = 50 / 20 = 2.5 LSB (round to nearest integer)
Warning
The duration unit (20ms/LSB) is only accurate at 50Hz ODR. For other ODR settings, the time per sample changes. Time per sample = 1 / ODR Example at 100Hz ODR: 1 sample = 10ms, so duration = LSB × 10ms
Parameters
thresholdMotion detection threshold in LSB units (1 LSB = 0.48 mG) Recommended range: 10-200 (4.8-96 mG) Higher values = less sensitive, lower values = more sensitive
durationDetection duration in LSB units (1 LSB = 20ms at 50Hz ODR) Recommended range: 1-20 (20ms to 400ms) Longer duration = more stable detection, less false positives
Returns
true if configuration successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 265 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References configMotion().

Referenced by configNoMotionInPhysicalUnits(), and setup().

◆ configNoMotionInPhysicalUnits()

bool SensorBMA422::configNoMotionInPhysicalUnits ( float  threshold_mg,
float  duration_ms 
)
inlineoverridevirtual

Configure no-motion detection using physical units.

Note
Easier to use than configNoMotion() as it accepts physical units
Parameters
threshold_mgThreshold in milli-g (1 mG = 0.001 g) Will be converted to LSB: LSB = threshold_mg / 0.48
duration_msDuration in milliseconds (at 50Hz ODR) Will be converted to LSB: LSB = duration_ms / 20
Returns
true if successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 441 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References configNoMotion(), and SENSORLIB_LOG_D.

◆ enableAnyMotionDetection()

bool SensorBMA422::enableAnyMotionDetection ( const MotionAxesConfig cfg,
bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlineoverridevirtual

Enable or disable any-motion detection.

Note
Configures motion any-motion detection on selected axes
Parameters
&cfgConfiguration for which axes to monitor
enabletrue to enable, false to disable
interrupt_enableEnable/disable interrupt generation
pin_mapInterrupt pin to use (PIN1 or PIN2)
Returns
true if successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 161 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References SensorBMA4XX::dev, SensorBMA4XX::enableInterrupt(), SENSORLIB_LOG_E, SensorBMA4XX::MotionAxesConfig::x_axis, SensorBMA4XX::MotionAxesConfig::y_axis, and SensorBMA4XX::MotionAxesConfig::z_axis.

Referenced by setup().

◆ enableDataReady()

bool SensorBMA422::enableDataReady ( bool  enable = true,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlineoverridevirtual

Enable data ready interrupt.

Note
Configures the interrupt for accelerometer data ready events
Parameters
enableEnable/disable the data ready feature
pin_mapInterrupt pin to use (PIN1 or PIN2)
Returns
true if successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 147 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References SensorBMA4XX::enableInterrupt().

Referenced by setup().

◆ enableNoMotionDetection()

bool SensorBMA422::enableNoMotionDetection ( const MotionAxesConfig cfg,
bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlineoverridevirtual

Enable or disable no-motion detection.

Note
Configures motion no-motion detection on selected axes
Parameters
&cfgConfiguration for which axes to monitor
enabletrue to enable, false to disable
interrupt_enableEnable/disable interrupt generation
pin_mapInterrupt pin to use (PIN1 or PIN2)
Returns
true if successful, false on error

Reimplemented from SensorBMA4XX.

Definition at line 198 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References SensorBMA4XX::dev, SensorBMA4XX::enableInterrupt(), SENSORLIB_LOG_E, SensorBMA4XX::MotionAxesConfig::x_axis, SensorBMA4XX::MotionAxesConfig::y_axis, and SensorBMA4XX::MotionAxesConfig::z_axis.

Referenced by setup().

◆ getAnyMotionConfig()

bool SensorBMA422::getAnyMotionConfig ( float &  threshold_mg,
float &  duration_ms 
)
inline

Get current motion detection configuration.

Note
Reads back the current threshold and duration settings
Parameters
[out]threshold_mgReturns threshold in milli-g
[out]duration_msReturns duration in milliseconds (at 50Hz ODR)
Returns
true if successful, false on error

Definition at line 460 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References SensorBMA4XX::dev, SENSORLIB_LOG_D, and SENSORLIB_LOG_E.

◆ getCallbacks() [1/2]

EventCallbacks & SensorBMA422::getCallbacks ( )
inline

Get the current callbacks.

Returns
Reference to the EventCallbacks structure
Note
Use this to modify callbacks directly or check current settings

Definition at line 126 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References callbacks.

◆ getCallbacks() [2/2]

const EventCallbacks & SensorBMA422::getCallbacks ( ) const
inline

Get the current callbacks (const version)

Returns
Const reference to the EventCallbacks structure

Definition at line 135 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References callbacks.

◆ getCapabilities()

BMA4XXCapability::Capability SensorBMA422::getCapabilities ( ) const
inlineoverridevirtual

◆ getNoMotionConfig()

bool SensorBMA422::getNoMotionConfig ( float &  threshold_mg,
float &  duration_ms 
)
inline

Get current no-motion detection configuration.

Note
Reads back the current threshold and duration settings
Parameters
[out]threshold_mgReturns threshold in milli-g
[out]duration_msReturns duration in milliseconds (at 50Hz ODR)
Returns
true if successful, false on error

Definition at line 486 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References SensorBMA4XX::dev, SENSORLIB_LOG_D, and SENSORLIB_LOG_E.

◆ setCallbacks()

void SensorBMA422::setCallbacks ( const EventCallbacks cbs)
inline

Set all callbacks at once.

Note
This function copies the entire EventCallbacks structure.
Parameters
cbsReference to EventCallbacks structure containing all callbacks

Definition at line 116 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References callbacks.

◆ setOnAnyMotionCallback()

void SensorBMA422::setOnAnyMotionCallback ( std::function< void(void)>  cb)
inline

Set the any-motion callback for motion events.

Note
The callback will be invoked when motion state changes.
Parameters
cbCallback function that accepts void

Definition at line 86 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References callbacks, and SensorBMA422::EventCallbacks::onAnyMotion.

Referenced by setup().

◆ setOnDataReadyCallback()

void SensorBMA422::setOnDataReadyCallback ( std::function< void(AccelerometerData)>  cb)
inline

Set the callback for data ready events.

Note
The callback will be invoked when new accelerometer data is available.
Parameters
cbCallback function that accepts AccelerometerData reference

Definition at line 106 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References callbacks, and SensorBMA422::EventCallbacks::onDataReady.

Referenced by setupDataReadyCallback().

◆ setOnNoMotionCallback()

void SensorBMA422::setOnNoMotionCallback ( std::function< void(void)>  cb)
inline

Set the callback for no-motion events.

Note
The callback will be invoked when no motion is detected.
Parameters
cbCallback function that accepts void

Definition at line 96 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References callbacks, and SensorBMA422::EventCallbacks::onNoMotion.

Referenced by setup().

◆ update()

void SensorBMA422::update ( )
inlineoverridevirtual

Update sensor state and process interrupts.

Note
This method should be called periodically (e.g., in main loop) to check for and process sensor interrupts. It reads the interrupt status register and invokes the appropriate callbacks.
Returns
void

Implements SensorBMA4XX.

Definition at line 511 of file sensor/accelerometer/bma/SensorBMA422.hpp.

References _status, callbacks, SensorBMA4XX::dev, SensorBMA422::EventCallbacks::onAnyMotion, SensorBMA422::EventCallbacks::onDataReady, SensorBMA422::EventCallbacks::onNoMotion, and SensorBMA4XX::readData().

Referenced by loop().

Member Data Documentation

◆ _status

uint16_t SensorBMA422::_status
protected

Definition at line 561 of file sensor/accelerometer/bma/SensorBMA422.hpp.

Referenced by update().

◆ callbacks


The documentation for this class was generated from the following file: