pub struct INA226<I2C> { /* private fields */ }Expand description
INA226 voltage/current/power monitor
Implementations§
Source§impl<I2C, E> INA226<I2C>where
I2C: I2c<Error = E>,
impl<I2C, E> INA226<I2C>where
I2C: I2c<Error = E>,
Sourcepub fn configuration_raw(&mut self) -> Result<u16, E>
pub fn configuration_raw(&mut self) -> Result<u16, E>
Gets the raw configuration value.
Sourcepub fn configuration(&mut self) -> Result<Option<Config>, E>
pub fn configuration(&mut self) -> Result<Option<Config>, E>
Gets the configuration.
Sourcepub fn set_configuration(&mut self, config: &Config) -> Result<(), E>
pub fn set_configuration(&mut self, config: &Config) -> Result<(), E>
Set the configuration of the device.
Sourcepub fn shunt_voltage_raw(&mut self) -> Result<i16, E>
pub fn shunt_voltage_raw(&mut self) -> Result<i16, E>
Gets the raw shunt voltage measurement.
Sourcepub fn shunt_voltage_microvolts(&mut self) -> Result<f64, E>
pub fn shunt_voltage_microvolts(&mut self) -> Result<f64, E>
Gets the shunt voltage in microvolts.
Sourcepub fn bus_voltage_raw(&mut self) -> Result<u16, E>
pub fn bus_voltage_raw(&mut self) -> Result<u16, E>
Gets the raw bus voltage measurement.
Sourcepub fn bus_voltage_millivolts(&mut self) -> Result<f64, E>
pub fn bus_voltage_millivolts(&mut self) -> Result<f64, E>
Gets the bus voltage in millivolts.
Sourcepub fn power_raw(&mut self) -> Result<u16, E>
pub fn power_raw(&mut self) -> Result<u16, E>
Gets the raw calculated power being delivered to the load. Returns zero if callibration has not been performed.
Sourcepub fn power_watts(&mut self) -> Result<Option<f64>, E>
pub fn power_watts(&mut self) -> Result<Option<f64>, E>
Gets the calculated power (in Watts) being delivered to the load. Requires callibration.
Sourcepub fn current_raw(&mut self) -> Result<i16, E>
pub fn current_raw(&mut self) -> Result<i16, E>
Gets the calculated current flowing through the shunt resistor. Returns zero if callibration has not been performed.
Sourcepub fn current_amps(&mut self) -> Result<Option<f64>, E>
pub fn current_amps(&mut self) -> Result<Option<f64>, E>
Gets the calculated current (in Amps) flowing through the shunt resistor. Requires callibration.
Sourcepub fn callibration(&mut self) -> Result<u16, E>
pub fn callibration(&mut self) -> Result<u16, E>
Gets the callibration register, which controls full-scale range of current and power measurements.
Sourcepub fn set_callibration_raw(&mut self, value: u16) -> Result<(), E>
pub fn set_callibration_raw(&mut self, value: u16) -> Result<(), E>
Set the callibration register directly.
NB: after calling this, only _raw methods can be used.
Sourcepub fn callibrate(
&mut self,
shunt_resistance: f64,
current_expected_max: f64,
) -> Result<(), E>
pub fn callibrate( &mut self, shunt_resistance: f64, current_expected_max: f64, ) -> Result<(), E>
Calibrate the sensitvity of the current and power values.
Sourcepub fn mask_enable(&mut self) -> Result<MaskEnableFlags, E>
pub fn mask_enable(&mut self) -> Result<MaskEnableFlags, E>
Get the Alert configuration and Conversion Ready flag.
Sourcepub fn set_mask_enable(&mut self, flags: MaskEnableFlags) -> Result<(), E>
pub fn set_mask_enable(&mut self, flags: MaskEnableFlags) -> Result<(), E>
Set the Alert configuration and Conversion Ready flags.
Sourcepub fn alert_limit(&mut self) -> Result<u16, E>
pub fn alert_limit(&mut self) -> Result<u16, E>
Get the limit value to compare to the selected Alert function.
Sourcepub fn set_alert_limit(&mut self, value: u16) -> Result<(), E>
pub fn set_alert_limit(&mut self, value: u16) -> Result<(), E>
Set the Alert Limit register.
Sourcepub fn manufacturer_id(&mut self) -> Result<u16, E>
pub fn manufacturer_id(&mut self) -> Result<u16, E>
Get the unique manufacturer identification number