pub struct MaskEnable {
pub shunt_over_limit: bool,
pub shunt_under_limit: bool,
pub bus_over_limit: bool,
pub bus_under_limit: bool,
pub power_over_limit: bool,
pub conversion_ready: bool,
pub alert_function_flag: bool,
pub conversion_ready_flag: bool,
pub math_overflow: bool,
pub alert_active_high: bool,
pub alert_latch: bool,
}Expand description
The Mask/Enable register (0x06): which alert function drives the pin, how the pin behaves, and the status flags the chip reports back.
The alert limit register is compared in the units of the selected function, so
build it with shunt_register, bus_register, or power_register.
Fields§
§shunt_over_limit: boolAssert the alert pin when the shunt voltage exceeds the limit (SOL).
shunt_under_limit: boolAssert the alert pin when the shunt voltage drops below the limit (SUL).
bus_over_limit: boolAssert the alert pin when the bus voltage exceeds the limit (BOL).
bus_under_limit: boolAssert the alert pin when the bus voltage drops below the limit (BUL).
power_over_limit: boolAssert the alert pin when the power exceeds the limit (POL).
conversion_ready: boolAlso assert the alert pin when a conversion completes (CNVR).
alert_function_flag: boolStatus: the selected alert function, not conversion-ready, caused the last alert (AFF).
conversion_ready_flag: boolStatus: all conversions, averaging, and multiplications are complete (CVRF).
math_overflow: boolStatus: an arithmetic overflow occurred and current and power may be invalid (OVF).
alert_active_high: boolAlert pin polarity: true for inverted (active-high), false for the default
active-low (APOL).
alert_latch: boolLatch the alert pin and flag until this register is read, rather than clearing when the fault clears (LEN).
Implementations§
Source§impl MaskEnable
impl MaskEnable
Sourcepub fn from_register(raw: u16) -> Self
pub fn from_register(raw: u16) -> Self
Sourcepub fn to_register(self) -> u16
pub fn to_register(self) -> u16
Encodes the enables and flags as a Mask/Enable register value.
§Returns
The 16-bit register to write.
Sourcepub fn active_alert_function(self) -> Option<AlertFunction>
pub fn active_alert_function(self) -> Option<AlertFunction>
Returns the alert function the pin actually responds to.
Only one limit function can drive the pin at a time; when several are enabled the chip honours the most significant bit.
§Returns
The highest-priority enabled function, or None if no limit function is
enabled.
Trait Implementations§
Source§impl Clone for MaskEnable
impl Clone for MaskEnable
Source§fn clone(&self) -> MaskEnable
fn clone(&self) -> MaskEnable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MaskEnable
Source§impl Debug for MaskEnable
impl Debug for MaskEnable
Source§impl Default for MaskEnable
impl Default for MaskEnable
Source§fn default() -> MaskEnable
fn default() -> MaskEnable
impl Eq for MaskEnable
Source§impl PartialEq for MaskEnable
impl PartialEq for MaskEnable
Source§fn eq(&self, other: &MaskEnable) -> bool
fn eq(&self, other: &MaskEnable) -> bool
self and other values to be equal, and is used by ==.