Struct bme280_multibus::Config[][src]

pub struct Config(_);
Expand description

Config register.

This register sets the rate, filter, and interface options of the device. Writes to the config register in normal mode may be ignored. In sleep mode writes are not ignored.

All methods on this struct are constant so that you can create a configuration value at compile time.

Example

use bme280_multibus::{Config, Filter, Standby};

const CONFIG: Config = Config::reset()
    .set_standby_time(Standby::Millis1000)
    .set_filter(Filter::X16)
    .set_spi3w_en(false);

Implementations

Get the reset value of the config register.

Example
use bme280_multibus::Config;

assert_eq!(Config::reset(), Config::default());

Set the inactive duration tstandby in normal mode.

See Standby for settings, and chapter 3.3.4 in the datasheet for details.

Example
use bme280_multibus::{Config, Standby};

let mut cfg: Config = Config::default();
assert_eq!(cfg.standby_time(), Standby::default());
cfg = cfg.set_standby_time(Standby::Micros500);
assert_eq!(cfg.standby_time(), Standby::Micros500);
cfg = cfg.set_standby_time(Standby::Micros62500);
assert_eq!(cfg.standby_time(), Standby::Micros62500);
cfg = cfg.set_standby_time(Standby::Millis125);
assert_eq!(cfg.standby_time(), Standby::Millis125);
cfg = cfg.set_standby_time(Standby::Millis250);
assert_eq!(cfg.standby_time(), Standby::Millis250);
cfg = cfg.set_standby_time(Standby::Millis500);
assert_eq!(cfg.standby_time(), Standby::Millis500);
cfg = cfg.set_standby_time(Standby::Millis1000);
assert_eq!(cfg.standby_time(), Standby::Millis1000);
cfg = cfg.set_standby_time(Standby::Millis10);
assert_eq!(cfg.standby_time(), Standby::Millis10);
cfg = cfg.set_standby_time(Standby::Millis20);
assert_eq!(cfg.standby_time(), Standby::Millis20);

Get the standby time.

Set the time constant of the IIR filter.

See Filter for settings, and chapter 3.4.4 in the datasheet for details.

Example
use bme280_multibus::{Config, Filter};

let mut cfg: Config = Config::default();
assert_eq!(cfg.filter(), Filter::default());
cfg = cfg.set_filter(Filter::Off);
assert_eq!(cfg.filter(), Filter::Off);
cfg = cfg.set_filter(Filter::X2);
assert_eq!(cfg.filter(), Filter::X2);
cfg = cfg.set_filter(Filter::X4);
assert_eq!(cfg.filter(), Filter::X4);
cfg = cfg.set_filter(Filter::X8);
assert_eq!(cfg.filter(), Filter::X8);
cfg = cfg.set_filter(Filter::X16);
assert_eq!(cfg.filter(), Filter::X16);

Get the filter coefficient.

Enables the 3-wire SPI itnerface when enabled.

See chapter 6.3 in the datasheet for details.

Example
use bme280_multibus::Config;

let mut cfg: Config = Config::default();
assert_eq!(cfg.spi3w_en(), false);
cfg = cfg.set_spi3w_en(true);
assert_eq!(cfg.spi3w_en(), true);
cfg = cfg.set_spi3w_en(false);
assert_eq!(cfg.spi3w_en(), false);

Returns true if 3-wire SPI is enabled.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.