Skip to main content

MaskEnable

Struct MaskEnable 

Source
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: bool

Assert the alert pin when the shunt voltage exceeds the limit (SOL).

§shunt_under_limit: bool

Assert the alert pin when the shunt voltage drops below the limit (SUL).

§bus_over_limit: bool

Assert the alert pin when the bus voltage exceeds the limit (BOL).

§bus_under_limit: bool

Assert the alert pin when the bus voltage drops below the limit (BUL).

§power_over_limit: bool

Assert the alert pin when the power exceeds the limit (POL).

§conversion_ready: bool

Also assert the alert pin when a conversion completes (CNVR).

§alert_function_flag: bool

Status: the selected alert function, not conversion-ready, caused the last alert (AFF).

§conversion_ready_flag: bool

Status: all conversions, averaging, and multiplications are complete (CVRF).

§math_overflow: bool

Status: an arithmetic overflow occurred and current and power may be invalid (OVF).

§alert_active_high: bool

Alert pin polarity: true for inverted (active-high), false for the default active-low (APOL).

§alert_latch: bool

Latch the alert pin and flag until this register is read, rather than clearing when the fault clears (LEN).

Implementations§

Source§

impl MaskEnable

Source

pub fn from_register(raw: u16) -> Self

Decodes a Mask/Enable register value.

§Arguments
  • raw - the 16-bit Mask/Enable register.
§Returns

The decoded enables and flags; reserved bits are ignored.

Source

pub fn to_register(self) -> u16

Encodes the enables and flags as a Mask/Enable register value.

§Returns

The 16-bit register to write.

Source

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

Source§

fn clone(&self) -> MaskEnable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MaskEnable

Source§

impl Debug for MaskEnable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MaskEnable

Source§

fn default() -> MaskEnable

Returns the “default value” for a type. Read more
Source§

impl Eq for MaskEnable

Source§

impl PartialEq for MaskEnable

Source§

fn eq(&self, other: &MaskEnable) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MaskEnable

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.