|
HardFOC Core
API reference
|
Handler wrapping one SF06 flow meter on a BaseI2c device.
More...
#include <SfmHandler.h>
Classes | |
| struct | Counters |
| Diagnostics counters since construction. More... | |
Public Types | |
| using | DriverType = sfm::Driver< HalI2cSfmComm > |
Public Member Functions | |
| SfmHandler (BaseI2c &i2c_device, const SfmHandlerConfig &config=SfmHandlerConfig{}, RtosMutex *bus_mutex=nullptr) noexcept | |
| SfmHandler (const SfmHandler &)=delete | |
| SfmHandler & | operator= (const SfmHandler &)=delete |
| SfmHandler (SfmHandler &&)=delete | |
| SfmHandler & | operator= (SfmHandler &&)=delete |
| bool | EnsureInitialized () noexcept |
| Probe the device: optional soft reset, stop any running measurement, read product identifier + serial. Idempotent. | |
| void | Invalidate () noexcept |
Forget the cached identity: the next EnsureInitialized() (or Start) reads the product identifier again. For a re-probe after a fault — the part may have been reset, swapped, or identified from a corrupted read. | |
| bool | IsPresent () const noexcept |
True once EnsureInitialized() has succeeded. | |
| const sfm::ProductInfo & | Identity () const noexcept |
| Cached identity (zeroed until probe succeeds). | |
| bool | SupportsGas (sfm::Gas gas) const noexcept |
Whether the probed variant carries a factory table for gas. | |
| float | FullScaleSlm () const noexcept |
| Full-scale flow of the probed variant [slm] (0 when unknown). | |
| sfm::DriverResult< void > | Start (sfm::Gas gas) noexcept |
Start continuous measurement on gas (reads scale/offset first) and apply the configured averaging window. | |
| sfm::DriverResult< void > | Start () noexcept |
Start(config.default_gas). | |
| sfm::DriverResult< void > | Stop () noexcept |
| Stop continuous measurement (idle). | |
| sfm::DriverResult< sfm::Measurement > | ReadMeasurement () noexcept |
Read one flow / temperature / status frame (NoData when no fresh sample). | |
| sfm::DriverResult< void > | ConfigureAveraging (std::uint16_t window) noexcept |
| Change the averaging window while measuring (0 = average-until-read). | |
| sfm::DriverResult< void > | UpdateConcentration (std::uint16_t o2_permille) noexcept |
| Update the O2 fraction of a running mixture table. | |
| sfm::DriverResult< float > | ReadTemperature () noexcept |
SFx6000: flow-chip temperature while measuring (NotSupported on SF06). | |
| sfm::DriverResult< sfm::Measurement > | DecodeFrame (const std::uint8_t frame[9]) noexcept |
| Decode a 9-byte frame fetched by an interrupt / DMA reader with the active family and scaling; counts frames and CRC errors. | |
| sfm::Family | Family () const noexcept |
| Part family (from the identifier once probed). | |
| std::uint8_t | Address () const noexcept |
| 7-bit address of the bound device. | |
| sfm::Gas | ActiveGas () const noexcept |
Gas selected by the last successful Start(). | |
| sfm::Scaling | ActiveScaling () const noexcept |
Scale / offset / unit captured at Start(). | |
| bool | Measuring () const noexcept |
| True while a continuous measurement is running. | |
| Counters | GetCounters () const noexcept |
Private Member Functions | |
| bool | EnsureInitializedLocked () noexcept |
Private Attributes | |
| SfmHandlerConfig | config_ |
| HalI2cSfmComm | comm_ |
| std::unique_ptr< DriverType > | driver_ |
| sfm::ProductInfo | identity_ {} |
| std::atomic< bool > | initialized_ {false} |
| std::atomic< std::uint32_t > | frames_ {0} |
| std::atomic< std::uint32_t > | no_data_ {0} |
| std::atomic< std::uint32_t > | crc_errors_ {0} |
| std::atomic< std::uint32_t > | bus_errors_ {0} |
| RtosMutex | private_mutex_ |
| RtosMutex * | bus_mutex_ |
Handler wrapping one SF06 flow meter on a BaseI2c device.
| using SfmHandler::DriverType = sfm::Driver<HalI2cSfmComm> |
|
explicitnoexcept |
| i2c_device | Configured BaseI2c device (address = sensor address). Must outlive the handler. |
| config | Gas / averaging / diagnostics. |
| bus_mutex | Optional shared mutex when several devices share the bus; private when null. |
|
delete |
|
delete |
|
noexcept |
Gas selected by the last successful Start().
|
noexcept |
Scale / offset / unit captured at Start().
|
inlinenoexcept |
7-bit address of the bound device.
|
noexcept |
Change the averaging window while measuring (0 = average-until-read).
|
noexcept |
Decode a 9-byte frame fetched by an interrupt / DMA reader with the active family and scaling; counts frames and CRC errors.
|
noexcept |
Probe the device: optional soft reset, stop any running measurement, read product identifier + serial. Idempotent.
|
privatenoexcept |
|
noexcept |
Part family (from the identifier once probed).
|
noexcept |
Full-scale flow of the probed variant [slm] (0 when unknown).
|
noexcept |
|
inlinenoexcept |
Cached identity (zeroed until probe succeeds).
|
inlinenoexcept |
Forget the cached identity: the next EnsureInitialized() (or Start) reads the product identifier again. For a re-probe after a fault — the part may have been reset, swapped, or identified from a corrupted read.
|
inlinenoexcept |
True once EnsureInitialized() has succeeded.
|
noexcept |
True while a continuous measurement is running.
|
delete |
|
delete |
|
noexcept |
Read one flow / temperature / status frame (NoData when no fresh sample).
|
noexcept |
SFx6000: flow-chip temperature while measuring (NotSupported on SF06).
|
inlinenoexcept |
Start(config.default_gas).
|
noexcept |
Start continuous measurement on gas (reads scale/offset first) and apply the configured averaging window.
UnsupportedGas when the variant lacks the table.
|
noexcept |
Stop continuous measurement (idle).
|
noexcept |
Whether the probed variant carries a factory table for gas.
|
noexcept |
Update the O2 fraction of a running mixture table.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |