pub struct Configuration {
pub software_reset: bool,
pub heater: bool,
pub mode: AcquisitionMode,
pub battery_low: bool,
pub temperature_resolution: TemperatureResolution,
pub humidity_resolution: HumidityResolution,
}Expand description
The configuration register (0x02), field by field.
Configuration::default is the power-on state, CONFIGURATION_RESET.
Fields§
§software_reset: boolRST, bit 15: write true to reset the part; the bit clears itself.
heater: boolHEAT, bit 13: run the on-die heater during measurements.
mode: AcquisitionModeMODE, bit 12: what one trigger acquires.
battery_low: boolBTST, bit 11, read only: true when the supply is below 2.8 V, refreshed
after power-on and after every measurement request.
temperature_resolution: TemperatureResolutionTRES, bit 10.
humidity_resolution: HumidityResolutionHRES, bits 9:8.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn from_register(raw: u16) -> Result<Configuration, SensorError>
pub fn from_register(raw: u16) -> Result<Configuration, SensorError>
Decodes the configuration register.
Reserved bits (14 and 7:0) are ignored; the part reads them as zero.
§Arguments
raw- the 16-bit configuration register.
§Returns
The decoded configuration.
§Errors
SensorError::Invalid if HRES holds 11, the one code the datasheet
leaves undefined.
Sourcepub fn to_register(&self) -> u16
pub fn to_register(&self) -> u16
Sourcepub fn conversion_time_micros(&self) -> u32
pub fn conversion_time_micros(&self) -> u32
Returns how long to wait after a trigger before the result is readable.
§Returns
In AcquisitionMode::TemperatureThenHumidity, the temperature and humidity
conversion times added together. In AcquisitionMode::Single, the longer of
the two, which covers whichever pointer the caller triggered.
Trait Implementations§
Source§impl Clone for Configuration
impl Clone for Configuration
Source§fn clone(&self) -> Configuration
fn clone(&self) -> Configuration
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 Configuration
Source§impl Debug for Configuration
impl Debug for Configuration
Source§impl Default for Configuration
impl Default for Configuration
Source§fn default() -> Configuration
fn default() -> Configuration
impl Eq for Configuration
Source§impl PartialEq for Configuration
impl PartialEq for Configuration
Source§fn eq(&self, other: &Configuration) -> bool
fn eq(&self, other: &Configuration) -> bool
self and other values to be equal, and is used by ==.