pub struct DPS310<I2C> { /* private fields */ }
Implementations§
source§impl<I2C, I2CError> DPS310<I2C>where
I2C: WriteRead<Error = I2CError> + Write<Error = I2CError>,
impl<I2C, I2CError> DPS310<I2C>where I2C: WriteRead<Error = I2CError> + Write<Error = I2CError>,
pub fn new( i2c: I2C, address: u8, config: &Config ) -> Result<Self, Error<I2CError>>
sourcepub fn read_status(&mut self) -> Result<u8, Error<I2CError>>
pub fn read_status(&mut self) -> Result<u8, Error<I2CError>>
Read status bits from MEAS_CFG reg. MEAS_CFG register is masked with 0xF0
sourcepub fn get_product_id(&mut self) -> Result<u8, Error<I2CError>>
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
sourcepub fn trigger_measurement(
&mut self,
temp: bool,
pres: bool,
continuous: bool
) -> Result<(), Error<I2CError>>
pub fn trigger_measurement( &mut self, temp: bool, pres: bool, continuous: bool ) -> Result<(), Error<I2CError>>
Start a single or continuous measurement for pres
sure or temp
erature
sourcepub fn coef_ready(&mut self) -> Result<bool, Error<I2CError>>
pub fn coef_ready(&mut self) -> Result<bool, Error<I2CError>>
Returns true if sensor coeficients are available
sourcepub fn init_complete(&mut self) -> Result<bool, Error<I2CError>>
pub fn init_complete(&mut self) -> Result<bool, Error<I2CError>>
Returns true if sensor initialized and ready to take measurements
sourcepub fn temp_ready(&mut self) -> Result<bool, Error<I2CError>>
pub fn temp_ready(&mut self) -> Result<bool, Error<I2CError>>
Returns true if temperature measurement is ready
sourcepub fn pres_ready(&mut self) -> Result<bool, Error<I2CError>>
pub fn pres_ready(&mut self) -> Result<bool, Error<I2CError>>
Returns true if pressure measurement is ready
sourcepub fn read_temp_calibrated(&mut self) -> Result<f32, Error<I2CError>>
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)
sourcepub fn read_pressure_raw(&mut self) -> Result<i32, Error<I2CError>>
pub fn read_pressure_raw(&mut self) -> Result<i32, Error<I2CError>>
Read raw pressure contents
sourcepub fn read_pressure_calibrated(&mut self) -> Result<f32, Error<I2CError>>
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.
sourcepub fn read_calibration_coefficients(&mut self) -> Result<(), Error<I2CError>>
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