FDO2 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Public Member Functions | List of all members
fdo2::FDO2< Port > Class Template Reference

Driver for one FDO2-G2 or FDO2 on a platform port. More...

#include <fdo2.hpp>

Public Member Functions

 FDO2 (Port &port, const Config &config={}) noexcept
 Bind the driver to a port and store the configuration. No I/O, cannot fail.
 
 FDO2 (const FDO2 &)=delete
 One driver object per module.
 
FDO2 & operator= (const FDO2 &)=delete
 One driver object per module.
 
Lifecycle
Result< void > BeginInitialize () noexcept
 Start the module without waiting: validate the Config, bring the UART up, power the module through GpioSet(CtrlPin::Power) when the port has it, and enter PoweringUp.
 
Result< void > EnsureInitialized () noexcept
 BeginInitialize() and Poll() until it ends; needs DelayUs(). Bounded by the sum of the allowances.
 
bool IsInitialized () const noexcept
 
State GetState () const noexcept
 
Result< void > Deinitialize () noexcept
 Drop the operation in flight, leave the broadcast alone, set the power pin INACTIVE (when the port has it) and mark the driver uninitialised. A failed pin write is reported as Bus.
 
Result< void > Resync () noexcept
 Find the module again after StateUnknown: #VERS at the candidate baud rates (the rate being set, the declared rate, 19200), each with the expected CRC mode and, with CrcMode::Auto, the other one (a lost #CRCE echo leaves the two sides in different modes), then the broadcast check. A stream seen in StateUnknown does not make the call Busy. Needs DelayUs().
 
Result< void > PowerCycle () noexcept
 Switch the module off through CtrlPin::Power, wait power_off_ms, switch it on and start again at 19200 baud. Needs the GpioSet() hook and DelayUs(). When a flash write may still be in progress the call first waits out its allowance (at most calibration_ms plus the margin): the supply is not cut during a flash cycle (datasheet 4.3, WARNING).
 
Non-blocking core
Result< bool > Poll () noexcept
 Advance the state machine and read what arrived, with the port's clock. One Read() of at most 64 bytes with a zero timeout per call (bytes left over from the last read are processed first).
 
Result< bool > Poll (uint32_t elapsed_us) noexcept
 Poll() for a port without a clock: the caller says how much time passed since the previous call.
 
Result< void > AbortOperation () noexcept
 Drop the operation in flight. A read is dropped into Draining; a flash write or #BAUD becomes StateUnknown (the bytes were sent). Never talks to the port.
 
OperationKind Pending () const noexcept
 
Result< void > StartMeasureOxygen () noexcept
 Send #MOXY; Poll() ends it; GetOxygen() returns it.
 
Result< void > StartMeasureRaw () noexcept
 Send #MRAW; GetRaw() returns it.
 
Result< void > StartReadVersion () noexcept
 Send #VERS; GetVersion() returns it.
 
Result< void > StartReadUniqueId () noexcept
 Send #IDNR; GetUniqueId() returns it.
 
Result< void > StartIdentify () noexcept
 Send #LOGO: the status LED flashes four times.
 
Result< void > StartReadUserMemory (uint8_t first, uint8_t count) noexcept
 Send #RDUM first count.
 
Result< void > StartWriteUserMemory (uint8_t first, std::span< const int32_t > words) noexcept
 Send #WRUM first count Y... (a flash write, guarded).
 
Result< void > StartCalibrateZero (uint32_t steady_s) noexcept
 Send #CALO (a flash write; loses the factory calibration).
 
Result< void > StartCalibrateHigh (int32_t po2_mhpa, uint32_t steady_s) noexcept
 Send #CAHI P (a flash write; loses the factory calibration).
 
Result< void > StartSetCrcEnabled (bool enabled) noexcept
 Send #CRCE K (a flash write), then #VERS to verify the mode.
 
Result< void > StartSetMeasurementMode (uint8_t mode) noexcept
 Send #SETM M (a flash write; the FDO2-G2 only).
 
Result< void > StartSetBroadcast (uint32_t interval_ms) noexcept
 Send #BCST T (a flash write).
 
Result< void > StartSetBaudRate (uint32_t baud) noexcept
 Send #BAUD R, switch the port, then #VERS at the new rate. Needs the port's SetBaudRate().
 
Result< Oxygen > GetOxygen () const noexcept
 
Result< Raw > GetRaw () noexcept
 
Result< Version > GetVersion () const noexcept
 
Result< uint64_t > GetUniqueId () const noexcept
 
Result< std::span< const int32_t > > GetUserMemory () const noexcept
 
Result< Raw > GetLastFrame () const noexcept
 The last decoded measurement frame even when the status policy rejected it, for diagnostics. Never present it as a measurement.
 
Blocking calls (need <tt>DelayUs()</tt>)
Result< Oxygen > MeasureOxygen () noexcept
 #MOXY, with the status and plausibility checks.
 
Result< Raw > MeasureRaw () noexcept
 #MRAW, with the same checks.
 
Result< Raw > ReadRawFrame () noexcept
 #MRAW once: the same checks as MeasureRaw() but a failed read is reported, never repeated.
 
Result< int32_t > MeasureVolumePercentMilli () noexcept
 Oxygen in 10^-3 volume percent: #MRAW, then VolumePercentMilli() with the module's back-side pressure or Config::pressure_reference_ubar.
 
Result< Version > ReadVersion () noexcept
 #VERS.
 
Result< uint64_t > ReadUniqueId () noexcept
 #IDNR.
 
Result< void > Identify () noexcept
 #LOGO: waits for the echo (about 1 s).
 
Result< void > ReadUserMemory (uint8_t first, std::span< int32_t > out) noexcept
 #RDUM first out.size(); fills out.
 
Result< void > WriteUserMemory (uint8_t first, std::span< const int32_t > in) noexcept
 #WRUM; see StartWriteUserMemory().
 
Result< void > CalibrateZero (uint32_t steady_s) noexcept
 #CALO; up to 10 s.
 
Result< void > CalibrateHigh (int32_t po2_mhpa, uint32_t steady_s) noexcept
 #CAHI P; up to 10 s.
 
Result< void > CalibrateAir (uint32_t steady_s, uint32_t fraction_ppm=kDryAirO2Ppm) noexcept
 One-point calibration in dry ambient air: #MRAW for the pressure, then #CAHI with AirO2Mhpa(P, fraction_ppm). Only correct when the membrane sees dry air at the measured back-side pressure; humid air has a lower pO2 (A-10).
 
Result< void > SetCrcEnabled (bool enabled) noexcept
 #CRCE, then #VERS; see StartSetCrcEnabled().
 
Result< void > SetMeasurementMode (uint8_t mode) noexcept
 #SETM; see StartSetMeasurementMode().
 
Result< void > SetBroadcast (uint32_t interval_ms) noexcept
 #BCST T: with T above 0 the module streams and the driver enters Streaming.
 
Result< void > DisableBroadcast () noexcept
 #BCST 0: the vendor's workaround, sent right after a frame, among frames.
 
Result< void > SetBaudRate (uint32_t baud) noexcept
 #BAUD; see StartSetBaudRate().
 
Result< bool > ProbeBroadcast (uint32_t window_ms) noexcept
 Listen without sending for a window and say whether #MRAW lines arrived.
 
Observers (no I/O)
const Identity & GetIdentity () const &noexcept
 
void GetIdentity () const &&=delete
 Not on a temporary driver: the reference would dangle (KB-CPP20-044).
 
const Counters & GetCounters () const &noexcept
 
void GetCounters () const &&=delete
 Not on a temporary driver.
 
int32_t DeviceErrorCode () const noexcept
 
const Config & GetConfig () const &noexcept
 
void GetConfig () const &&=delete
 Not on a temporary driver.
 
bool CrcActive () const noexcept
 
uint8_t FlashWritesUsed () const noexcept
 
bool FlashWritePending () const noexcept
 
uint32_t StreamSilentMs () const noexcept
 

Detailed Description

template<UartPort Port>
class fdo2::FDO2< Port >

Driver for one FDO2-G2 or FDO2 on a platform port.

Lifecycle: construct with the configuration (no I/O), then BeginInitialize() and Poll() or EnsureInitialized(), use, optionally Deinitialize(). Every call that touches the module returns Error::NotInitialized until start-up has succeeded.

Optional port hooks, found at compile time:

A hook declared with the wrong signature is a compile error.

Template Parameters
PortYour class derived from UartInterface<Port>.

Constructor & Destructor Documentation

◆ FDO2()

template<UartPort Port>
fdo2::FDO2< Port >::FDO2 ( Port &  port,
const Config &  config = {} 
)
inlineexplicitnoexcept

Bind the driver to a port and store the configuration. No I/O, cannot fail.

Parameters
portThe port; it must outlive the driver.
configChecked by BeginInitialize(), before any I/O.

Member Function Documentation

◆ AbortOperation()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::AbortOperation ( )
noexcept

Drop the operation in flight. A read is dropped into Draining; a flash write or #BAUD becomes StateUnknown (the bytes were sent). Never talks to the port.

Returns
Ok.

◆ BeginInitialize()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::BeginInitialize ( )
noexcept

Start the module without waiting: validate the Config, bring the UART up, power the module through GpioSet(CtrlPin::Power) when the port has it, and enter PoweringUp.

Poll() then waits power_up_ms, optionally listens for a stream, reads #VERS (device id 8, one channel, firmware 3.28 or later, an oxygen sensor), then #IDNR. On an initialised driver it returns Ok with no traffic.

Returns
Ok, InvalidArgument (Validate(), no I/O), Bus, Busy (an operation is in flight).

◆ CalibrateAir()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::CalibrateAir ( uint32_t  steady_s,
uint32_t  fraction_ppm = kDryAirO2Ppm 
)
noexcept

One-point calibration in dry ambient air: #MRAW for the pressure, then #CAHI with AirO2Mhpa(P, fraction_ppm). Only correct when the membrane sees dry air at the measured back-side pressure; humid air has a lower pO2 (A-10).

Parameters
steady_sSeconds of steady measuring, at least Config::min_steady_s.
fraction_ppmOxygen fraction in ppm (kDryAirO2Ppm).
Returns
As CalibrateHigh(), and SensorFault unless the status is good.

◆ CalibrateHigh()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::CalibrateHigh ( int32_t  po2_mhpa,
uint32_t  steady_s 
)
noexcept

#CAHI P; up to 10 s.

Parameters
po2_mhpaThe pO2 of the standard, 10^-3 hPa.
steady_sSeconds of steady measuring.
Returns
As StartCalibrateHigh(), or the error of the wait.

◆ CalibrateZero()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::CalibrateZero ( uint32_t  steady_s)
noexcept

#CALO; up to 10 s.

Parameters
steady_sSeconds of steady measuring at 0 % oxygen.
Returns
As StartCalibrateZero(), or the error of the wait.

◆ CrcActive()

template<UartPort Port>
bool fdo2::FDO2< Port >::CrcActive ( ) const
inlinenoexcept
Returns
Whether replies carry a CRC (learned from #VERS, verified after #CRCE).

◆ Deinitialize()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::Deinitialize ( )
noexcept

Drop the operation in flight, leave the broadcast alone, set the power pin INACTIVE (when the port has it) and mark the driver uninitialised. A failed pin write is reported as Bus.

The supply is never cut while a flash write may be in progress (datasheet 4.3, WARNING: a power loss during a flash cycle can corrupt the memory): the call returns Busy, changes nothing, and succeeds once the echo has arrived or the write's allowance has elapsed (FlashWritePending() says which; the time passes with Poll()). On a port without NowUs() the time moves only through Poll(elapsed_us): a caller that never polls stays Busy.

Returns
Ok, Busy (a flash write is pending) or Bus.

◆ DeviceErrorCode()

template<UartPort Port>
int32_t fdo2::FDO2< Port >::DeviceErrorCode ( ) const
inlinenoexcept
Returns
E of the last #ERRO, 0 when none.

◆ DisableBroadcast()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::DisableBroadcast ( )
noexcept

#BCST 0: the vendor's workaround, sent right after a frame, among frames.

Returns
Ok, NotPermitted, Timeout, or the error of the call.

◆ EnsureInitialized()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::EnsureInitialized ( )
noexcept

BeginInitialize() and Poll() until it ends; needs DelayUs(). Bounded by the sum of the allowances.

Returns
Ok, or the error of the failed step: InvalidArgument, Bus, Timeout, DeviceIdMismatch, Unsupported (firmware below 3.28), BroadcastActive, NotPermitted, InvalidReply, Crc, DeviceError.

◆ FlashWritePending()

template<UartPort Port>
bool fdo2::FDO2< Port >::FlashWritePending ( ) const
inlinenoexcept
Returns
true while a flash write may still be in progress in the module: from its command to the echo (or an error that says nothing was written), or to the end of its allowance when no echo came. Deinitialize() and PowerCycle() do not cut the supply meanwhile. No I/O.

◆ FlashWritesUsed()

template<UartPort Port>
uint8_t fdo2::FDO2< Port >::FlashWritesUsed ( ) const
inlinenoexcept
Returns
Flash-writing commands sent since construction.

◆ GetConfig()

template<UartPort Port>
const Config & fdo2::FDO2< Port >::GetConfig ( ) const &
inlinenoexcept
Returns
The configuration; baud follows a confirmed #BAUD.

◆ GetCounters()

template<UartPort Port>
const Counters & fdo2::FDO2< Port >::GetCounters ( ) const &
inlinenoexcept
Returns
The counters of line events.

◆ GetIdentity()

template<UartPort Port>
const Identity & fdo2::FDO2< Port >::GetIdentity ( ) const &
inlinenoexcept
Returns
Who the module is; valid after start-up.

◆ GetLastFrame()

template<UartPort Port>
Result< Raw > fdo2::FDO2< Port >::GetLastFrame ( ) const
noexcept

The last decoded measurement frame even when the status policy rejected it, for diagnostics. Never present it as a measurement.

Returns
The frame, or InvalidArgument when there is none.

◆ GetOxygen()

template<UartPort Port>
Result< Oxygen > fdo2::FDO2< Port >::GetOxygen ( ) const
noexcept
Returns
The last #MOXY; Busy while pending; InvalidArgument when there is none.

◆ GetRaw()

template<UartPort Port>
Result< Raw > fdo2::FDO2< Port >::GetRaw ( )
noexcept
Returns
The last #MRAW (or the next broadcast frame while streaming, once per frame).

◆ GetState()

template<UartPort Port>
State fdo2::FDO2< Port >::GetState ( ) const
inlinenoexcept
Returns
The state machine's state (Streaming while the module streams). No I/O.

◆ GetUniqueId()

template<UartPort Port>
Result< uint64_t > fdo2::FDO2< Port >::GetUniqueId ( ) const
noexcept
Returns
The last #IDNR reply.

◆ GetUserMemory()

template<UartPort Port>
Result< std::span< const int32_t > > fdo2::FDO2< Port >::GetUserMemory ( ) const
noexcept
Returns
The words of the last #RDUM, valid until the next operation.

◆ GetVersion()

template<UartPort Port>
Result< Version > fdo2::FDO2< Port >::GetVersion ( ) const
noexcept
Returns
The last #VERS reply.

◆ Identify()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::Identify ( )
noexcept

#LOGO: waits for the echo (about 1 s).

Returns
Ok or an error as ReadVersion().

◆ IsInitialized()

template<UartPort Port>
bool fdo2::FDO2< Port >::IsInitialized ( ) const
inlinenoexcept
Returns
true after start-up succeeded and before Deinitialize(). No I/O.

◆ MeasureOxygen()

template<UartPort Port>
Result< Oxygen > fdo2::FDO2< Port >::MeasureOxygen ( )
noexcept

#MOXY, with the status and plausibility checks.

Returns
The oxygen and temperature, or one of SensorFault, OutOfRange, Timeout, Crc, InvalidReply, EchoMismatch, DeviceError, Bus, Busy, NotInitialized.

◆ MeasureRaw()

template<UartPort Port>
Result< Raw > fdo2::FDO2< Port >::MeasureRaw ( )
noexcept

#MRAW, with the same checks.

Returns
The frame, or an error as MeasureOxygen().

◆ MeasureVolumePercentMilli()

template<UartPort Port>
Result< int32_t > fdo2::FDO2< Port >::MeasureVolumePercentMilli ( )
noexcept

Oxygen in 10^-3 volume percent: #MRAW, then VolumePercentMilli() with the module's back-side pressure or Config::pressure_reference_ubar.

Returns
The value, or SensorFault (bit 9 with the module's pressure), OutOfRange.

◆ Pending()

template<UartPort Port>
OperationKind fdo2::FDO2< Port >::Pending ( ) const
inlinenoexcept
Returns
The operation in flight. No I/O.

◆ Poll() [1/2]

template<UartPort Port>
Result< bool > fdo2::FDO2< Port >::Poll ( )
noexcept

Advance the state machine and read what arrived, with the port's clock. One Read() of at most 64 bytes with a zero timeout per call (bytes left over from the last read are processed first).

Returns
Ok(false) still pending; Ok(true) the operation ended, or nothing is pending, or one broadcast frame was decoded; a failed Result the operation ended with that error.

◆ Poll() [2/2]

template<UartPort Port>
Result< bool > fdo2::FDO2< Port >::Poll ( uint32_t  elapsed_us)
noexcept

Poll() for a port without a clock: the caller says how much time passed since the previous call.

Parameters
elapsed_usMicroseconds since the previous Poll() (0 is allowed).
Returns
See Poll().

◆ PowerCycle()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::PowerCycle ( )
noexcept

Switch the module off through CtrlPin::Power, wait power_off_ms, switch it on and start again at 19200 baud. Needs the GpioSet() hook and DelayUs(). When a flash write may still be in progress the call first waits out its allowance (at most calibration_ms plus the margin): the supply is not cut during a flash cycle (datasheet 4.3, WARNING).

Returns
As EnsureInitialized(), or Unsupported without the hook.

◆ ProbeBroadcast()

template<UartPort Port>
Result< bool > fdo2::FDO2< Port >::ProbeBroadcast ( uint32_t  window_ms)
noexcept

Listen without sending for a window and say whether #MRAW lines arrived.

Parameters
window_msThe window, 1 to 12000 ms (10500 covers every interval).
Returns
true when a broadcast frame was seen.

◆ ReadRawFrame()

template<UartPort Port>
Result< Raw > fdo2::FDO2< Port >::ReadRawFrame ( )
noexcept

#MRAW once: the same checks as MeasureRaw() but a failed read is reported, never repeated.

Returns
The frame, or an error as MeasureRaw().

◆ ReadUniqueId()

template<UartPort Port>
Result< uint64_t > fdo2::FDO2< Port >::ReadUniqueId ( )
noexcept

#IDNR.

Returns
The unique id, or an error as ReadVersion().

◆ ReadUserMemory()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::ReadUserMemory ( uint8_t  first,
std::span< int32_t >  out 
)
noexcept

#RDUM first out.size(); fills out.

Parameters
firstThe first word, 0 to 63.
outReceives 1 to 64 words, with first + out.size() <= 64.
Returns
Ok, InvalidArgument, Unsupported, or an error as ReadVersion().

◆ ReadVersion()

template<UartPort Port>
Result< Version > fdo2::FDO2< Port >::ReadVersion ( )
noexcept

#VERS.

Returns
The version, or Timeout, Crc, InvalidReply, EchoMismatch, DeviceError, Bus, Busy.

◆ Resync()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::Resync ( )
noexcept

Find the module again after StateUnknown: #VERS at the candidate baud rates (the rate being set, the declared rate, 19200), each with the expected CRC mode and, with CrcMode::Auto, the other one (a lost #CRCE echo leaves the two sides in different modes), then the broadcast check. A stream seen in StateUnknown does not make the call Busy. Needs DelayUs().

Returns
Ok, Busy, NotInitialized, Timeout (nothing answered), DeviceIdMismatch (another module answered), BroadcastActive.

◆ SetBaudRate()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::SetBaudRate ( uint32_t  baud)
noexcept

#BAUD; see StartSetBaudRate().

Parameters
baudA rate of kBaudRates.
Returns
Ok, InvalidArgument, Unsupported, or the error of the call.

◆ SetBroadcast()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::SetBroadcast ( uint32_t  interval_ms)
noexcept

#BCST T: with T above 0 the module streams and the driver enters Streaming.

Parameters
interval_ms0 (off) or 100 to 10000 ms.
Returns
Ok or the error of the call.

◆ SetCrcEnabled()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::SetCrcEnabled ( bool  enabled)
noexcept

#CRCE, then #VERS; see StartSetCrcEnabled().

Parameters
enabledWhether replies carry the CRC.
Returns
Ok or the error of the call.

◆ SetMeasurementMode()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::SetMeasurementMode ( uint8_t  mode)
noexcept

#SETM; see StartSetMeasurementMode().

Parameters
modeThe measurement mode, 0 to 4.
Returns
Ok or the error of the call.

◆ StartCalibrateHigh()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartCalibrateHigh ( int32_t  po2_mhpa,
uint32_t  steady_s 
)
noexcept

Send #CAHI P (a flash write; loses the factory calibration).

Parameters
po2_mhpaThe pO2 of the standard, 10^-3 hPa, above 0 and at most o2_max_mhpa.
steady_sSeconds of steady measuring, at least Config::min_steady_s.
Returns
As StartCalibrateZero().

◆ StartCalibrateZero()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartCalibrateZero ( uint32_t  steady_s)
noexcept

Send #CALO (a flash write; loses the factory calibration).

Parameters
steady_sSeconds the module has measured steadily at 0 % oxygen; at least Config::min_steady_s.
Returns
NotPermitted, InvalidArgument or the common start errors.

◆ StartIdentify()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartIdentify ( )
noexcept

Send #LOGO: the status LED flashes four times.

Returns
Ok, or Busy, NotInitialized, StateUnknown, Bus (nothing was sent when it is not Ok).

◆ StartMeasureOxygen()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartMeasureOxygen ( )
noexcept

Send #MOXY; Poll() ends it; GetOxygen() returns it.

Returns
Ok, or Busy, NotInitialized, StateUnknown, Bus (nothing was sent when it is not Ok).

◆ StartMeasureRaw()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartMeasureRaw ( )
noexcept

Send #MRAW; GetRaw() returns it.

Returns
Ok, or Busy, NotInitialized, StateUnknown, Bus (nothing was sent when it is not Ok).

◆ StartReadUniqueId()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartReadUniqueId ( )
noexcept

Send #IDNR; GetUniqueId() returns it.

Returns
Ok, or Busy, NotInitialized, StateUnknown, Bus (nothing was sent when it is not Ok).

◆ StartReadUserMemory()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartReadUserMemory ( uint8_t  first,
uint8_t  count 
)
noexcept

Send #RDUM first count.

Parameters
firstThe first word, 0 to 63.
countThe number of words, 1 to 64, with first + count <= 64.
Returns
InvalidArgument for a range error (nothing sent), or the common start errors.

◆ StartReadVersion()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartReadVersion ( )
noexcept

Send #VERS; GetVersion() returns it.

Returns
Ok, or Busy, NotInitialized, StateUnknown, Bus (nothing was sent when it is not Ok).

◆ StartSetBaudRate()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartSetBaudRate ( uint32_t  baud)
noexcept

Send #BAUD R, switch the port, then #VERS at the new rate. Needs the port's SetBaudRate().

Parameters
baudA rate of kBaudRates.
Returns
InvalidArgument, Unsupported (no hook), or the common start errors.

◆ StartSetBroadcast()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartSetBroadcast ( uint32_t  interval_ms)
noexcept

Send #BCST T (a flash write).

Parameters
interval_ms0 (off) or 100 to 10000 ms.
Returns
NotPermitted, InvalidArgument, Unsupported, or the common start errors.

◆ StartSetCrcEnabled()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartSetCrcEnabled ( bool  enabled)
noexcept

Send #CRCE K (a flash write), then #VERS to verify the mode.

Parameters
enabledWhether replies carry the CRC.
Returns
NotPermitted, InvalidArgument (against Config::crc), or the common start errors.

◆ StartSetMeasurementMode()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartSetMeasurementMode ( uint8_t  mode)
noexcept

Send #SETM M (a flash write; the FDO2-G2 only).

Parameters
modeThe measurement mode, 0 to 4.
Returns
NotPermitted, InvalidArgument, Unsupported, or the common start errors.

◆ StartWriteUserMemory()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::StartWriteUserMemory ( uint8_t  first,
std::span< const int32_t >  words 
)
noexcept

Send #WRUM first count Y... (a flash write, guarded).

Parameters
firstThe first word.
wordsThe values; 1 to 64 with first + size <= 64.
Returns
NotPermitted without consent or over the budget, InvalidArgument, Unsupported.

◆ StreamSilentMs()

template<UartPort Port>
uint32_t fdo2::FDO2< Port >::StreamSilentMs ( ) const
noexcept
Returns
While the module streams: milliseconds since the last accepted frame, or since the stream started; 0 when it does not stream. A value of several intervals means the stream died. No I/O.

◆ WriteUserMemory()

template<UartPort Port>
Result< void > fdo2::FDO2< Port >::WriteUserMemory ( uint8_t  first,
std::span< const int32_t >  in 
)
noexcept

#WRUM; see StartWriteUserMemory().

Parameters
firstThe first word.
inThe values to store.
Returns
NotPermitted, InvalidArgument, Unsupported, StateUnknown after a lost echo, or a bus error.

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