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

#include <SensorBMA4XX.hpp>

Inheritance diagram for SensorBMA4XX:
[legend]

Classes

struct  MotionAxesConfig
 Motion axes configuration. More...
 

Public Types

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
 

Public Member Functions

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 BMA4XXCapability::Capability getCapabilities () const =0
 Get supported capabilities.
 
virtual bool enableDataReady (bool enable=true, InterruptPinMap pin_map=InterruptPinMap::PIN1)
 Enable data ready interrupt (default: not supported)
 
virtual bool enableAnyMotionDetection (const MotionAxesConfig &cfg, bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1)
 Enable or disable any-motion detection (default: not supported)
 
virtual bool enableNoMotionDetection (const MotionAxesConfig &cfg, bool enable, bool interrupt_enable=false, InterruptPinMap pin_map=InterruptPinMap::PIN1)
 Enable or disable no-motion detection (default: not supported)
 
virtual bool configAnyMotion (uint16_t threshold, uint16_t duration)
 Configure any-motion threshold and duration (default: not supported)
 
virtual bool configNoMotion (uint16_t threshold, uint16_t duration)
 Configure no-motion threshold and duration (default: not supported)
 
virtual bool configMotion (bool any_motion, uint16_t threshold, uint16_t duration)
 Configure motion detection (default: not supported)
 
virtual bool configAnyMotionInPhysicalUnits (float threshold_mg, float duration_ms)
 Configure any-motion using physical units (default: not supported)
 
virtual bool configNoMotionInPhysicalUnits (float threshold_mg, float duration_ms)
 Configure no-motion using physical units (default: not supported)
 
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)
 
virtual void update ()=0
 Update the sensor data, this method is implemented by a subclass.
 
- 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 Member Functions

 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)
 

Protected Attributes

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
 

Detailed Description

Member Typedef Documentation

◆ bma4_dev_t

Member Enumeration Documentation

◆ BMA4XXModel

Enumeration of BMA4XX models.

Enumerator
BMA422 
BMA423 
BMA456 
BMA456_AN_SEC 
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 194 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Constructor & Destructor Documentation

◆ SensorBMA4XX()

SensorBMA4XX::SensorBMA4XX ( )
inlineprotected

Constructor for the SensorBMA4XX class.

Note
Initializes the communication interfaces and hardware abstraction layer.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 206 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

◆ ~SensorBMA4XX()

SensorBMA4XX::~SensorBMA4XX ( )
protecteddefault

Destructor for the SensorBMA4XX class.

Note
Cleans up the resources used by the class.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Member Function Documentation

◆ configAccelerometer()

bool SensorBMA4XX::configAccelerometer ( OperationMode  mode,
AccelFullScaleRange  range,
float  data_rate_hz,
AccelBandwidth  bandwidth,
AccelPerfMode  perf_mode 
)
inline

Configure the accelerometer.

Note
This function sets various parameters of the accelerometer in a single call.
Parameters
modeThe desired operation mode. Allowed values are SUSPEND, NORMAL.
rangeThe desired full-scale range. Allowed values are FS_2G, FS_4G, FS_8G, FS_16G.
data_rate_hzThe desired output data rate in Hz. Allowed values are 0.78, 1.56, 3.12, 6.25, 12.5, 25, 50, 100, 200, 400, 800, 1600.
bandwidthThe desired bandwidth. Allowed values are OSR4_AVG1, OSR2_AVG2, NORMAL_AVG4, etc.
perf_modeThe desired performance mode. Allowed values are CIC_AVG_MODE, CONTINUOUS_MODE.
Return values
Trueif the configuration is successful, false otherwise.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 506 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References setBandwidth(), setFullScaleRange(), setOperationMode(), setOutputDataRate(), and setPerformanceMode().

Referenced by setup().

◆ configAnyMotion()

virtual bool SensorBMA4XX::configAnyMotion ( uint16_t  threshold,
uint16_t  duration 
)
inlinevirtual

Configure any-motion threshold and duration (default: not supported)

Reimplemented in SensorBMA422, SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 827 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

◆ configAnyMotionInPhysicalUnits()

virtual bool SensorBMA4XX::configAnyMotionInPhysicalUnits ( float  threshold_mg,
float  duration_ms 
)
inlinevirtual

Configure any-motion using physical units (default: not supported)

Reimplemented in SensorBMA422, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 859 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

◆ configMotion()

virtual bool SensorBMA4XX::configMotion ( bool  any_motion,
uint16_t  threshold,
uint16_t  duration 
)
inlinevirtual

Configure motion detection (default: not supported)

Parameters
any_motiontrue for any-motion, false for no-motion

Reimplemented in SensorBMA422, SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 848 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

◆ configNoMotion()

virtual bool SensorBMA4XX::configNoMotion ( uint16_t  threshold,
uint16_t  duration 
)
inlinevirtual

Configure no-motion threshold and duration (default: not supported)

Reimplemented in SensorBMA422, SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 837 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

◆ configNoMotionInPhysicalUnits()

virtual bool SensorBMA4XX::configNoMotionInPhysicalUnits ( float  threshold_mg,
float  duration_ms 
)
inlinevirtual

Configure no-motion using physical units (default: not supported)

Reimplemented in SensorBMA422, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 869 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

◆ enableActivityRecognition()

virtual bool SensorBMA4XX::enableActivityRecognition ( bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlinevirtual

Enable or disable activity recognition (default: not supported)

Reimplemented in SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 915 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ enableAnyMotionDetection()

virtual bool SensorBMA4XX::enableAnyMotionDetection ( const MotionAxesConfig cfg,
bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlinevirtual

Enable or disable any-motion detection (default: not supported)

Reimplemented in SensorBMA422, SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 799 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ enableDataReady()

virtual bool SensorBMA4XX::enableDataReady ( bool  enable = true,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlinevirtual

Enable data ready interrupt (default: not supported)

Reimplemented in SensorBMA422, SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 789 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ enableInterrupt()

bool SensorBMA4XX::enableInterrupt ( InterruptPinMap  pin_map,
uint16_t  interrupt_sources,
bool  enable 
)
inline

Enable or disable specific interrupt sources on a pin.

Maps interrupt sources (e.g., data ready, FIFO full) to a physical interrupt pin. Multiple interrupt sources can be combined using bitwise OR.

Example: enableInterrupt(PIN1, BMA4_DATA_RDY_INT | BMA4_FIFO_FULL_INT, true)

Parameters
pin_mapWhich interrupt pin to map to (PIN1 or PIN2).
interrupt_sourcesBitmask of interrupt sources to enable/disable.
enableTrue to enable, false to disable.
Returns
True if operation succeeded, false otherwise.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 634 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev, PIN1, PIN2, and SENSORLIB_LOG_E.

Referenced by SensorBMA423::enableActivityRecognition(), SensorBMA456H::enableActivityRecognition(), SensorBMA422::enableAnyMotionDetection(), SensorBMA423::enableAnyMotionDetection(), SensorBMA456H::enableAnyMotionDetection(), SensorBMA422::enableDataReady(), SensorBMA423::enableDataReady(), SensorBMA456H::enableDataReady(), SensorBMA422::enableNoMotionDetection(), SensorBMA423::enableNoMotionDetection(), SensorBMA456H::enableNoMotionDetection(), SensorBMA423::enableStepDetector(), SensorBMA456H::enableStepDetector(), SensorBMA423::enableTapDetector(), SensorBMA456H::enableTapDetector(), and SensorBMA423::enableTiltDetector().

◆ enableNoMotionDetection()

virtual bool SensorBMA4XX::enableNoMotionDetection ( const MotionAxesConfig cfg,
bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlinevirtual

Enable or disable no-motion detection (default: not supported)

Reimplemented in SensorBMA422, SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 813 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

◆ enableStepCounter()

virtual bool SensorBMA4XX::enableStepCounter ( bool  enable,
uint16_t  step_counter_wm = 1,
bool  reset_counter = false 
)
inlinevirtual

Enable or disable step counter (default: not supported)

Reimplemented in SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 891 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ enableStepDetector()

virtual bool SensorBMA4XX::enableStepDetector ( bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlinevirtual

Enable or disable step detector (default: not supported)

Reimplemented in SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 903 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ enableTapDetector()

virtual bool SensorBMA4XX::enableTapDetector ( bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlinevirtual

Enable or disable tap detection (default: not supported)

Reimplemented in SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 879 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ enableTiltDetector()

virtual bool SensorBMA4XX::enableTiltDetector ( bool  enable,
bool  interrupt_enable = false,
InterruptPinMap  pin_map = InterruptPinMap::PIN1 
)
inlinevirtual

Enable or disable tilt detection (default: not supported)

Reimplemented in SensorBMA423.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 927 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ getCapabilities()

virtual BMA4XXCapability::Capability SensorBMA4XX::getCapabilities ( ) const
pure virtual

Get supported capabilities.

Returns
Bitmask of supported capabilities
See also
BMA4XXCapability::Capability

Implemented in SensorBMA422, SensorBMA423, and SensorBMA456H.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by setupFeatures().

◆ getDev()

bma4_dev_t * SensorBMA4XX::getDev ( )
inline

Get the device structure for the BMA4XX sensor.

Note
This function returns a pointer to the internal device structure.
Return values
Pointerto the bma4_dev_t structure.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 756 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev.

◆ getInterruptStatus()

uint16_t SensorBMA4XX::getInterruptStatus ( )
inline

Get the current interrupt status flags.

Reads the interrupt status register which indicates which interrupts have occurred. Each bit in the returned 16-bit value represents a different interrupt source.

Note
Use with interrupt masks (e.g., BMA4_ACCEL_DATA_RDY_INT, BMA4_FIFO_FULL_INT) to check specific interrupts.
Returns
uint16_t Bitmask of active interrupt flags, or 0 on error.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 566 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev.

Referenced by isInterruptActive().

◆ getModelName()

const char * SensorBMA4XX::getModelName ( ) const
inline

Get the model name of the BMA4XX sensor.

Note
This function returns a string representing the model name based on the chip ID.
Return values
Themodel name as a string.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 731 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References BMA422, BMA423, BMA456, BMA456_AN_SEC, dev, and SENSORLIB_LOG_E.

Referenced by setup(), setupFeatures(), and update().

◆ getTemperature()

float SensorBMA4XX::getTemperature ( ) const
inline

Get the temperature reading from the sensor.

Note
This function retrieves the current temperature reading from the sensor.
Return values
Thetemperature in degrees Celsius, or NaN if the reading fails.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 544 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev, and temperature().

Referenced by loop(), and readData().

◆ getTimeSampleMs()

uint32_t SensorBMA4XX::getTimeSampleMs ( ) const
inline

Get the current sensor time in milliseconds.

Reads the 24-bit free-running sensor time counter and converts it to milliseconds. The counter increments at 39.0625 μs per tick (0.0390625 ms per tick) and overflows after approximately 10.9 minutes.

Returns
uint32_t Sensor time in milliseconds, or 0 on error.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 770 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev.

Referenced by loop().

◆ isDataReady()

bool SensorBMA4XX::isDataReady ( )
inlineoverridevirtual

Check if new accelerometer data is available.

Note
This function checks the interrupt status to determine if new data is ready to be read.
Return values
Trueif new data is available, false otherwise.

Implements AccelerometerBase.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 257 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev.

Referenced by loop().

◆ isInterruptActive()

bool SensorBMA4XX::isInterruptActive ( uint16_t  interrupt_mask)
inline

Check if a specific interrupt is active.

Convenience function to check if a particular interrupt flag is set.

Parameters
interrupt_maskBitmask of the interrupt(s) to check.
Returns
True if any of the specified interrupts are active, false otherwise.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 583 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References getInterruptStatus().

◆ readData()

bool SensorBMA4XX::readData ( AccelerometerData data)
inlineoverridevirtual

◆ reset()

bool SensorBMA4XX::reset ( )
inlineoverridevirtual

Reset the sensor.

Note
This function performs a software reset on the sensor.
Return values
Trueif reset is successful, false otherwise.

Implements AccelerometerBase.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 269 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev, and SENSORLIB_LOG_E.

◆ selfTest()

bool SensorBMA4XX::selfTest ( )
inlineoverridevirtual

Perform a self-test on the sensor.

Note
This function checks the functionality of the sensor by performing a self-test.
Return values
Trueif self-test is successful, false otherwise.

Implements AccelerometerBase.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 283 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev, SENSORLIB_LOG_E, and SENSORLIB_LOG_I.

◆ setBandwidth()

bool SensorBMA4XX::setBandwidth ( AccelBandwidth  bandwidth)
inline

Set the bandwidth of the accelerometer.

Note
This function configures the accelerometer to operate with a specific bandwidth.
Parameters
bandwidthThe desired bandwidth setting. Allowed values are OSR4_AVG1, OSR2_AVG2, NORMAL_AVG4, etc.
Return values
Trueif the configuration is successful, false otherwise.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 401 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References _accel_conf, CIC_AVG8, dev, NORMAL_AVG4, OSR2_AVG2, OSR4_AVG1, RES_AVG128, RES_AVG16, RES_AVG32, RES_AVG64, and SENSORLIB_LOG_E.

Referenced by configAccelerometer().

◆ setFullScaleRange()

bool SensorBMA4XX::setFullScaleRange ( AccelFullScaleRange  range)
inlineoverridevirtual

Set the full-scale range of the accelerometer.

Note
This function configures the accelerometer to operate within a specific range.
Parameters
rangeFS_2G, FS_4G, FS_8G, FS_16G
Return values
Trueif the configuration is successful, false otherwise.

Implements AccelerometerBase.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 304 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References _accel_conf, SensorBase< AccelerometerData >::_config, _half_scale, SensorBase< AccelerometerData >::_sensitivity, dev, FS_16G, FS_2G, FS_4G, FS_8G, SensorConfig::range, AccelerometerUtils::rangeToG(), and SENSORLIB_LOG_E.

Referenced by configAccelerometer(), and update().

◆ setInterruptPinConfig()

bool SensorBMA4XX::setInterruptPinConfig ( InterruptPinMap  pin_map,
bool  edge_trigger = false,
bool  active_low = true,
bool  output_en = true,
bool  input_en = false 
)
inline

Configure the electrical properties of an interrupt pin.

Sets up the physical characteristics of the interrupt pin, including:

  • Trigger type (edge or level)
  • Active level (active low or active high)
  • Output type (open-drain or push-pull)
  • Input/output enables
Parameters
pin_mapWhich interrupt pin to configure (PIN1 or PIN2).
edge_triggerTrue for edge-triggered, false for level-triggered.
active_lowTrue for active-low, false for active-high.
output_enTrue to enable output driver.
input_enTrue to enable input buffer
Returns
True if configuration succeeded, false otherwise.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 605 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References dev, and PIN1.

Referenced by setup().

◆ setOperationMode()

bool SensorBMA4XX::setOperationMode ( OperationMode  mode)
inlineoverridevirtual

Set the operation mode of the accelerometer.

Note
This function configures the accelerometer to operate in a specific mode.
Parameters
modeThe desired operation mode. Allowed values are SUSPEND, NORMAL.
Return values
Trueif the configuration is successful, false otherwise.

Implements AccelerometerBase.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 475 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References SensorBase< AccelerometerData >::_config, dev, SensorConfig::mode, NORMAL, SENSORLIB_LOG_E, and SUSPEND.

Referenced by configAccelerometer().

◆ setOutputDataRate()

bool SensorBMA4XX::setOutputDataRate ( float  data_rate_hz)
inlineoverridevirtual

Set the output data rate of the accelerometer.

Note
This function configures the accelerometer to output data at a specific rate.
Parameters
data_rate_hzThe desired output data rate in Hz. Allowed values are 0.78, 1.56, 3.12, 6.25, 12.5, 25, 50, 100, 200, 400, 800, 1600.
Return values
Trueif the configuration is successful, false otherwise.

Implements AccelerometerBase.

Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 341 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References _accel_conf, SensorBase< AccelerometerData >::_config, dev, SensorConfig::sample_rate, SENSORLIB_LOG_D, and SENSORLIB_LOG_E.

Referenced by configAccelerometer(), and update().

◆ setPerformanceMode()

bool SensorBMA4XX::setPerformanceMode ( AccelPerfMode  mode)
inline

Set the performance mode of the accelerometer.

Note
This function configures the accelerometer to operate in a specific performance mode.
Parameters
modeThe desired performance mode. Allowed values are CIC_AVG_MODE, CONTINUOUS_MODE. CIC_AVG_MODE: Averaging samples (Default) CONTINUOUS_MODE: No averaging
Return values
Trueif the configuration is successful, false otherwise.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 448 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References _accel_conf, CIC_AVG_MODE, CONTINUOUS_MODE, dev, and SENSORLIB_LOG_E.

Referenced by configAccelerometer().

◆ setRemapAxes()

virtual bool SensorBMA4XX::setRemapAxes ( SensorRemap  remap)
inlinevirtual

Set the remapping of axes for the BMA4XX sensor.

Note
This function configures the sensor to use a specific axis remapping.
Parameters
remapThe desired axis remapping configuration, See SensorRemap enum for options.
Return values
Trueif the remapping is successful, false otherwise.
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 668 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

References _remap_reg_offset, BOTTOM_LAYER_BOTTOM_LEFT_CORNER, BOTTOM_LAYER_BOTTOM_RIGHT_CORNER, BOTTOM_LAYER_TOP_LEFT_CORNER, BOTTOM_LAYER_TOP_RIGHT_CORNER, dev, SENSORLIB_LOG_D, SENSORLIB_LOG_E, TOP_LAYER_BOTTOM_LEFT_CORNER, TOP_LAYER_BOTTOM_RIGHT_CORNER, TOP_LAYER_LEFT_CORNER, and TOP_LAYER_RIGHT_CORNER.

Referenced by setup(), and setupFeatures().

◆ update()

Member Data Documentation

◆ _accel_conf

◆ _half_scale

float SensorBMA4XX::_half_scale
protected

◆ _remap_reg_offset

◆ dev

std::unique_ptr<struct bma4_dev> SensorBMA4XX::dev
protected
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 1046 of file sensor/accelerometer/bma/SensorBMA4XX.hpp.

Referenced by SensorBMA422::configMotion(), SensorBMA423::configMotion(), SensorBMA456H::configMotion(), SensorBMA422::enableAnyMotionDetection(), SensorBMA423::enableAnyMotionDetection(), SensorBMA423::enableFeature(), SensorBMA456H::enableFeature(), enableInterrupt(), SensorBMA422::enableNoMotionDetection(), SensorBMA423::enableNoMotionDetection(), SensorBMA423::enableStepCounter(), SensorBMA456H::enableStepCounter(), SensorBMA423::getActivityType(), SensorBMA456H::getActivityType(), SensorBMA422::getAnyMotionConfig(), SensorBMA456H::getAnyMotionConfig(), getDev(), getInterruptStatus(), getModelName(), SensorBMA423::getMotionConfig(), SensorBMA422::getNoMotionConfig(), SensorBMA456H::getNoMotionConfig(), SensorBMA423::getStepCount(), SensorBMA456H::getStepCount(), SensorBMA423::getStepCounterWatermark(), SensorBMA456H::getStepCounterWatermark(), SensorBMA456H::getTapType(), getTemperature(), getTimeSampleMs(), isDataReady(), readData(), reset(), SensorBMA423::resetStepCounter(), SensorBMA456H::resetStepCounter(), SensorBMA423::selectPlatform(), SensorBMA423::selectTapType(), selfTest(), setBandwidth(), setFullScaleRange(), setInterruptPinConfig(), setOperationMode(), setOutputDataRate(), setPerformanceMode(), setRemapAxes(), SensorBMA422::update(), SensorBMA423::update(), SensorBMA456H::update(), and update().


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