HardFOC Core
API reference
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Bmp581Handler Class Reference

Handler wrapping one BMP581 on a BaseI2c device. More...

#include <Bmp581Handler.h>

Classes

struct  Counters
 Diagnostics counters since construction. More...
 

Public Types

using DriverType = bmp581::Driver< HalI2cBmp581Comm >
 

Public Member Functions

 Bmp581Handler (BaseI2c &i2c_device, const Bmp581HandlerConfig &config=Bmp581HandlerConfig{}, RtosMutex *bus_mutex=nullptr) noexcept
 
 Bmp581Handler (const Bmp581Handler &)=delete
 
Bmp581Handler & operator= (const Bmp581Handler &)=delete
 
 Bmp581Handler (Bmp581Handler &&)=delete
 
Bmp581Handler & operator= (Bmp581Handler &&)=delete
 
bool EnsureInitialized () noexcept
 Probe (chip id + NVM ready), optional soft reset, apply the configured preset. Idempotent.
 
bool IsPresent () const noexcept
 True once EnsureInitialized() has succeeded.
 
std::uint8_t ChipId () const noexcept
 Chip id read at probe (0 until present).
 
const bmp581::EffectiveOsr & EffectiveOsr () const noexcept
 Effective OSR / ODR validity captured after configuration.
 
bmp581::DriverResult< bool > DataReady () noexcept
 Whether a fresh sample is waiting (INT_STATUS.drdy).
 
bmp581::DriverResult< bmp581::Sample > ReadSample () noexcept
 Read pressure [Pa] and temperature [°C].
 
bmp581::DriverResult< void > Configure (const bmp581::Config &cfg) noexcept
 Re-apply a new configuration (standby hop handled by the driver).
 
bmp581::DriverResult< void > Reset () noexcept
 Soft reset; the handler re-applies the current configuration.
 
Counters GetCounters () const noexcept
 

Private Member Functions

bool EnsureInitializedLocked () noexcept
 

Private Attributes

Bmp581HandlerConfig config_
 
HalI2cBmp581Comm comm_
 
std::unique_ptr< DriverType > driver_
 
std::uint8_t chip_id_ {0}
 
bmp581::EffectiveOsr effective_ {}
 
std::atomic< bool > initialized_ {false}
 
std::atomic< std::uint32_t > samples_ {0}
 
std::atomic< std::uint32_t > bus_errors_ {0}
 
RtosMutex private_mutex_
 
RtosMutex * bus_mutex_
 

Detailed Description

Handler wrapping one BMP581 on a BaseI2c device.

Member Typedef Documentation

◆ DriverType

Constructor & Destructor Documentation

◆ Bmp581Handler() [1/3]

Bmp581Handler::Bmp581Handler ( BaseI2c &  i2c_device,
const Bmp581HandlerConfig &  config = Bmp581HandlerConfig{},
RtosMutex *  bus_mutex = nullptr 
)
explicitnoexcept
Parameters
i2c_deviceConfigured BaseI2c device. Must outlive the handler.
configSensor preset + bring-up options.
bus_mutexOptional shared mutex when several devices share the bus; private when null.

◆ Bmp581Handler() [2/3]

Bmp581Handler::Bmp581Handler ( const Bmp581Handler &  )
delete

◆ Bmp581Handler() [3/3]

Bmp581Handler::Bmp581Handler ( Bmp581Handler &&  )
delete

Member Function Documentation

◆ ChipId()

std::uint8_t Bmp581Handler::ChipId ( ) const
inlinenoexcept

Chip id read at probe (0 until present).

◆ Configure()

bmp581::DriverResult< void > Bmp581Handler::Configure ( const bmp581::Config &  cfg)
noexcept

Re-apply a new configuration (standby hop handled by the driver).

◆ DataReady()

bmp581::DriverResult< bool > Bmp581Handler::DataReady ( )
noexcept

Whether a fresh sample is waiting (INT_STATUS.drdy).

◆ EffectiveOsr()

const bmp581::EffectiveOsr & Bmp581Handler::EffectiveOsr ( ) const
inlinenoexcept

Effective OSR / ODR validity captured after configuration.

◆ EnsureInitialized()

bool Bmp581Handler::EnsureInitialized ( )
noexcept

Probe (chip id + NVM ready), optional soft reset, apply the configured preset. Idempotent.

Returns
true when the device answered and accepted the configuration.

◆ EnsureInitializedLocked()

bool Bmp581Handler::EnsureInitializedLocked ( )
privatenoexcept

◆ GetCounters()

Bmp581Handler::Counters Bmp581Handler::GetCounters ( ) const
noexcept

◆ IsPresent()

bool Bmp581Handler::IsPresent ( ) const
inlinenoexcept

True once EnsureInitialized() has succeeded.

◆ operator=() [1/2]

Bmp581Handler & Bmp581Handler::operator= ( Bmp581Handler &&  )
delete

◆ operator=() [2/2]

Bmp581Handler & Bmp581Handler::operator= ( const Bmp581Handler &  )
delete

◆ ReadSample()

bmp581::DriverResult< bmp581::Sample > Bmp581Handler::ReadSample ( )
noexcept

Read pressure [Pa] and temperature [°C].

◆ Reset()

bmp581::DriverResult< void > Bmp581Handler::Reset ( )
noexcept

Soft reset; the handler re-applies the current configuration.

Member Data Documentation

◆ bus_errors_

std::atomic<std::uint32_t> Bmp581Handler::bus_errors_ {0}
private

◆ bus_mutex_

RtosMutex* Bmp581Handler::bus_mutex_
private

◆ chip_id_

std::uint8_t Bmp581Handler::chip_id_ {0}
private

◆ comm_

HalI2cBmp581Comm Bmp581Handler::comm_
private

◆ config_

Bmp581HandlerConfig Bmp581Handler::config_
private

◆ driver_

std::unique_ptr<DriverType> Bmp581Handler::driver_
private

◆ effective_

bmp581::EffectiveOsr Bmp581Handler::effective_ {}
private

◆ initialized_

std::atomic<bool> Bmp581Handler::initialized_ {false}
private

◆ private_mutex_

RtosMutex Bmp581Handler::private_mutex_
private

◆ samples_

std::atomic<std::uint32_t> Bmp581Handler::samples_ {0}
private

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