Struct bme280_multibus::CtrlMeas
source · [−]pub struct CtrlMeas(_);Expand description
Measurement control register.
This configures the pressure and temperature data acquisition options of the device.
Implementations
sourceimpl CtrlMeas
impl CtrlMeas
sourcepub const fn reset() -> CtrlMeas
pub const fn reset() -> CtrlMeas
Get the reset value of the ctrl_meas register.
Example
use bme280_multibus::CtrlMeas;
assert_eq!(CtrlMeas::reset(), CtrlMeas::default());sourcepub const fn set_osrs_t(self, os: Oversampling) -> CtrlMeas
pub const fn set_osrs_t(self, os: Oversampling) -> CtrlMeas
Set the oversampling for temperature data.
See Oversampling for settings, and chapter 3.4.3 in the datasheet
for details.
Example
use bme280_multibus::{CtrlMeas, Oversampling};
let mut ctrl_meas: CtrlMeas = CtrlMeas::default();
assert_eq!(ctrl_meas.osrs_t(), Oversampling::default());
ctrl_meas = ctrl_meas.set_osrs_t(Oversampling::Skip);
assert_eq!(ctrl_meas.osrs_t(), Oversampling::Skip);
ctrl_meas = ctrl_meas.set_osrs_t(Oversampling::X1);
assert_eq!(ctrl_meas.osrs_t(), Oversampling::X1);
ctrl_meas = ctrl_meas.set_osrs_t(Oversampling::X2);
assert_eq!(ctrl_meas.osrs_t(), Oversampling::X2);
ctrl_meas = ctrl_meas.set_osrs_t(Oversampling::X4);
assert_eq!(ctrl_meas.osrs_t(), Oversampling::X4);
ctrl_meas = ctrl_meas.set_osrs_t(Oversampling::X8);
assert_eq!(ctrl_meas.osrs_t(), Oversampling::X8);
ctrl_meas = ctrl_meas.set_osrs_t(Oversampling::X16);
assert_eq!(ctrl_meas.osrs_t(), Oversampling::X16);sourcepub const fn osrs_t(&self) -> Oversampling
pub const fn osrs_t(&self) -> Oversampling
Get the temperature data oversampling.
sourcepub const fn set_osrs_p(self, os: Oversampling) -> CtrlMeas
pub const fn set_osrs_p(self, os: Oversampling) -> CtrlMeas
Set the oversampling for pressure data.
See Oversampling for settings, and chapter 3.4.2 in the datasheet
for details.
Example
use bme280_multibus::{CtrlMeas, Oversampling};
let mut ctrl_meas: CtrlMeas = CtrlMeas::default();
assert_eq!(ctrl_meas.osrs_p(), Oversampling::default());
ctrl_meas = ctrl_meas.set_osrs_p(Oversampling::Skip);
assert_eq!(ctrl_meas.osrs_p(), Oversampling::Skip);
ctrl_meas = ctrl_meas.set_osrs_p(Oversampling::X1);
assert_eq!(ctrl_meas.osrs_p(), Oversampling::X1);
ctrl_meas = ctrl_meas.set_osrs_p(Oversampling::X2);
assert_eq!(ctrl_meas.osrs_p(), Oversampling::X2);
ctrl_meas = ctrl_meas.set_osrs_p(Oversampling::X4);
assert_eq!(ctrl_meas.osrs_p(), Oversampling::X4);
ctrl_meas = ctrl_meas.set_osrs_p(Oversampling::X8);
assert_eq!(ctrl_meas.osrs_p(), Oversampling::X8);
ctrl_meas = ctrl_meas.set_osrs_p(Oversampling::X16);
assert_eq!(ctrl_meas.osrs_p(), Oversampling::X16);sourcepub const fn osrs_p(&self) -> Oversampling
pub const fn osrs_p(&self) -> Oversampling
Get the pressure data oversampling.
sourcepub const fn set_mode(self, m: Mode) -> CtrlMeas
pub const fn set_mode(self, m: Mode) -> CtrlMeas
Set the sensor mode for the device.
See Mode for setting, and chapter 3.3 in the datasheet for details.
Example
use bme280_multibus::{CtrlMeas, Mode};
let mut ctrl_meas: CtrlMeas = CtrlMeas::default();
assert_eq!(ctrl_meas.mode(), Mode::default());
ctrl_meas = ctrl_meas.set_mode(Mode::Sleep);
assert_eq!(ctrl_meas.mode(), Mode::Sleep);
ctrl_meas = ctrl_meas.set_mode(Mode::Forced);
assert_eq!(ctrl_meas.mode(), Mode::Forced);
ctrl_meas = ctrl_meas.set_mode(Mode::Normal);
assert_eq!(ctrl_meas.mode(), Mode::Normal);Trait Implementations
impl Copy for CtrlMeas
impl Eq for CtrlMeas
impl StructuralEq for CtrlMeas
impl StructuralPartialEq for CtrlMeas
Auto Trait Implementations
impl RefUnwindSafe for CtrlMeas
impl Send for CtrlMeas
impl Sync for CtrlMeas
impl Unpin for CtrlMeas
impl UnwindSafe for CtrlMeas
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more