Struct dps310::DPS310

source ·
pub struct DPS310<I2C> { /* private fields */ }

Implementations§

source§

impl<I2C, I2CError> DPS310<I2C>where I2C: WriteRead<Error = I2CError> + Write<Error = I2CError>,

source

pub fn new( i2c: I2C, address: u8, config: &Config ) -> Result<Self, Error<I2CError>>

source

pub fn read_status(&mut self) -> Result<u8, Error<I2CError>>

Read status bits from MEAS_CFG reg. MEAS_CFG register is masked with 0xF0

source

pub fn get_product_id(&mut self) -> Result<u8, Error<I2CError>>

Returns the product ID from PROD_ID register. This value is expected to be 0x1D

source

pub fn trigger_measurement( &mut self, temp: bool, pres: bool, continuous: bool ) -> Result<(), Error<I2CError>>

Start a single or continuous measurement for pressure or temperature

source

pub fn coef_ready(&mut self) -> Result<bool, Error<I2CError>>

Returns true if sensor coeficients are available

source

pub fn init_complete(&mut self) -> Result<bool, Error<I2CError>>

Returns true if sensor initialized and ready to take measurements

source

pub fn temp_ready(&mut self) -> Result<bool, Error<I2CError>>

Returns true if temperature measurement is ready

source

pub fn pres_ready(&mut self) -> Result<bool, Error<I2CError>>

Returns true if pressure measurement is ready

source

pub fn read_temp_calibrated(&mut self) -> Result<f32, Error<I2CError>>

Read calibrated temperature data in degrees Celsius.

This method uses the pre calculated constants based on the calibration coefficients which have to be initialized with Self::read_calibration_coefficients() beforehand.

See section 4.9.2 in the datasheet (formula), Sec 8.11 (coefficients)

source

pub fn read_pressure_raw(&mut self) -> Result<i32, Error<I2CError>>

Read raw pressure contents

source

pub fn read_pressure_calibrated(&mut self) -> Result<f32, Error<I2CError>>

Read calibrated pressure data in Pa.

This method uses the pre calculated constants based on the calibration coefficients which have to be initialized with Self::read_calibration_coefficients() beforehand.

See section 8.11 in the datasheet. See section 4.9.1 for calculation method.

source

pub fn reset(&mut self) -> Result<(), Error<I2CError>>

Issue a full reset and fifo flush

source

pub fn read_calibration_coefficients(&mut self) -> Result<(), Error<I2CError>>

Read calibration coefficients. User must wait for Self::coef_ready() to return true before reading coefficients.

Taken from official Arduino library, see https://github.com/Infineon/DPS310-Pressure-Sensor/blob/888200c7efd8edb19ce69a2144e28ba31cdad449/src/Dps310.cpp#L89

See Sec 8.11

Auto Trait Implementations§

§

impl<I2C> RefUnwindSafe for DPS310<I2C>where I2C: RefUnwindSafe,

§

impl<I2C> Send for DPS310<I2C>where I2C: Send,

§

impl<I2C> Sync for DPS310<I2C>where I2C: Sync,

§

impl<I2C> Unpin for DPS310<I2C>where I2C: Unpin,

§

impl<I2C> UnwindSafe for DPS310<I2C>where I2C: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.