Skip to main content

DeviceStatus

Struct DeviceStatus 

Source
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

Source

pub const RSVD1_MASK: u32

Mask of all reserved-as-1 bits.

Source

pub const RSVD0_MASK: u32

Mask of all reserved-as-0 bits.

Source

pub const DEFAULT: u32

The default value of the layout, combining all field defaults and reserved-as values.

Source

pub const SPEED_WARNING_MASK: u32

Unshifted bitmask of speed_warning.

Source

pub const SPEED_WARNING_SHIFT: usize = 21

Bit shift (i.e., the low bit) of speed_warning.

Source

pub const CO2_1_ERROR_MASK: u32

Unshifted bitmask of co2_1_error.

Source

pub const CO2_1_ERROR_SHIFT: usize = 12

Bit shift (i.e., the low bit) of co2_1_error.

Source

pub const PM_ERROR_MASK: u32

Unshifted bitmask of pm_error.

Source

pub const PM_ERROR_SHIFT: usize = 11

Bit shift (i.e., the low bit) of pm_error.

Source

pub const HCHO_ERROR_MASK: u32

Unshifted bitmask of hcho_error.

Source

pub const HCHO_ERROR_SHIFT: usize = 10

Bit shift (i.e., the low bit) of hcho_error.

Source

pub const CO2_2_ERROR_MASK: u32

Unshifted bitmask of co2_2_error.

Source

pub const CO2_2_ERROR_SHIFT: usize = 9

Bit shift (i.e., the low bit) of co2_2_error.

Source

pub const GAS_ERROR_MASK: u32

Unshifted bitmask of gas_error.

Source

pub const GAS_ERROR_SHIFT: usize = 7

Bit shift (i.e., the low bit) of gas_error.

Source

pub const RH_T_ERROR_MASK: u32

Unshifted bitmask of rh_t_error.

Source

pub const RH_T_ERROR_SHIFT: usize = 6

Bit shift (i.e., the low bit) of rh_t_error.

Source

pub const FAN_ERROR_MASK: u32

Unshifted bitmask of fan_error.

Source

pub const FAN_ERROR_SHIFT: usize = 4

Bit shift (i.e., the low bit) of fan_error.

Source

pub const FIELDS: [FieldMetadata<u32>; 8]

Metadata of all named fields in the layout.

Source

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).

Source

pub const fn speed_warning(&self) -> bool

The value of DeviceStatus21.

Source

pub const fn set_speed_warning(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus21.

Source

pub const fn co2_1_error(&self) -> bool

The value of DeviceStatus12.

Source

pub const fn set_co2_1_error(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus12.

Source

pub const fn pm_error(&self) -> bool

The value of DeviceStatus11.

Source

pub const fn set_pm_error(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus11.

Source

pub const fn hcho_error(&self) -> bool

The value of DeviceStatus10.

Source

pub const fn set_hcho_error(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus10.

Source

pub const fn co2_2_error(&self) -> bool

The value of DeviceStatus9.

Source

pub const fn set_co2_2_error(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus9.

Source

pub const fn gas_error(&self) -> bool

The value of DeviceStatus7.

Source

pub const fn set_gas_error(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus7.

Source

pub const fn rh_t_error(&self) -> bool

The value of DeviceStatus6.

Source

pub const fn set_rh_t_error(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus6.

Source

pub const fn fan_error(&self) -> bool

The value of DeviceStatus4.

Source

pub const fn set_fan_error(&mut self, value: bool) -> &mut Self

Sets the value of DeviceStatus4.

Source§

impl DeviceStatus

Source

pub fn iter(&self) -> DeviceStatusIter

Returns an iterator over (metadata, value) pairs for each field.

Methods from Deref<Target = u32>§

1.43.0 · Source

pub const MIN: u32 = 0

1.43.0 · Source

pub const MAX: u32

1.53.0 · Source

pub const BITS: u32

Trait Implementations§

Source§

impl Binary for DeviceStatus

Source§

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

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

impl Clone for DeviceStatus

Source§

fn clone(&self) -> DeviceStatus

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 DeviceStatus

Source§

impl Debug for DeviceStatus

Source§

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

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

impl Default for DeviceStatus

Source§

fn default() -> Self

Returns an instance with the default bits set (i.e,. with a value of Self::DEFAULT.

Source§

impl Deref for DeviceStatus

Source§

type Target = u32

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for DeviceStatus

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Eq for DeviceStatus

Source§

impl From<u32> for DeviceStatus

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl IntoIterator for DeviceStatus

Source§

type Item = (&'static FieldMetadata<u32>, u32)

The type of the elements being iterated over.
Source§

type IntoIter = DeviceStatusIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> IntoIterator for &'a DeviceStatus

Source§

type Item = (&'static FieldMetadata<u32>, u32)

The type of the elements being iterated over.
Source§

type IntoIter = DeviceStatusIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl LowerHex for DeviceStatus

Source§

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

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

impl Octal for DeviceStatus

Source§

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

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

impl PartialEq for DeviceStatus

Source§

fn eq(&self, other: &DeviceStatus) -> 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 DeviceStatus

Source§

impl UpperHex for DeviceStatus

Source§

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

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.