SFM_FLOW_METER Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
sfm_flow_meter_types.hpp File Reference

Public types of the SFM flow meter driver: errors, Result<T>, the families, variants and gases, the Sample, and Config. More...

#include <array>
#include <cstdint>
#include "sfm_flow_meter_detail.hpp"
#include "sfm_flow_meter_version.h"

Go to the source code of this file.

Classes

struct  sfm::Result< T >
 The value of a call, or why there is none. More...
 
struct  sfm::Result< void >
 The result of a call that returns no value. More...
 
struct  sfm::Wait
 A wait the caller owes the driver: delay us, then call Poll(). 0 means nothing to wait. More...
 
struct  sfm::ProductInfo
 The product identifier read at initialisation. More...
 
struct  sfm::ScalingInfo
 What the sensor reports about the scaling of a gas, and whether it matches the table. More...
 
struct  sfm::Capabilities
 Which calls a part offers, from its table row. More...
 
struct  sfm::Sample
 One measurement. Flow is in millilitres per minute at the part's reference conditions. More...
 
struct  sfm::RawReply
 The words of one reply, after their CRCs were checked and before anything was decoded. More...
 
struct  sfm::Stats
 Counters the driver keeps; none of them is cleared by a successful call. More...
 
struct  sfm::Config
 Everything EnsureInitialized() applies. More...
 

Namespaces

namespace  sfm
 The SFM flow meter driver: everything it declares lives here; internals in detail.
 

Enumerations

enum class  sfm::Error : uint8_t {
  sfm::Error::Ok = 0 , sfm::Error::NotInitialized = 1 , sfm::Error::InvalidArgument = 2 , sfm::Error::Bus = 3 ,
  sfm::Error::Timeout = 4 , sfm::Error::DeviceIdMismatch = 5 , sfm::Error::Crc = 6 , sfm::Error::Busy = 7 ,
  sfm::Error::DeviceFault = 8 , sfm::Error::Unsupported = 9 , sfm::Error::NoData = 16 , sfm::Error::NoDevice = 17 ,
  sfm::Error::OutOfRange = 18 , sfm::Error::StatusMismatch = 19 , sfm::Error::Stale = 20 , sfm::Error::DeviceReset = 21 ,
  sfm::Error::StateUnknown = 22 , sfm::Error::InvalidReply = 23
}
 Why a call failed. Every call of the driver returns one of these in its Result. More...
 
enum class  sfm::LogLevel : uint8_t { sfm::LogLevel::Error = 0 , sfm::LogLevel::Warning , sfm::LogLevel::Info , sfm::LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  sfm::Family : uint8_t {
  sfm::Family::Sf06 = 0 , sfm::Family::Sf06Gen2 , sfm::Family::Sf06Dual , sfm::Family::Sf05 ,
  sfm::Family::Sf04 , sfm::Family::Sfx6000
}
 The command-set family of a part. One protocol policy per family; every part is a row of data that names its family. More...
 
enum class  sfm::Variant : uint8_t {
  sfm::Variant::Auto = 0 , sfm::Variant::SFM4300_20_B , sfm::Variant::SFM4300_20_O , sfm::Variant::SFM4300_20_P ,
  sfm::Variant::SFM4300_50_B , sfm::Variant::SFM4300_50_O , sfm::Variant::SFM4300_50_P , sfm::Variant::SFM3003_300_CL ,
  sfm::Variant::SFM3003_300_CE , sfm::Variant::SFM3003_300_CET , sfm::Variant::SFM3013_300_CL , sfm::Variant::SFM3013_300_CLM ,
  sfm::Variant::SFM3019_200_CL , sfm::Variant::SFM3119_240_CL , sfm::Variant::SFM3304_250_D , sfm::Variant::SFM3505_300 ,
  sfm::Variant::SFM3505_300_X , sfm::Variant::SFM3000_200_C , sfm::Variant::SFM3200 , sfm::Variant::SFM3200_AW ,
  sfm::Variant::SFM3300_D , sfm::Variant::SFM3300_AW , sfm::Variant::SFM3400_D , sfm::Variant::SFM3400_AW ,
  sfm::Variant::SFM4200 , sfm::Variant::SFM4100_AIR , sfm::Variant::SFM4100_O2 , sfm::Variant::SFM4100_CO2 ,
  sfm::Variant::SFM4100_N2O , sfm::Variant::SFM4100_AR , sfm::Variant::SFM6000D_50 , sfm::Variant::SFM6000D_20 ,
  sfm::Variant::SFM6000D_5
}
 A part (one row of the table in sfm_flow_meter_parts.hpp). The names follow the vendor's ordering suffixes; _B, _O and _P are the SFM4300 fittings. More...
 
enum class  sfm::Gas : uint8_t {
  sfm::Gas::Air = 0 , sfm::Gas::O2 , sfm::Gas::N2 , sfm::Gas::N2O ,
  sfm::Gas::CO2 , sfm::Gas::Ar , sfm::Gas::HeOx , sfm::Gas::AirO2 ,
  sfm::Gas::N2OO2 , sfm::Gas::CO2O2 , sfm::Gas::HeOxO2
}
 A calibrated gas or gas mixture. Which gases a part offers is in its table row. More...
 
enum class  sfm::ScalingCheck : uint8_t { sfm::ScalingCheck::Strict = 0 , sfm::ScalingCheck::Lenient , sfm::ScalingCheck::Off }
 What ReadScaling() does when the sensor's scale or offset differs from the datasheet. More...
 
enum class  sfm::RangePolicy : uint8_t { sfm::RangePolicy::Reject = 0 , sfm::RangePolicy::Flag }
 What ReadSample() does with a flow or temperature outside the part's span. More...
 
enum class  sfm::TimingPolicy : uint8_t { sfm::TimingPolicy::Conservative = 0 , sfm::TimingPolicy::Datasheet }
 Which waits the driver uses after a reset or a wake. More...
 
enum class  sfm::State : uint8_t {
  sfm::State::Uninitialized = 0 , sfm::State::Idle , sfm::State::Measuring , sfm::State::Asleep ,
  sfm::State::StateUnknown
}
 The driver's shadow of the chip's mode. More...
 

Functions

constexpr const char * sfm::ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr uint32_t sfm::FamilyBit (Family f) noexcept
 A bit in a family mask: SfmFlowMeter<Port, kFamilySf06 | kFamilySf05>.
 
constexpr const char * sfm::GetDriverVersion () noexcept
 
constexpr uint32_t sfm::GetDriverVersionMajor () noexcept
 
constexpr uint32_t sfm::GetDriverVersionMinor () noexcept
 
constexpr uint32_t sfm::GetDriverVersionPatch () noexcept
 

Variables

constexpr uint32_t sfm::kFamilySf06 = 1U << 0
 Family mask bits.
 
constexpr uint32_t sfm::kFamilySf06Gen2 = 1U << 1
 Family::Sf06Gen2.
 
constexpr uint32_t sfm::kFamilySf06Dual = 1U << 2
 Family::Sf06Dual.
 
constexpr uint32_t sfm::kFamilySf05 = 1U << 3
 Family::Sf05.
 
constexpr uint32_t sfm::kFamilySf04 = 1U << 4
 Family::Sf04.
 
constexpr uint32_t sfm::kFamilySfx6000 = 1U << 5
 
constexpr uint32_t sfm::kAllFamilies = 0x3FU
 Every family: the default mask.
 
constexpr uint16_t sfm::kAveragingDefault = 0xFFFFU
 Marks Config::averaging as "the family's reset value".
 
constexpr uint16_t sfm::kFilterDefault = 50961U
 The filter argument of the default 3 ms response (SFM3304, SFM3505).
 

Detailed Description

Public types of the SFM flow meter driver: errors, Result<T>, the families, variants and gases, the Sample, and Config.

Everything here is plain data with no platform dependency, so handlers, tests and tools can include it without the driver. Config{} selects Variant::Auto in the SF06 family and the chip's reset behaviour. The table of parts and Validate() are in sfm_flow_meter_parts.hpp.