pub struct AdcConversion {
pub full_scale_voltage: f64,
pub max_count: f64,
pub pga_gain: f64,
pub adc_gain: f64,
}Expand description
Parameters for ADC count / voltage conversion.
Describes the digitizer characteristics needed to convert between raw ADC counts and voltage (or physical units with a sensor sensitivity).
Fields§
§full_scale_voltage: f64Full-scale range in Volts (e.g. 5.0 for a +/-2.5V ADC)
max_count: f64Maximum count value: 2^(bits-1) - 1 (e.g. 8388607 for 24-bit)
pga_gain: f64External PGA (Programmable Gain Amplifier) gain (e.g. 1.0)
adc_gain: f64Internal digital gain in ADC (e.g. 1.0)
Implementations§
Source§impl AdcConversion
impl AdcConversion
Sourcepub fn new(
full_scale_voltage: f64,
bits: u32,
pga_gain: f64,
adc_gain: f64,
) -> Self
pub fn new( full_scale_voltage: f64, bits: u32, pga_gain: f64, adc_gain: f64, ) -> Self
Create from ADC bit depth and gains.
max_count is computed as 2^(bits-1) - 1.
Sourcepub fn count_to_voltage(&self, count: f64) -> f64
pub fn count_to_voltage(&self, count: f64) -> f64
Convert raw ADC count to input voltage (before PGA).
Sourcepub fn voltage_to_count(&self, voltage: f64) -> f64
pub fn voltage_to_count(&self, voltage: f64) -> f64
Convert input voltage to raw ADC count.
Sourcepub fn count_to_physical(&self, count: f64, sensitivity: f64) -> f64
pub fn count_to_physical(&self, count: f64, sensitivity: f64) -> f64
Convert raw ADC count to physical unit using sensor sensitivity.
sensitivity is in V/(m/s) for velocity sensors.
Sourcepub fn overall_sensitivity(&self, sensor_sensitivity: f64) -> f64
pub fn overall_sensitivity(&self, sensor_sensitivity: f64) -> f64
Compute overall sensitivity in counts per physical unit.
This is the value that goes into <InstrumentSensitivity><Value>.
Trait Implementations§
Source§impl Clone for AdcConversion
impl Clone for AdcConversion
Source§fn clone(&self) -> AdcConversion
fn clone(&self) -> AdcConversion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more