Struct IseProbe

Source
pub struct IseProbe { /* private fields */ }

Implementations§

Source§

impl IseProbe

Source

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();
Source

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();
Source

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();
Source

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());
Source

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();
Source

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);
Source

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);
Source

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);
Source

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);
Source

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);
Source

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();
Source

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);
Source

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());
Source

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());
Source

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());
Source

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());
Source

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());
Source

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());
Source

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);
Source

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());
Source

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());
Source

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());
Source

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());
Source

pub fn _write_register( &mut self, register: u8, f_val: f32, ) -> Result<(), Box<LinuxI2CError>>

Source

pub fn _read_register( &mut self, register: u8, ) -> Result<f32, Box<LinuxI2CError>>

Source

pub fn _change_register( &mut self, register: u8, ) -> Result<(), Box<LinuxI2CError>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.