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

Abstract base class for gyroscope implementations. More...

#include <GyroscopeBase.hpp>

Inheritance diagram for GyroscopeBase:
[legend]

Public Member Functions

virtual bool readData (GyroscopeData &data) override=0
 Read gyroscope data.
 
virtual bool isDataReady () override=0
 Check if new gyroscope data is available.
 
virtual bool reset () override=0
 Reset gyroscope to default state.
 
virtual bool selfTest () override=0
 Perform gyroscope self-test.
 
virtual bool setFullScaleRange (GyroFullScaleRange range)=0
 Set gyroscope full-scale range.
 
virtual bool setOutputDataRate (float data_rate_hz)=0
 Set gyroscope output data rate.
 
virtual bool setOperationMode (OperationMode mode)=0
 Set gyroscope operation mode.
 
- Public Member Functions inherited from SensorBase< GyroscopeData >
 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.
 

Protected Member Functions

 GyroscopeBase ()
 Construct a new GyroscopeBase object.
 
virtual ~GyroscopeBase ()=default
 Destroy the GyroscopeBase object.
 
 GyroscopeBase (const GyroscopeBase &)=delete
 
GyroscopeBaseoperator= (const GyroscopeBase &)=delete
 
- Protected Member Functions inherited from SensorBase< GyroscopeData >
 SensorBase (SensorType sensor_type=SensorType::UNKNOWN)
 Construct a new SensorBase object.
 
virtual ~SensorBase ()=default
 Virtual destructor for proper polymorphic cleanup.
 

Additional Inherited Members

- Protected Attributes inherited from SensorBase< GyroscopeData >
SensorConfig _config
 Current configuration.
 
SensorInfo _info
 Sensor information.
 
int16_t _x_offset
 
int16_t _y_offset
 
int16_t _z_offset
 
float _sensitivity
 

Detailed Description

Abstract base class for gyroscope implementations.

Note
This is an abstract base class and cannot be instantiated directly. Use derived classes for specific gyroscope sensor ICs.

Definition at line 44 of file GyroscopeBase.hpp.

Constructor & Destructor Documentation

◆ GyroscopeBase() [1/2]

GyroscopeBase::GyroscopeBase ( )
inlineexplicitprotected

Construct a new GyroscopeBase object.

Note
Constructor is protected to prevent direct instantiation.

Definition at line 52 of file GyroscopeBase.hpp.

◆ ~GyroscopeBase()

virtual GyroscopeBase::~GyroscopeBase ( )
protectedvirtualdefault

Destroy the GyroscopeBase object.

◆ GyroscopeBase() [2/2]

GyroscopeBase::GyroscopeBase ( const GyroscopeBase )
protecteddelete

Member Function Documentation

◆ isDataReady()

virtual bool GyroscopeBase::isDataReady ( )
overridepure virtual

Check if new gyroscope data is available.

Returns
true New data available
false No new data

Implements SensorBase< GyroscopeData >.

Implemented in ImuGyroscopeAdapter.

◆ operator=()

GyroscopeBase & GyroscopeBase::operator= ( const GyroscopeBase )
protecteddelete

◆ readData()

virtual bool GyroscopeBase::readData ( GyroscopeData data)
overridepure virtual

Read gyroscope data.

Parameters
dataReference to store gyroscope data
Returns
true Read successful
false Read failed

Implements SensorBase< GyroscopeData >.

Implemented in ImuGyroscopeAdapter.

◆ reset()

virtual bool GyroscopeBase::reset ( )
overridepure virtual

Reset gyroscope to default state.

Returns
true Reset successful
false Reset failed

Implements SensorBase< GyroscopeData >.

Implemented in ImuGyroscopeAdapter.

◆ selfTest()

virtual bool GyroscopeBase::selfTest ( )
overridepure virtual

Perform gyroscope self-test.

Returns
true Self-test passed
false Self-test failed

Implements SensorBase< GyroscopeData >.

Implemented in ImuGyroscopeAdapter.

◆ setFullScaleRange()

virtual bool GyroscopeBase::setFullScaleRange ( GyroFullScaleRange  range)
pure virtual

Set gyroscope full-scale range.

Parameters
rangeDesired full-scale range
Returns
true Configuration successful
false Configuration failed

Implemented in ImuGyroscopeAdapter.

◆ setOperationMode()

virtual bool GyroscopeBase::setOperationMode ( OperationMode  mode)
pure virtual

Set gyroscope operation mode.

Parameters
modeDesired operation mode
Returns
true Configuration successful
false Configuration failed

Implemented in ImuGyroscopeAdapter.

◆ setOutputDataRate()

virtual bool GyroscopeBase::setOutputDataRate ( float  data_rate_hz)
pure virtual

Set gyroscope output data rate.

Parameters
data_rate_hzDesired output data rate in Hertz
Returns
true Configuration successful
false Configuration failed

Implemented in ImuGyroscopeAdapter.


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