pub struct DeviceStatus(/* private fields */);Expand description
Device status register, decoded into individual flags.
Each accessor returns a single status bit. Error flags are sticky — they
stay set until cleared (see read_and_clear_device_status or a reset).
The available flags are:
speed_warning— fan speed is outside the target range.co2_1_error,co2_2_error— CO₂ sensor errors.pm_error— particulate-matter sensor error.hcho_error— formaldehyde sensor error.gas_error— VOC/NOx gas sensor error.rh_t_error— humidity/temperature sensor error.fan_error— fan is mechanically blocked or broken.
Implementations§
Source§impl DeviceStatus
impl DeviceStatus
Sourcepub const RSVD1_MASK: u32
pub const RSVD1_MASK: u32
Mask of all reserved-as-1 bits.
Sourcepub const RSVD0_MASK: u32
pub const RSVD0_MASK: u32
Mask of all reserved-as-0 bits.
Sourcepub const DEFAULT: u32
pub const DEFAULT: u32
The default value of the layout, combining all field defaults and reserved-as values.
Sourcepub const SPEED_WARNING_MASK: u32
pub const SPEED_WARNING_MASK: u32
Unshifted bitmask of speed_warning.
Sourcepub const SPEED_WARNING_SHIFT: usize = 21
pub const SPEED_WARNING_SHIFT: usize = 21
Bit shift (i.e., the low bit) of speed_warning.
Sourcepub const CO2_1_ERROR_MASK: u32
pub const CO2_1_ERROR_MASK: u32
Unshifted bitmask of co2_1_error.
Sourcepub const CO2_1_ERROR_SHIFT: usize = 12
pub const CO2_1_ERROR_SHIFT: usize = 12
Bit shift (i.e., the low bit) of co2_1_error.
Sourcepub const PM_ERROR_MASK: u32
pub const PM_ERROR_MASK: u32
Unshifted bitmask of pm_error.
Sourcepub const PM_ERROR_SHIFT: usize = 11
pub const PM_ERROR_SHIFT: usize = 11
Bit shift (i.e., the low bit) of pm_error.
Sourcepub const HCHO_ERROR_MASK: u32
pub const HCHO_ERROR_MASK: u32
Unshifted bitmask of hcho_error.
Sourcepub const HCHO_ERROR_SHIFT: usize = 10
pub const HCHO_ERROR_SHIFT: usize = 10
Bit shift (i.e., the low bit) of hcho_error.
Sourcepub const CO2_2_ERROR_MASK: u32
pub const CO2_2_ERROR_MASK: u32
Unshifted bitmask of co2_2_error.
Sourcepub const CO2_2_ERROR_SHIFT: usize = 9
pub const CO2_2_ERROR_SHIFT: usize = 9
Bit shift (i.e., the low bit) of co2_2_error.
Sourcepub const GAS_ERROR_MASK: u32
pub const GAS_ERROR_MASK: u32
Unshifted bitmask of gas_error.
Sourcepub const GAS_ERROR_SHIFT: usize = 7
pub const GAS_ERROR_SHIFT: usize = 7
Bit shift (i.e., the low bit) of gas_error.
Sourcepub const RH_T_ERROR_MASK: u32
pub const RH_T_ERROR_MASK: u32
Unshifted bitmask of rh_t_error.
Sourcepub const RH_T_ERROR_SHIFT: usize = 6
pub const RH_T_ERROR_SHIFT: usize = 6
Bit shift (i.e., the low bit) of rh_t_error.
Sourcepub const FAN_ERROR_MASK: u32
pub const FAN_ERROR_MASK: u32
Unshifted bitmask of fan_error.
Sourcepub const FAN_ERROR_SHIFT: usize = 4
pub const FAN_ERROR_SHIFT: usize = 4
Bit shift (i.e., the low bit) of fan_error.
Sourcepub const FIELDS: [FieldMetadata<u32>; 8]
pub const FIELDS: [FieldMetadata<u32>; 8]
Metadata of all named fields in the layout.
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new instance with reserved-as-1 bits set and
all other bits zeroed (i.e., with a value of
Self::RSVD1_MASK).
Sourcepub const fn speed_warning(&self) -> bool
pub const fn speed_warning(&self) -> bool
The value of DeviceStatus21.
Sourcepub const fn set_speed_warning(&mut self, value: bool) -> &mut Self
pub const fn set_speed_warning(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus21.
Sourcepub const fn co2_1_error(&self) -> bool
pub const fn co2_1_error(&self) -> bool
The value of DeviceStatus12.
Sourcepub const fn set_co2_1_error(&mut self, value: bool) -> &mut Self
pub const fn set_co2_1_error(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus12.
Sourcepub const fn set_pm_error(&mut self, value: bool) -> &mut Self
pub const fn set_pm_error(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus11.
Sourcepub const fn hcho_error(&self) -> bool
pub const fn hcho_error(&self) -> bool
The value of DeviceStatus10.
Sourcepub const fn set_hcho_error(&mut self, value: bool) -> &mut Self
pub const fn set_hcho_error(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus10.
Sourcepub const fn co2_2_error(&self) -> bool
pub const fn co2_2_error(&self) -> bool
The value of DeviceStatus9.
Sourcepub const fn set_co2_2_error(&mut self, value: bool) -> &mut Self
pub const fn set_co2_2_error(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus9.
Sourcepub const fn set_gas_error(&mut self, value: bool) -> &mut Self
pub const fn set_gas_error(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus7.
Sourcepub const fn rh_t_error(&self) -> bool
pub const fn rh_t_error(&self) -> bool
The value of DeviceStatus6.
Sourcepub const fn set_rh_t_error(&mut self, value: bool) -> &mut Self
pub const fn set_rh_t_error(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus6.
Sourcepub const fn set_fan_error(&mut self, value: bool) -> &mut Self
pub const fn set_fan_error(&mut self, value: bool) -> &mut Self
Sets the value of DeviceStatus4.
Trait Implementations§
Source§impl Binary for DeviceStatus
impl Binary for DeviceStatus
Source§impl Clone for DeviceStatus
impl Clone for DeviceStatus
Source§fn clone(&self) -> DeviceStatus
fn clone(&self) -> DeviceStatus
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 DeviceStatus
Source§impl Debug for DeviceStatus
impl Debug for DeviceStatus
Source§impl Default for DeviceStatus
impl Default for DeviceStatus
Source§fn default() -> Self
fn default() -> Self
Returns an instance with the default bits set (i.e,. with a
value of Self::DEFAULT.
Source§impl Deref for DeviceStatus
impl Deref for DeviceStatus
Source§impl DerefMut for DeviceStatus
impl DerefMut for DeviceStatus
impl Eq for DeviceStatus
Source§impl From<u32> for DeviceStatus
impl From<u32> for DeviceStatus
Source§impl IntoIterator for DeviceStatus
impl IntoIterator for DeviceStatus
Source§impl<'a> IntoIterator for &'a DeviceStatus
impl<'a> IntoIterator for &'a DeviceStatus
Source§impl LowerHex for DeviceStatus
impl LowerHex for DeviceStatus
Source§impl Octal for DeviceStatus
impl Octal for DeviceStatus
Source§impl PartialEq for DeviceStatus
impl PartialEq for DeviceStatus
Source§fn eq(&self, other: &DeviceStatus) -> bool
fn eq(&self, other: &DeviceStatus) -> bool
self and other values to be equal, and is used by ==.