pub struct CtrlMeas(/* private fields */);Expand description
Measurement control register.
This configures the pressure and temperature data acquisition options of the device.
Implementations§
Source§impl CtrlMeas
impl CtrlMeas
Sourcepub const RESET: Self
pub const RESET: Self
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 StructuralPartialEq for CtrlMeas
Auto Trait Implementations§
impl Freeze for CtrlMeas
impl RefUnwindSafe for CtrlMeas
impl Send for CtrlMeas
impl Sync for CtrlMeas
impl Unpin for CtrlMeas
impl UnwindSafe for CtrlMeas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more