pub struct Status { /* private fields */ }Expand description
The status register, read with command::READ_STATUS as one CRC-protected word.
It reports the heater, the alert state, whether a reset has happened, and how the
last command and write were received. The flag bits (alert pending, the two
tracking alerts, and reset detected) are cleared by command::CLEAR_STATUS.
Implementations§
Source§impl Status
impl Status
Sourcepub const ALERT_PENDING: u16
pub const ALERT_PENDING: u16
Bit 15: at least one alert is pending.
Sourcepub const HUMIDITY_TRACKING_ALERT: u16
pub const HUMIDITY_TRACKING_ALERT: u16
Bit 11: a relative-humidity tracking alert.
Sourcepub const TEMPERATURE_TRACKING_ALERT: u16
pub const TEMPERATURE_TRACKING_ALERT: u16
Bit 10: a temperature tracking alert.
Sourcepub const RESET_DETECTED: u16
pub const RESET_DETECTED: u16
Bit 4: a hard reset, soft reset, or supply failure happened since the register was last cleared.
Sourcepub const COMMAND_FAILED: u16
pub const COMMAND_FAILED: u16
Bit 1: the last command was not processed, being invalid or failing the command checksum.
Sourcepub const WRITE_CHECKSUM_FAILED: u16
pub const WRITE_CHECKSUM_FAILED: u16
Bit 0: the checksum of the last write transfer failed.
Sourcepub const DEFAULT: u16
pub const DEFAULT: u16
The register’s value after power-up (0x8010): alert pending and reset detected set, everything else clear. The datasheet leaves bits 9:5 unspecified; they are zero here.
Sourcepub fn from_bits(bits: u16) -> Status
pub fn from_bits(bits: u16) -> Status
Wraps a raw status word.
§Arguments
bits- the 16-bit register value, for example theSelf::DEFAULTword or a combination of the bit constants.
§Returns
The status holding those bits.
Sourcepub fn parse(bytes: &[u8; 3]) -> Result<Status, SensorError>
pub fn parse(bytes: &[u8; 3]) -> Result<Status, SensorError>
Parses and CRC-checks the three bytes returned by command::READ_STATUS.
§Arguments
bytes- the register most-significant byte first, then its CRC.
§Returns
The decoded status.
§Errors
Returns SensorError::Crc if the CRC byte does not match the register bytes.
Sourcepub fn alert_pending(&self) -> bool
pub fn alert_pending(&self) -> bool
Returns whether at least one alert is pending (bit 15).
Sourcepub fn humidity_tracking_alert(&self) -> bool
pub fn humidity_tracking_alert(&self) -> bool
Returns whether a relative-humidity tracking alert is raised (bit 11).
Sourcepub fn temperature_tracking_alert(&self) -> bool
pub fn temperature_tracking_alert(&self) -> bool
Returns whether a temperature tracking alert is raised (bit 10).
Sourcepub fn reset_detected(&self) -> bool
pub fn reset_detected(&self) -> bool
Returns whether a reset has happened since the register was last cleared (bit 4).
Sourcepub fn command_failed(&self) -> bool
pub fn command_failed(&self) -> bool
Returns whether the last command was rejected (bit 1).
Sourcepub fn write_checksum_failed(&self) -> bool
pub fn write_checksum_failed(&self) -> bool
Returns whether the last write transfer failed its checksum (bit 0).