pub struct IseProbe { /* private fields */ }
Implementations§
Source§impl IseProbe
impl IseProbe
Sourcepub fn new(
filename: &'static str,
address: u16,
) -> Result<Self, Box<LinuxI2CError>>
pub fn new( filename: &'static str, address: u16, ) -> Result<Self, Box<LinuxI2CError>>
Create a new IseProbe object
Pass the i2c port to use, it must be a software overlay device, and I2C address.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
Sourcepub fn measure_mv(&mut self) -> Result<f32, Box<LinuxI2CError>>
pub fn measure_mv(&mut self) -> Result<f32, Box<LinuxI2CError>>
Start a probe measurement
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.measure_mv();
Sourcepub fn measure_ph(&mut self, temp_c: f32) -> Result<f32, Box<LinuxI2CError>>
pub fn measure_ph(&mut self, temp_c: f32) -> Result<f32, Box<LinuxI2CError>>
Start a pH measurement
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.measure_ph();
Sourcepub fn ph_to_mv(&mut self, ph: f32) -> Result<f32, Box<LinuxI2CError>>
pub fn ph_to_mv(&mut self, ph: f32) -> Result<f32, Box<LinuxI2CError>>
Converts a pH measurement into mV for use with calibration.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
assert_eq!(0.0, mv.ph_to_mv(7.0).unwrap());
Sourcepub fn measure_temp(&mut self) -> Result<f32, Box<LinuxI2CError>>
pub fn measure_temp(&mut self) -> Result<f32, Box<LinuxI2CError>>
Start a temperature measurement
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.measure_temp();
Sourcepub fn set_temp(&mut self, temp_c: f32) -> Result<(), Box<LinuxI2CError>>
pub fn set_temp(&mut self, temp_c: f32) -> Result<(), Box<LinuxI2CError>>
Sets the temperature used by the device.
§Example
let mut ec = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3c).unwrap();
ec.set_temp(20.2);
Sourcepub fn calibrate_single(
&mut self,
solution_mv: f32,
) -> Result<(), Box<LinuxI2CError>>
pub fn calibrate_single( &mut self, solution_mv: f32, ) -> Result<(), Box<LinuxI2CError>>
Calibrates the probe using a single point using a mV value.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.calibrate_single(500.0);
Sourcepub fn calibrate_probe_low(
&mut self,
solution_mv: f32,
) -> Result<(), Box<LinuxI2CError>>
pub fn calibrate_probe_low( &mut self, solution_mv: f32, ) -> Result<(), Box<LinuxI2CError>>
Calibrates the dual-point values for the low reading, in mV, and saves them in the devices’s EEPROM.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.calibrate_probe_low(50.0);
Sourcepub fn calibrate_probe_high(
&mut self,
solution_mv: f32,
) -> Result<(), Box<LinuxI2CError>>
pub fn calibrate_probe_high( &mut self, solution_mv: f32, ) -> Result<(), Box<LinuxI2CError>>
Calibrates the dual-point values for the high reading, in mV, and saves them in the devices’s EEPROM.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.calibrate_probe_low(500.0);
Sourcepub fn set_dual_point_calibration(
&mut self,
ref_low: f32,
ref_high: f32,
read_low: f32,
read_high: f32,
) -> Result<(), Box<LinuxI2CError>>
pub fn set_dual_point_calibration( &mut self, ref_low: f32, ref_high: f32, read_low: f32, read_high: f32, ) -> Result<(), Box<LinuxI2CError>>
Sets all the values, in mV, for dual point calibration and saves them in the devices’s EEPROM.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.set_dual_point_calibration(50.0, 500.0, 34.0, 553.0);
Sourcepub fn get_calibrate_offset(&mut self) -> Result<f32, Box<LinuxI2CError>>
pub fn get_calibrate_offset(&mut self) -> Result<f32, Box<LinuxI2CError>>
Returns the single-point offset from the device.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.get_calibrate_offset();
Sourcepub fn get_calibrate_high_reference(
&mut self,
) -> Result<f32, Box<LinuxI2CError>>
pub fn get_calibrate_high_reference( &mut self, ) -> Result<f32, Box<LinuxI2CError>>
Returns the dual-point calibration high reference value.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.set_dual_point_calibration(0.0, 500.0, 0.0, 0.0);
Sourcepub fn get_calibrate_high_reading(&mut self) -> Result<f32, Box<LinuxI2CError>>
pub fn get_calibrate_high_reading(&mut self) -> Result<f32, Box<LinuxI2CError>>
Returns the dual-point calibration high reading value.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.set_dual_point_calibration(0.0, 0.0, 0.0, 553.0);
assert_eq!(553.0, mv.get_calibrate_high_reading().unwrap());
Sourcepub fn get_calibrate_low_reference(&mut self) -> Result<f32, Box<LinuxI2CError>>
pub fn get_calibrate_low_reference(&mut self) -> Result<f32, Box<LinuxI2CError>>
Returns the dual-point calibration low reference value.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.set_dual_point_calibration(50.0, 0.0, 0.0, 0.0);
assert_eq!(50.0, mv.get_calibrate_low_reference().unwrap());
Sourcepub fn get_calibrate_low_reading(&mut self) -> Result<f32, Box<LinuxI2CError>>
pub fn get_calibrate_low_reading(&mut self) -> Result<f32, Box<LinuxI2CError>>
Returns the dual-point calibration low reading value.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.set_dual_point_calibration(0.0, 0.0, 34.0, 0.0);
assert_eq!(34.0, mv.get_calibrate_low_reading().unwrap());
Sourcepub fn get_version(&mut self) -> Result<u8, Box<LinuxI2CError>>
pub fn get_version(&mut self) -> Result<u8, Box<LinuxI2CError>>
Returns the firmware version of the device.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
assert_eq!(0x1, mv.get_version().unwrap());
Sourcepub fn get_firmware(&mut self) -> Result<u8, Box<LinuxI2CError>>
pub fn get_firmware(&mut self) -> Result<u8, Box<LinuxI2CError>>
Returns the firmware version of the device.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3c).unwrap();
assert_eq!(0x1, mv.get_version().unwrap());
Sourcepub fn reset(&mut self) -> Result<(), Box<LinuxI2CError>>
pub fn reset(&mut self) -> Result<(), Box<LinuxI2CError>>
Resets all the stored calibration information.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.reset();
assert_eq!(true, mv.get_calibrate_offset().unwrap().is_nan());
assert_eq!(true, mv.get_calibrate_low_reading().unwrap().is_nan());
assert_eq!(true, mv.get_calibrate_high_reading().unwrap().is_nan());
assert_eq!(true, mv.get_calibrate_low_reference().unwrap().is_nan());
assert_eq!(true, mv.get_calibrate_high_reference().unwrap().is_nan());
Sourcepub fn set_i2c_address(
&mut self,
i2c_address: u16,
) -> Result<(), Box<LinuxI2CError>>
pub fn set_i2c_address( &mut self, i2c_address: u16, ) -> Result<(), Box<LinuxI2CError>>
Sets the I2C address of the device.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
// mv.set_i2c_address(0x4f);
Sourcepub fn read_eeprom(&mut self, address: u8) -> Result<f32, Box<LinuxI2CError>>
pub fn read_eeprom(&mut self, address: u8) -> Result<f32, Box<LinuxI2CError>>
Sets all the values, in mV, for dual point calibration and saves them in the devices’s EEPROM.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.write_eeprom(100, 295.0);
assert_eq!(295.0, mv.read_eeprom(100).unwrap());
Sourcepub fn write_eeprom(
&mut self,
address: u8,
value: f32,
) -> Result<(), Box<LinuxI2CError>>
pub fn write_eeprom( &mut self, address: u8, value: f32, ) -> Result<(), Box<LinuxI2CError>>
Sets all the values, in mV, for dual point calibration and saves them in the devices’s EEPROM.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.write_eeprom(100, 295.0);
assert_eq!(295.0, mv.read_eeprom(100).unwrap());
Sourcepub fn get_probe_potential(&mut self) -> Result<f32, Box<LinuxI2CError>>
pub fn get_probe_potential(&mut self) -> Result<f32, Box<LinuxI2CError>>
Returns the saved probe potential from EEPROM.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.set_probe_potential(245.0).unwrap();
assert_eq!(245.0, mv.get_probe_potential().unwrap());
Sourcepub fn set_probe_potential(
&mut self,
potential: f32,
) -> Result<(), Box<LinuxI2CError>>
pub fn set_probe_potential( &mut self, potential: f32, ) -> Result<(), Box<LinuxI2CError>>
Saves probe potential in EEPROM.
§Example
let mut mv = ufire_ise::IseProbe::new("/dev/i2c-3", 0x3f).unwrap();
mv.set_probe_potential(245.0).unwrap();
assert_eq!(245.0, mv.get_probe_potential().unwrap());