PifChannelConfig
pub struct PifChannelConfig
One PIF channel, as data.
Build one with PifChannelConfig::new, which applies the SDK's
defaults (a parked digital output on channel 0), then set what
differs.
A channel whose own unit is a temperature follows the SDK's
temperature unit (Celsius unless crate::set_temperature_unit
chose Fahrenheit): an ambient temperature input, an internal
temperature output, and a measurement field carrying a temperature
statistic (or a standard deviation, which is a difference). On those
gain and offset are re-expressed for the unit, so the same value
still maps to the same wire level (gain_C = 1.8 gain_F, offset_C =
offset_F + 32 gain_F, without the 32 for a difference), and
input_min, input_max and threshold are temperatures in that
unit. Every other channel, and the output levels, are not converted.
What is on the wire is never converted. The value
ProcessInterface::write_analog_output takes and the value
ProcessInterface::read_analog_input decodes follow the unit on
such a channel; the level on the pin does not, because a wire value
is never a temperature. ProcessInterface::read_analog_output,
ProcessInterface::read_raw_analog_input,
IoSnapshot::analog_outputs, IoSnapshot::raw_analog_inputs
and the crate::enums::SignalField::AnalogOut signal answer in
volts or milliamperes, the same numbers in Celsius and in
Fahrenheit.
PifChannelConfig — fields
index: u8
Flat channel index.
The SDK does the (device, pin) arithmetic for stacked PIFs; nothing here addresses a device.
active_low: bool
Invert a digital output's electrical sense, so "asserted" drives the line low.
threshold_low_active: bool
The channel is asserted below threshold rather than above it.
autonomous: bool
The camera firmware drives this channel without the host.
direction: PifDirection
Which way the channel carries its signal.
signal: PifSignal
Its electrical nature.
kind: PifChannelKind
What it means.
gain: f32
Conversion gain. Inputs decode as (raw - offset) / gain;
outputs encode as gain * value + offset.
offset: f32
Conversion offset. See PifChannelConfig::gain.
input_min: f32
Lower clamp on a decoded analog input. Leave both at 0 for none, in either temperature unit.
input_max: f32
Upper clamp on a decoded analog input.
threshold: f32
Level at which an analog input counts as asserted.
active_value: f32
Level this pin drives when asserted.
inactive_value: f32
Level it drives when not asserted.
These belong to the pin rather than to whatever asserts it, because several alarm rules can share one pin and must agree on its levels.
intermediate_value: f32
A third level, for kinds whose state is not binary: the shutter is open, closed, or moving between the two.
output_range: AnalogRange
Range an analog output drives into.
target: Option<i32>
Kind-specific target: the region id for
PifChannelKind::MeasurementField, the flag channel for
PifChannelKind::FlagControl. None when the kind has none.
statistic: SignalField
Which statistic of target a measurement-field channel encodes.
decimals: u8
Display precision for a named value.
name: String
Name of an uncommitted value; diagnostics for other kinds.
unit: String
Unit of an uncommitted value.
PifChannelConfig — methods
pub fn new() -> Result<Self>
The SDK's defaults: a parked digital output on channel 0, unity gain, no offset, no clamp, active high at 1.0 and inactive at 0.0.
Errors
Returns an error only if the SDK's own initialiser fails.