[−][src]Struct hts221::device::AvConf
The AV_CONF register. Controls humidity and temperature resolution modes.
Methods
impl AvConf
[src]
pub fn new<Comm>(dev: &mut Device<Comm>) -> Result<Self, Comm::Error> where
Comm: WriteRead,
[src]
Comm: WriteRead,
Blocking read of the AV_CONF register from dev
.
pub fn modify<Comm, F>(
&mut self,
dev: &mut Device<Comm>,
f: F
) -> Result<(), Comm::Error> where
Comm: Write,
F: FnOnce(&mut Self),
[src]
&mut self,
dev: &mut Device<Comm>,
f: F
) -> Result<(), Comm::Error> where
Comm: Write,
F: FnOnce(&mut Self),
Updates the register using f
, then writes the new value out to the chip.
pub fn humidity_samples_averaged(&self) -> u16
[src]
Returns the number of internal humidity samples averaged together to generate one sample. Note that this is an interpretation of the bit pattern, not the bit pattern itself.
pub fn set_humidity_samples_averaged(&mut self, samples: AvgH)
[src]
Sets the number of internal humidity samples that are averaged together to generate one
sample. Use inside a modify
function to actually set the value on the chip.
Do this:
let mut av_conf = device.av_conf(&mut i2c)?; av_conf.modify(&mut device.tie(&mut i2c), |w| w.set_humidity_samples_averaged( hts221::device::av_conf::AvgH::Avg8))?;
Instead of this:
let mut av_conf = device.av_conf(&mut i2c)?; av_conf.set_humidity_samples_averaged( hts221::device::av_conf::AvgH::Avg8); // not written to chip
pub fn temperature_samples_averaged(&self) -> u16
[src]
Returns the number of internal temperature samples averaged together to generate one sample. Note that this is an interpretation of the bit pattern, not the bit pattern itself.
pub fn set_temperature_samples_averaged(&mut self, samples: AvgT)
[src]
Sets the number of internal temperature samples that are averaged together to generate one
sample. Use inside a modify
function to actually set the value on the chip.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for AvConf
impl Send for AvConf
impl Sync for AvConf
impl Unpin for AvConf
impl UnwindSafe for AvConf
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,