Skip to main content

Measurement

Struct Measurement 

Source
pub struct Measurement {
    pub pressure: u32,
    pub temperature: u32,
}
Expand description

The raw, uncompensated 20-bit codes from the BMP280 data registers.

Fields§

§pressure: u32

The 20-bit uncompensated pressure, up[19:0].

§temperature: u32

The 20-bit uncompensated temperature, ut[19:0].

Implementations§

Source§

impl Measurement

Source

pub fn parse(data: &[u8; 6]) -> Measurement

Parses the six data bytes burst-read from 0xF7..=0xFC.

The order on the wire is pressure then temperature, each as MSB, LSB, and an XLSB byte whose upper nibble holds the last four bits.

§Arguments
  • data - the six bytes read from the data registers.
§Returns

The unpacked raw measurement.

Source

pub fn to_bytes(&self) -> [u8; 6]

Builds the six data bytes a device holding these codes would return.

§Returns

The bytes as they sit at 0xF7..=0xFC. Only the low 20 bits of each code are carried.

Source

pub fn pressure_skipped(&self) -> bool

Returns whether the pressure measurement was skipped (osrs_p = 0).

Source

pub fn temperature_skipped(&self) -> bool

Returns whether the temperature measurement was skipped (osrs_t = 0).

Trait Implementations§

Source§

impl Clone for Measurement

Source§

fn clone(&self) -> Measurement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Measurement

Source§

impl Debug for Measurement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Measurement

Source§

impl PartialEq for Measurement

Source§

fn eq(&self, other: &Measurement) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Measurement

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.