65 constexpr explicit operator bool() const noexcept {
return ok(); }
75 constexpr explicit operator bool() const noexcept {
return ok(); }
91enum class Gas : uint8_t {
159 "CO2 start code differs by family (SFM4300 data sheet / SFx6000 reference)");
228 switch (product_id & 0xFFFFFF00U) {
237 switch (product_id & 0xFFFFFF00U) {
344 constexpr float ToFlow(int16_t raw)
const noexcept {
345 return scale != 0 ? (
static_cast<float>(raw) -
static_cast<float>(
offset)) /
346 static_cast<float>(
scale)
378 const uint8_t n = nibble & 0x0FU;
380 return n <= 0x4U || n == 0xAU;
382 return n <= 0x3U || (n >= 0x6U && n <= 0x8U);
394 switch (nibble & 0x0FU) {
404 switch (nibble & 0x0FU) {
417 "SFM4300 data sheet Table 5: Air/O2 (0x3632) reports 0b0110");
425 if ((nibble & 0x0FU) == 0x2U) {
428 if ((nibble & 0x0FU) == 0x7U) {
constexpr uint16_t kSfx6000StartGas3
N2O (CO2 on SF06!)
Definition sfm_commands.hpp:60
constexpr uint16_t kSfx6000StartGas2
CO2 (N2O on SF06!)
Definition sfm_commands.hpp:59
constexpr uint16_t kSfx6000StartGas4
Ar.
Definition sfm_commands.hpp:61
constexpr uint16_t kStartCO2O2Mix
argument: O2 volume fraction (‰)
Definition sfm_commands.hpp:55
constexpr uint16_t kStartAirO2Mix
argument: O2 volume fraction (‰)
Definition sfm_commands.hpp:53
constexpr uint16_t kStartN2O
Definition sfm_commands.hpp:51
constexpr uint16_t kStartN2OO2Mix
argument: O2 volume fraction (‰)
Definition sfm_commands.hpp:54
constexpr uint16_t kSfx6000StartGas1
Air.
Definition sfm_commands.hpp:58
constexpr uint16_t kStartAir
Definition sfm_commands.hpp:50
constexpr uint16_t kSfx6000StartMix0
Gas0 in Gas1 (O2 in Air); argument ‰
Definition sfm_commands.hpp:62
constexpr uint16_t kStartO2
Definition sfm_commands.hpp:49
constexpr uint16_t kStartCO2
Definition sfm_commands.hpp:52
constexpr uint16_t kSfx6000StartGas0
O2.
Definition sfm_commands.hpp:57
constexpr Family FamilyOf(Variant v) noexcept
Family of a known variant (Sf06 for Unknown — the caller's assumption).
Definition sfm_types.hpp:213
constexpr uint16_t StartCommandFor(Family family, Gas g) noexcept
Start-measurement command code for g on family.
Definition sfm_types.hpp:126
constexpr uint16_t kStatusPureGasFraction
Status-word gas fraction value for a pure calibration gas (bits 9:0).
Definition sfm_commands.hpp:98
DriverError
Driver-level error codes (stable for logging / telemetry).
Definition sfm_types.hpp:28
@ BusWrite
command write NACKed / bus error
@ VariantUnknown
gas needs a known part family (identity not read)
@ Crc
CRC-8 mismatch on a received word.
@ InvalidParameter
bad argument (e.g. averaging window > 128)
@ BusRead
command reply (identifier, scaling) NACKed / bus error
@ UnexpectedUnit
scaling unusable: scale 0, or unit ≠ 0x0148 on a known SF06 part
@ NotInitialized
transport EnsureInitialized() failed
@ NotSupported
transport lacks the feature (e.g. general call)
@ UnsupportedGas
gas / mixture not calibrated on this variant
@ NoData
result-buffer read NACKed — no fresh sample yet / not measuring
constexpr bool SupportsGas(Variant v, Gas g) noexcept
Whether a variant carries a factory calibration for g.
Definition sfm_types.hpp:288
constexpr std::string_view ToString(DriverError e) noexcept
Definition sfm_types.hpp:42
Gas
Calibrated gas / gas-mixture lookup table selector (family-neutral).
Definition sfm_types.hpp:91
@ CO2
SF06 Gas 3 (SFM4300-20 only) · SFx6000 Gas 2.
@ HeOx
SF06 Gas 2 on SFM3013-300-CLM only: heliox 80/20 (code 0x3615)
@ CO2O2Mix
SF06 mixture 2 — SFM4300-20 only.
@ Air
SF06 Gas 1 · SFx6000 Gas 1.
@ N2O
SF06 Gas 2 (SFM4300-20 only) · SFx6000 Gas 3.
@ O2
SF06 Gas 0 · SFx6000 Gas 0.
@ AirO2Mix
O2 in Air — argument: O2 volume fraction (‰)
@ N2OO2Mix
SF06 mixture 1 — SFM4300-20 only.
@ HeOxO2Mix
SF06 mixture 1 on SFM3013-300-CLM only: O2 in HeOx (code 0x3639)
Family
Part family: decides command meaning, frame layout and optional features.
Definition sfm_types.hpp:81
@ Sf06
SFM4300, SFM3003/3013/3019/3119.
@ Sfx6000
SFM6000D (SFC6000D controllers share the interface)
constexpr bool StatusNibbleIsKnown(Family family, uint8_t nibble) noexcept
Whether nibble (status bits 15:12) names a start command of family.
Definition sfm_types.hpp:377
constexpr bool IsMixture(Gas g) noexcept
Definition sfm_types.hpp:161
constexpr Variant VariantFromProductId(uint32_t product_id) noexcept
Decode a 32-bit product identifier.
Definition sfm_types.hpp:227
constexpr Gas GasFromStatusNibble(Family family, uint8_t nibble) noexcept
Map the status command nibble back onto a gas selector (per family).
Definition sfm_types.hpp:392
constexpr float FullScaleSlm(Variant v) noexcept
Full-scale Air / O2 flow [slm] for a known variant (0 when unknown).
Definition sfm_types.hpp:255
constexpr bool GasNeedsKnownFamily(Gas g) noexcept
True when g's start code differs between families (needs a known variant).
Definition sfm_types.hpp:318
Variant
Part variant decoded from the product identifier.
Definition sfm_types.hpp:171
@ Sfm4300_20_P
0x0403031x — 20 slm, push-in fittings
@ Sfm6000D_50
0x060211xx — 50 slm (Air/O2; 20 slm CO2/N2O/Ar)
@ Sfm6000D_20
0x060212xx — 20 slm (Air/O2; 10 slm CO2/N2O/Ar)
@ Sfm4300_20_B
0x0403011x — 20 slm, basemount
@ Sfm3013_300_CLM
0x040202xx — −30…300 slm, also heliox, address 0x2F
@ Sfm4300_20_O
0x0403021x — 20 slm, O-rings
@ Sfm6000D_5
0x060214xx — 5 slm (Air/O2; 2 slm CO2/N2O/Ar)
@ Sfm4300_50_P
0x0403061x — 50 slm, push-in fittings
@ Sfm4300_50_B
0x0403091x — 50 slm, basemount
@ Sfm3003_300_CL
0x040201xx — −30…300 slm, address 0x28
@ Sfm3003_300_CE
0x040207xx — −150…300 slm, address 0x2D
@ Sfm3019_240
0x040206xx — −10…240 slm, address 0x2E
@ Sfm3119_240_CL
0x040401xx — −10…240 slm, address 0x29
@ Sfm3013_300_CL
0x040205xx — −30…300 slm, address 0x2F
@ Sfm4300_50_O
0x0403071x — 50 slm, O-rings
I2C command codes, addresses, timing and CRC-8 for Sensirion flow meters: the SF06 family (SFM4300 da...
static constexpr DriverResult success() noexcept
Definition sfm_types.hpp:76
static constexpr DriverResult failure(DriverError e) noexcept
Definition sfm_types.hpp:77
constexpr bool ok() const noexcept
Definition sfm_types.hpp:74
Definition sfm_types.hpp:60
constexpr bool ok() const noexcept
Definition sfm_types.hpp:64
static constexpr DriverResult failure(DriverError e) noexcept
Definition sfm_types.hpp:68
T value
Definition sfm_types.hpp:61
static constexpr DriverResult success(T v) noexcept
Definition sfm_types.hpp:67
DriverError error
Definition sfm_types.hpp:62
One continuous-mode sample (data sheet §4.3.1 read frame).
Definition sfm_types.hpp:436
float flow
in device unit (slm for SFM4300)
Definition sfm_types.hpp:440
int16_t flow_raw
Definition sfm_types.hpp:437
int16_t temperature_raw
Definition sfm_types.hpp:438
StatusWord status
Definition sfm_types.hpp:439
float temperature_c
gas temperature [°C] (SF06 frame only)
Definition sfm_types.hpp:441
bool temperature_valid
false on SFx6000 (frame word 2 is reserved)
Definition sfm_types.hpp:442
Product identifier + 8-byte serial number (data sheet §4.3.9).
Definition sfm_types.hpp:323
uint32_t product_id
Definition sfm_types.hpp:324
Variant variant
Definition sfm_types.hpp:326
uint8_t serial[8]
Definition sfm_types.hpp:325
Scale factor / offset / unit for one gas lookup table (data sheet §4.3.6).
Definition sfm_types.hpp:330
int16_t scale
counts per flow unit (SFM4300: 1000 per slm)
Definition sfm_types.hpp:331
constexpr float FullScaleFlow() const noexcept
Full-scale flow in the device unit (SFx6000; 0 when not reported).
Definition sfm_types.hpp:339
int16_t full_scale_raw
SFx6000 only: full-scale flow, raw counts.
Definition sfm_types.hpp:334
constexpr float ToFlow(int16_t raw) const noexcept
raw → flow in the device unit (slm for SFM4300).
Definition sfm_types.hpp:344
int16_t offset
counts at zero flow (SFM4300: −28672)
Definition sfm_types.hpp:332
bool valid
Definition sfm_types.hpp:336
uint16_t gas_id
SFx6000 only: SEMI gas ID.
Definition sfm_types.hpp:335
uint16_t unit
unit code (SFM4300: 0x0148 = slm @ 20 °C)
Definition sfm_types.hpp:333
Decoded status word (data sheet §4.3.2, Table 5).
Definition sfm_types.hpp:358
uint16_t raw
Definition sfm_types.hpp:359
constexpr bool fixed_n_averaging() const noexcept
Definition sfm_types.hpp:363
constexpr bool exponential_smoothing() const noexcept
Definition sfm_types.hpp:362
constexpr bool pure_gas() const noexcept
Definition sfm_types.hpp:365
constexpr uint16_t gas_fraction_permille() const noexcept
Definition sfm_types.hpp:364
constexpr uint8_t command_nibble() const noexcept
Definition sfm_types.hpp:361