Struct ufire_ec::EcProbe
[−]
[src]
pub struct EcProbe { /* fields omitted */ }
Methods
impl EcProbe
[src]
pub fn new(
filename: &'static str,
address: u16
) -> Result<Self, Box<LinuxI2CError>>
[src]
filename: &'static str,
address: u16
) -> Result<Self, Box<LinuxI2CError>>
Create a new EcProbe object
Pass the i2c port to use, it must be a software overlay device, and I2C address.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap();
pub fn measure_temp(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Start a temperature measurement
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.measure_temp();
pub fn calibrate_single(
&mut self,
solution_ec: f32
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
solution_ec: f32
) -> Result<(), Box<LinuxI2CError>>
Calibrates the probe using a single point using a mS value.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.calibrate_single(500.0);
pub fn calibrate_probe_low(
&mut self,
solution_ec: f32
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
solution_ec: f32
) -> Result<(), Box<LinuxI2CError>>
Calibrates the dual-point values for the low reading, in mS, and saves them in the devices's EEPROM.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.calibrate_probe_low(50.0);
pub fn calibrate_probe_high(
&mut self,
solution_ec: f32
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
solution_ec: f32
) -> Result<(), Box<LinuxI2CError>>
Calibrates the dual-point values for the high reading, in mS, and saves them in the devices's EEPROM.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.calibrate_probe_high(56.0);
pub fn measure_ec(&mut self, temp_coef: f32) -> Result<f32, Box<LinuxI2CError>>
[src]
Starts an EC measurement.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.measure_ec(0.019);
pub fn measure_salinity(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Starts an EC measurement and returns the salinity in PSU.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.measure_salinity();
pub fn calibrate_dry(&mut self) -> Result<(), Box<LinuxI2CError>>
[src]
Determines the probes dry reading.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.calibrate_dry();
pub fn set_dual_point_calibration(
&mut self,
ref_low: f32,
ref_high: f32,
read_low: f32,
read_high: f32
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
ref_low: f32,
ref_high: f32,
read_low: f32,
read_high: f32
) -> Result<(), Box<LinuxI2CError>>
Sets all the values, in mS, for dual point calibration and saves them in the devices's EEPROM.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.set_dual_point_calibration(50.0, 58.0, 48.0, 56.0);
pub fn get_k(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Returns the cell-constant from the device.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.get_k();
pub fn set_k(&mut self, k: f32) -> Result<(), Box<LinuxI2CError>>
[src]
Sets the cell-constant and saves it in the devices's EEPROM.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.set_k(1.0);
pub fn set_temp_constant(
&mut self,
temp_constant: u8
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
temp_constant: u8
) -> Result<(), Box<LinuxI2CError>>
Sets the temperature constant to use for compensation and saves it in the devices's EEPROM.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.set_temp_constant(20);
pub fn get_temp_constant(&mut self) -> Result<u8, Box<LinuxI2CError>>
[src]
Returns the temperature constant from the device.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.get_temp_constant();
pub fn get_calibrate_offset(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Returns the single-point offset from the device.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.get_calibrate_offset();
pub fn get_calibrate_dry(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Returns the dry calibration value.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.get_calibrate_dry();
pub fn get_calibrate_high_reference(
&mut self
) -> Result<f32, Box<LinuxI2CError>>
[src]
&mut self
) -> Result<f32, Box<LinuxI2CError>>
Returns the dual-point calibration high reference value.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.set_dual_point_calibration(0.0, 500.0, 0.0, 0.0);
pub fn get_calibrate_high_reading(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Returns the dual-point calibration high reading value.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.set_dual_point_calibration(0.0, 0.0, 0.0, 553.0); assert_eq!(553.0, ec.get_calibrate_high_reading().unwrap());
pub fn get_calibrate_low_reference(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Returns the dual-point calibration low reference value.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.set_dual_point_calibration(50.0, 0.0, 0.0, 0.0); assert_eq!(50.0, ec.get_calibrate_low_reference().unwrap());
pub fn get_calibrate_low_reading(&mut self) -> Result<f32, Box<LinuxI2CError>>
[src]
Returns the dual-point calibration low reading value.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.set_dual_point_calibration(0.0, 0.0, 34.0, 0.0); assert_eq!(34.0, ec.get_calibrate_low_reading().unwrap());
pub fn use_temperature_compensation(
&mut self,
b: bool
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
b: bool
) -> Result<(), Box<LinuxI2CError>>
Configures the device to use temperature compensation or not.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.use_temperature_compensation(true); assert_eq!(1, ec.using_temperature_compensation().unwrap());
pub fn use_dual_point(&mut self, b: bool) -> Result<(), Box<LinuxI2CError>>
[src]
Configures device to use dual-point calibration.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.use_dual_point(true); assert_eq!(1, ec.using_dual_point().unwrap());
pub fn get_version(&mut self) -> Result<u8, Box<LinuxI2CError>>
[src]
Returns the firmware version of the device.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); assert_eq!(0x1c, ec.get_version().unwrap());
pub fn reset(&mut self) -> Result<(), Box<LinuxI2CError>>
[src]
Resets all the stored calibration information.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.reset(); assert_eq!(true, ec.get_calibrate_offset().unwrap().is_nan()); assert_eq!(true, ec.get_calibrate_low_reading().unwrap().is_nan()); assert_eq!(true, ec.get_calibrate_high_reading().unwrap().is_nan()); assert_eq!(true, ec.get_calibrate_low_reference().unwrap().is_nan()); assert_eq!(true, ec.get_calibrate_high_reference().unwrap().is_nan());
pub fn using_temperature_compensation(
&mut self
) -> Result<u8, Box<LinuxI2CError>>
[src]
&mut self
) -> Result<u8, Box<LinuxI2CError>>
Configures the device to use temperature compensation.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.use_temperature_compensation(true); assert_eq!(1, ec.using_temperature_compensation().unwrap());
pub fn using_dual_point(&mut self) -> Result<u8, Box<LinuxI2CError>>
[src]
Configures device to use dual-point calibration.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); ec.use_dual_point(true); assert_eq!(1, ec.using_dual_point().unwrap());
pub fn set_i2c_address(
&mut self,
i2c_address: u8
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
i2c_address: u8
) -> Result<(), Box<LinuxI2CError>>
Sets the I2C address of the device.
Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap(); // ec.set_i2c_address(0x4f);
pub fn _write_register(
&mut self,
register: u8,
f_val: f32
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
register: u8,
f_val: f32
) -> Result<(), Box<LinuxI2CError>>
pub fn _read_register(
&mut self,
register: u8
) -> Result<f32, Box<LinuxI2CError>>
[src]
&mut self,
register: u8
) -> Result<f32, Box<LinuxI2CError>>
pub fn _change_register(
&mut self,
register: u8
) -> Result<(), Box<LinuxI2CError>>
[src]
&mut self,
register: u8
) -> Result<(), Box<LinuxI2CError>>