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

I2C communication parameters. More...

#include <SensorCommBase.hpp>

Inheritance diagram for I2CParam:
[legend]

Public Types

enum  I2CParamType {
  I2C_SET_ADDR , I2C_SET_FLAG , I2C_SET_CLOCK , I2C_SET_WRITE_DELAY_US ,
  I2C_SET_READ_DELAY_US
}
 Identifiers for the various I2C settings that can be changed. More...
 

Public Member Functions

 I2CParam (I2CParamType type, uint32_t params)
 Construct an I2C parameter object.
 
uint32_t getParams () const
 Retrieve the stored parameter value.
 
uint8_t getType () const
 Retrieve the parameter type.
 
- Public Member Functions inherited from CommParamsBase
virtual ~CommParamsBase ()=default
 

Protected Attributes

enum I2CParamType type
 Which I2C parameter this object represents.
 
uint32_t params
 The value of the parameter.
 

Detailed Description

I2C communication parameters.

Encapsulates a type (which setting to change) and a value.

Definition at line 104 of file SensorCommBase.hpp.

Member Enumeration Documentation

◆ I2CParamType

Identifiers for the various I2C settings that can be changed.

Enumerator
I2C_SET_ADDR 

Set device address.

I2C_SET_FLAG 

Set a generic flag (interpretation depends on driver)

I2C_SET_CLOCK 

Set I2C clock frequency.

I2C_SET_WRITE_DELAY_US 

Delay after write operations (microseconds)

I2C_SET_READ_DELAY_US 

Delay after read operations (microseconds)

Definition at line 110 of file SensorCommBase.hpp.

Constructor & Destructor Documentation

◆ I2CParam()

I2CParam::I2CParam ( I2CParamType  type,
uint32_t  params 
)
inline

Construct an I2C parameter object.

Parameters
typeWhich parameter to change (see I2CParamType).
paramsThe value associated with the parameter.

Definition at line 123 of file SensorCommBase.hpp.

Member Function Documentation

◆ getParams()

uint32_t I2CParam::getParams ( ) const
inline

Retrieve the stored parameter value.

Returns
uint32_t The parameter value.

Definition at line 129 of file SensorCommBase.hpp.

References params.

◆ getType()

uint8_t I2CParam::getType ( ) const
inline

Retrieve the parameter type.

Returns
uint8_t The I2CParamType (cast to uint8_t).

Definition at line 138 of file SensorCommBase.hpp.

References type.

Referenced by SensorCommCustom::setParams().

Member Data Documentation

◆ params

uint32_t I2CParam::params
protected

The value of the parameter.

Definition at line 145 of file SensorCommBase.hpp.

Referenced by getParams().

◆ type

enum I2CParamType I2CParam::type
protected

Which I2C parameter this object represents.

Definition at line 144 of file SensorCommBase.hpp.

Referenced by getType().


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