AMS Advanced Air Mobility Sensors UG
Loading...
Searching...
No Matches
CBmp384Driver Class Reference

The class implements the BMP384 Driver. The driver adjusts the sensor BMP384. More...

Inheritance diagram for CBmp384Driver:
CSoftwareComponent< CBmp384Driver, 1U >

Classes

struct  SFloatParams
 Structure of BMP384 compensation trim parameters. More...
 
struct  SParams
 Integer pressure compensation parameters read from the NVM of BMP384. More...
 

Public Member Functions

void Init () override
 
bool IsInitialized () override
 
void PollSensor (uint64_t uTimestamp)
 Poll the BMP384 sensor.
 
void PollSensor ()
 A function overload that generates a timestamp without a data-ready interrupt.
 
- Public Member Functions inherited from CSoftwareComponent< CBmp384Driver, 1U >
 CSoftwareComponent (CSoftwareComponent &)=delete
 
 CSoftwareComponent (CSoftwareComponent &&)=delete
 
CSoftwareComponentoperator= (const CSoftwareComponent &orOther)=delete
 
CSoftwareComponentoperator= (CSoftwareComponent &&orOther)=delete
 
virtual void Init ()=0
 
virtual bool IsInitialized ()=0
 

Private Types

enum class  EOversampling {
  eSkip = 0x00 , eX2 = 0x01 , eX4 = 0x02 , eX8 = 0x03 ,
  eX16 = 0x04 , eX32 = 0x05
}
 An enum of bit fields with redundant sampling in the control and measurement register. More...
 
enum class  EIirFilter {
  eOff = 0x00 , e1 = 0x01 , e3 = 0x02 , e7 = 0x03 ,
  e15 = 0x04 , e31 = 0x05 , e63 = 0x06 , e127 = 0x07
}
 An enum of the bit fields of the infinite Impulse response (IIR) filter in the configuration register. More...
 
enum class  ETimeStandby {
  e5MS = 0x00 , e10MS = 0x01 , e20MS = 0x02 , e40MS = 0x03 ,
  e80MS = 0x04 , e160MS = 0x05 , e320MS = 0x06 , e640MS = 0x07 ,
  e1280MS = 0x08 , e2560MS = 0x09 , e5120MS = 0x0A , e10240MS = 0x0B ,
  e20480MS = 0x0C , e40960MS = 0x0D , e81920MS = 0x0E , e163840MS = 0x0F ,
  e327680MS = 0x10 , e655360MS = 0x11
}
 An enum of the waiting time bit fields in the output data rate register (ODR) More...
 
enum class  EMode { eSleep , eForce , eNormal }
 An enum of operated power modes. More...
 

Private Member Functions

 CBmp384Driver (CBmp384Driver &)=delete
 
 CBmp384Driver (CBmp384Driver &&)=delete
 
CBmp384Driveroperator= (const CBmp384Driver &orOther)=delete
 
CBmp384Driveroperator= (CBmp384Driver &&orOther)=delete
 
 CBmp384Driver ()=default
 
 ~CBmp384Driver ()=default
 
bool getChipID (uint8_t &urChipId)
 Get the Chip ID value.
 
bool getTrimParam ()
 Get the Trim Parameters structure.
 
bool getTemperatureAndPressure (float &frTemperature, float &frPressure)
 Get the Temperature And Pressure values.
 
bool setSoftReset ()
 Request soft reset.
 
bool enableInterrupt ()
 Configure interrupts.
 
bool setPowerMode (EMode eMode)
 Set the Power Mode.
 
bool setFilter (EIirFilter eFilterType)
 Set the Filter value.
 
bool setTimeStandby (ETimeStandby eTimeStandby)
 Set the Time Standby.
 
bool setPresOversampling (EOversampling ePresOversampling)
 Set the Pressure Oversampling value.
 
bool setTempOversampling (EOversampling eTempOversampling)
 Set the Temperature oversampling value.
 
bool setOversamplingRegister (EOversampling ePresOversampling, EOversampling eTempOversamping)
 Set the Oversampling Register value.
 
bool isReadyRead ()
 Is the data ready to be read.
 
bool readFromAddress (uint8_t *upBuffer, uint8_t uReadAddr, uint16_t uNumByteToRead)
 Read from address via SPI.
 
bool writeToAddress (uint8_t uWriteAddr, uint8_t uVal)
 Write to address via SPI.
 
float compensateTemperature (float fUncompensatedTemperature)
 Compensate temperature value.
 
float compensatePressure (float fUncompensatedPressure, float fCompensatedTemperature)
 Compensate pressure value.
 
void setCsOn ()
 Set the chip select pin is On.
 
void setCsOff ()
 Set the chip select pin is Off.
 

Static Private Member Functions

static CBmp384DrivergetInstanceImpl (unsigned uInstanceIndex)
 

Private Attributes

SFloatParams oFloatParams_
 Float point compensation trim parameters.
 
SParams oParams_
 Compensation trim parameters (coefficients)
 
bool bIsInitialized_ { false }
 Sensor status after initialization.
 

Friends

class CSoftwareComponent< CBmp384Driver, 1U >
 

Additional Inherited Members

- Static Public Member Functions inherited from CSoftwareComponent< CBmp384Driver, 1U >
static CBmp384DriverGetInstance (unsigned uInstanceIndex=0U)
 
- Static Public Attributes inherited from CSoftwareComponent< CBmp384Driver, 1U >
static constexpr unsigned skuInstanceCount_
 
- Protected Member Functions inherited from CSoftwareComponent< CBmp384Driver, 1U >
 CSoftwareComponent ()=default
 
 ~CSoftwareComponent ()=default
 

Detailed Description

The class implements the BMP384 Driver. The driver adjusts the sensor BMP384.

Member Enumeration Documentation

◆ EIirFilter

enum class CBmp384Driver::EIirFilter
strongprivate

An enum of the bit fields of the infinite Impulse response (IIR) filter in the configuration register.

Enumerator
eOff 

Coefficient 0.

e1 

Coefficient 1.

e3 

Coefficient 3.

e7 

Coefficient 7.

e15 

Coefficient 15.

e31 

Coefficient 31.

e63 

Coefficient 63.

e127 

Coefficient 127.

◆ EMode

enum class CBmp384Driver::EMode
strongprivate

An enum of operated power modes.

Enumerator
eSleep 

Sleep mode.

eForce 

Forced mode.

eNormal 

Normal mode.

◆ EOversampling

enum class CBmp384Driver::EOversampling
strongprivate

An enum of bit fields with redundant sampling in the control and measurement register.

Enumerator
eSkip 

Oversampling x1.

eX2 

Oversampling x2.

eX4 

Oversampling x3.

eX8 

Oversampling x8.

eX16 

Oversampling x16.

eX32 

Oversampling x32.

◆ ETimeStandby

enum class CBmp384Driver::ETimeStandby
strongprivate

An enum of the waiting time bit fields in the output data rate register (ODR)

Enumerator
e5MS 

5 millisecond - 200 Hz

e10MS 

10 millisecond - 100 Hz

e20MS 

20 millisecond - 50 Hz

e40MS 

40 millisecond - 25 Hz

e80MS 

80 millisecond - 12.5 Hz

e160MS 

160 millisecond - 6.25 Hz

e320MS 

320 millisecond - 3.1 Hz

e640MS 

640 millisecond - 1.5 Hz

e1280MS 

1280 millisecond - 0.78 Hz

e2560MS 

2560 millisecond - 0.39 Hz

e5120MS 

5120 millisecond - 0.2 Hz

e10240MS 

10240 millisecond - 0.1 Hz

e20480MS 

20480 millisecond - 0.05 Hz

e40960MS 

40960 millisecond - 0.02 Hz

e81920MS 

81920 millisecond - 0.01 Hz

e163840MS 

163840 millisecond - 0.006 Hz

e327680MS 

327680 millisecond - 0.003 Hz

e655360MS 

655360 millisecond - 0.0015 Hz

Constructor & Destructor Documentation

◆ CBmp384Driver() [1/3]

CBmp384Driver::CBmp384Driver ( CBmp384Driver )
privatedelete

◆ CBmp384Driver() [2/3]

CBmp384Driver::CBmp384Driver ( CBmp384Driver &&  )
privatedelete

◆ CBmp384Driver() [3/3]

CBmp384Driver::CBmp384Driver ( )
privatedefault

◆ ~CBmp384Driver()

CBmp384Driver::~CBmp384Driver ( )
privatedefault

Member Function Documentation

◆ compensatePressure()

float CBmp384Driver::compensatePressure ( float  fUncompensatedPressure,
float  fCompensatedTemperature 
)
private

Compensate pressure value.

Parameters
fUncompensatedPressurePressure value
fCompensatedTemperatureTemperature value (after compensation)
Returns
Compensated pressure

◆ compensateTemperature()

float CBmp384Driver::compensateTemperature ( float  fUncompensatedTemperature)
private

Compensate temperature value.

Parameters
fUncompensatedTemperatureTemperature value
Returns
Compensated temperature

◆ enableInterrupt()

bool CBmp384Driver::enableInterrupt ( )
private

Configure interrupts.

Returns
True – success, false – failure.

◆ getChipID()

bool CBmp384Driver::getChipID ( uint8_t &  urChipId)
private

Get the Chip ID value.

Parameters
urChipIdReference to the chip ID to be filled
Returns
True – success, false – failure.

◆ getInstanceImpl()

CBmp384Driver & CBmp384Driver::getInstanceImpl ( unsigned  uInstanceIndex)
staticprivate

◆ getTemperatureAndPressure()

bool CBmp384Driver::getTemperatureAndPressure ( float &  frTemperature,
float &  frPressure 
)
private

Get the Temperature And Pressure values.

Parameters
frTemperaturereference to the temperature variable
frPressurereference to the pressure variable
Returns
True – success, false – failure.

◆ getTrimParam()

bool CBmp384Driver::getTrimParam ( )
private

Get the Trim Parameters structure.

Returns
True – success, false – failure.

◆ Init()

void CBmp384Driver::Init ( )
overridevirtual

Initialize the software component.

Implements CSoftwareComponent< CBmp384Driver, 1U >.

◆ IsInitialized()

bool CBmp384Driver::IsInitialized ( )
overridevirtual

Get initialization status of the software component.

Returns
True – the component is initialized, false otherwise.

Implements CSoftwareComponent< CBmp384Driver, 1U >.

◆ isReadyRead()

bool CBmp384Driver::isReadyRead ( )
private

Is the data ready to be read.

Returns
True – ready, false – not ready.

◆ operator=() [1/2]

CBmp384Driver & CBmp384Driver::operator= ( CBmp384Driver &&  orOther)
privatedelete

◆ operator=() [2/2]

CBmp384Driver & CBmp384Driver::operator= ( const CBmp384Driver orOther)
privatedelete

◆ PollSensor() [1/2]

void CBmp384Driver::PollSensor ( )

A function overload that generates a timestamp without a data-ready interrupt.

◆ PollSensor() [2/2]

void CBmp384Driver::PollSensor ( uint64_t  uTimestamp)

Poll the BMP384 sensor.

Parameters
uTimestampTimestamp of the measurement generated by data-ready interrupt handler.

◆ readFromAddress()

bool CBmp384Driver::readFromAddress ( uint8_t *  upBuffer,
uint8_t  uReadAddr,
uint16_t  uNumByteToRead 
)
private

Read from address via SPI.

Parameters
upBufferBuffer for record
uReadAddrRegister address
uNumByteToReadNumber of bytes to read
Returns
True – success, false – failure.

◆ setCsOff()

void CBmp384Driver::setCsOff ( )
private

Set the chip select pin is Off.

◆ setCsOn()

void CBmp384Driver::setCsOn ( )
private

Set the chip select pin is On.

◆ setFilter()

bool CBmp384Driver::setFilter ( EIirFilter  eFilterType)
private

Set the Filter value.

Parameters
eFilterTypeFilter value

◆ setOversamplingRegister()

bool CBmp384Driver::setOversamplingRegister ( EOversampling  ePresOversampling,
EOversampling  eTempOversamping 
)
private

Set the Oversampling Register value.

Parameters
ePresOversamplingPressure over sampling value
eTempOversampingTemperature over sampling value

◆ setPowerMode()

bool CBmp384Driver::setPowerMode ( EMode  eMode)
private

Set the Power Mode.

Parameters
eModepower mode
Returns
True – success, false – failure.

◆ setPresOversampling()

bool CBmp384Driver::setPresOversampling ( EOversampling  ePresOversampling)
private

Set the Pressure Oversampling value.

Parameters
ePresOversamplingPressure Oversampling value

◆ setSoftReset()

bool CBmp384Driver::setSoftReset ( )
private

Request soft reset.

Returns
True – success, false – failure.

◆ setTempOversampling()

bool CBmp384Driver::setTempOversampling ( EOversampling  eTempOversampling)
private

Set the Temperature oversampling value.

Parameters
eTempOversamplingTemperature oversampling value

◆ setTimeStandby()

bool CBmp384Driver::setTimeStandby ( ETimeStandby  eTimeStandby)
private

Set the Time Standby.

Parameters
eTimeStandbyTime Standby

◆ writeToAddress()

bool CBmp384Driver::writeToAddress ( uint8_t  uWriteAddr,
uint8_t  uVal 
)
private

Write to address via SPI.

Parameters
uWriteAddrRegister address
uValThe resulting value
Returns
True – success, false – failure.

Friends And Related Function Documentation

◆ CSoftwareComponent< CBmp384Driver, 1U >

friend class CSoftwareComponent< CBmp384Driver, 1U >
friend

Member Data Documentation

◆ bIsInitialized_

bool CBmp384Driver::bIsInitialized_ { false }
private

Sensor status after initialization.

◆ oFloatParams_

SFloatParams CBmp384Driver::oFloatParams_
private

Float point compensation trim parameters.

◆ oParams_

SParams CBmp384Driver::oParams_
private

Compensation trim parameters (coefficients)


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