pub enum Resolution {
Bits9,
Bits10,
Bits11,
Bits12,
}Expand description
The conversion resolution, selected by the R1/R0 bits of the configuration byte.
Higher resolution resolves smaller steps but takes longer to convert, a tradeoff the datasheet spells out. The temperature register always carries 1/16 °C per count; at lower resolutions the unused low bits simply read as zero.
Variants§
Bits9
9-bit, 0.5 °C steps, up to 93.75 ms per conversion.
Bits10
10-bit, 0.25 °C steps, up to 187.5 ms per conversion.
Bits11
11-bit, 0.125 °C steps, up to 375 ms per conversion.
Bits12
12-bit, 0.0625 °C steps, up to 750 ms per conversion. The power-on default.
Implementations§
Source§impl Resolution
impl Resolution
Sourcepub fn config_byte(self) -> u8
pub fn config_byte(self) -> u8
Returns the configuration-register byte that selects this resolution.
The byte places R1/R0 in bits 6:5 over the datasheet’s fixed surrounding
pattern (bit 7 clear, bit 4 set, bits 3:0 set), so 12-bit is 0x7F, 11-bit
0x5F, 10-bit 0x3F, and 9-bit 0x1F.
§Returns
The configuration byte written to scratchpad byte 4.
Sourcepub fn from_config_byte(byte: u8) -> Resolution
pub fn from_config_byte(byte: u8) -> Resolution
Sourcepub fn step_micro_celsius(self) -> u32
pub fn step_micro_celsius(self) -> u32
Returns the temperature step this resolution resolves, in micro-degrees Celsius.
§Returns
500000 (0.5 °C) for 9-bit down to 62500 (0.0625 °C) for 12-bit.
Sourcepub fn max_conversion_micros(self) -> u32
pub fn max_conversion_micros(self) -> u32
Returns the datasheet’s maximum conversion time, in microseconds.
§Returns
93750 for 9-bit, doubling up to 750000 for 12-bit.
Trait Implementations§
Source§impl Clone for Resolution
impl Clone for Resolution
Source§fn clone(&self) -> Resolution
fn clone(&self) -> Resolution
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 Resolution
Source§impl Debug for Resolution
impl Debug for Resolution
impl Eq for Resolution
Source§impl PartialEq for Resolution
impl PartialEq for Resolution
Source§fn eq(&self, other: &Resolution) -> bool
fn eq(&self, other: &Resolution) -> bool
self and other values to be equal, and is used by ==.