Struct ufire_ec::EcProbe

source ·
pub struct EcProbe { /* private fields */ }

Implementations

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

Start a temperature measurement

Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap();
ec.measure_temp();

Sets the temperature used by the device.

Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap();
ec.set_temp(20.2);

Calibrates the EC range of measurement, 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_ec(2.0);

Calibrates the SW range of measurements, 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_sw(53.0);

Starts an EC measurement, taking a new temp measurement if true passed

Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap();
ec.measure_ec(true);

Starts a raw measurement.

Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap();
ec.measure_raw(true);

Starts an SW measurement and returns the salinity in PSU.

Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap();
ec.measure_salinity();

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

Returns the temperature constant from the device.

Example
let mut ec = ufire_ec::EcProbe::new("/dev/i2c-3", 0x3c).unwrap();
ec.get_temp_constant();

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

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

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

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

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

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

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

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

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.