[][src]Struct hts221::device::AvConf

pub struct 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]

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]

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

impl Debug for AvConf[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.