[][src]Struct hts221::Builder

pub struct Builder<Comm, E> { /* fields omitted */ }

Builder for an HTS221 structure. This builder allows you to configure the chip without needing to access the device module.

Defaults are:

  • Address: 0x5F (7-bit)
  • Averaged samples - untouched
  • Powered on
  • Block update mode
  • One-shot mode
  • No boot
  • Data ready polarity and output mode are unchanged
  • Data ready interrupt is disabled

Methods

impl<Comm, E> Builder<Comm, E> where
    Comm: Write<Error = E> + WriteRead<Error = E>, 
[src]

pub fn new() -> Self[src]

Initialize a new Builder for an HTS221 that will use comm for all communication.

pub fn with_default_7bit_address(self) -> Self[src]

Configures the device to be addressable using its 7-bit address (0x5F). Some embedded-hal implementations (e.g., stm32lxx-hal) expect 8-bit I2C addresses, while some (e.g., stm32f30x-hal) expect 7-bit addresses.

pub fn with_default_8bit_address(self) -> Self[src]

Configures the device to be addressable using its 8-bit address (0xBE). Some embedded-hal implementations (e.g., stm32lxx-hal) expect 8-bit I2C addresses, while some (e.g., stm32f30x-hal) expect 7-bit addresses.

pub fn with_address(self, address: u8) -> Self[src]

Configures the device to be addressable an arbitrary I2C address. This would be appropriate if the device is on a board with an I2C address shifter (such as the LTC4316 from Analog Devices.

pub fn with_avg_t(self, avg_t: AvgT) -> Self[src]

Configures the number of internal temperature samples that will be averaged into one output sample.

pub fn with_avg_h(self, avg_h: AvgH) -> Self[src]

Configures the number of internal humidity samples that will be averaged into one output sample.

pub fn powered_up(self) -> Self[src]

Powers up the device on initialization (default).

pub fn powered_down(self) -> Self[src]

Keeps the device powered down on initialization.

pub fn with_update_mode(self, mode: UpdateMode) -> Self[src]

Sets the update mode on initialization

pub fn with_data_rate(self, rate: DataRate) -> Self[src]

Sets the data rate on initialization

pub fn with_boot(self) -> Self[src]

Boots the device (resets stored values) on initialization

pub fn without_boot(self) -> Self[src]

Does not boot the device on initialization (default)

pub fn with_data_ready_polarity(self, polarity: Polarity) -> Self[src]

Sets the polarity of the data-ready output pin.

pub fn with_data_ready_mode(self, mode: PinMode) -> Self[src]

Sets the output mode of the data-ready output pin.

pub fn with_data_ready_enabled(self) -> Self[src]

Enables the data-ready external interrupt pin.

pub fn with_data_ready_disabled(self) -> Self[src]

Disables the data-ready external interrupt pin (default).

pub fn build(self, comm: &mut Comm) -> Result<HTS221<Comm, E>, E>[src]

Builds an HTS221 handle using the current builder configuration.

Auto Trait Implementations

impl<Comm, E> RefUnwindSafe for Builder<Comm, E> where
    Comm: RefUnwindSafe,
    E: RefUnwindSafe

impl<Comm, E> Send for Builder<Comm, E> where
    Comm: Send,
    E: Send

impl<Comm, E> Sync for Builder<Comm, E> where
    Comm: Sync,
    E: Sync

impl<Comm, E> Unpin for Builder<Comm, E> where
    Comm: Unpin,
    E: Unpin

impl<Comm, E> UnwindSafe for Builder<Comm, E> where
    Comm: UnwindSafe,
    E: UnwindSafe

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.