[−][src]Struct mpl3115::MPL3115A2
MPL3115A2
driver
Will start off deactivated and in the PressureAlt mode set
Methods
impl<I2C, E> MPL3115A2<I2C> where
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
[src]
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
Interrupt setting and status
pub fn new(i2c: I2C, pa: PressureAlt) -> Result<Self, Error<E>>
[src]
Create a new MPL3115A2
driver from the given I2C
peripheral
pub fn destroy(self) -> I2C
[src]
Destroy driver instance, return I2C
bus instance
pub fn get_device_id(&mut self) -> Result<u8, Error<E>>
[src]
Get the WHO_AM_I
register
pub fn activate(&mut self) -> Result<(), Error<E>>
[src]
Activate the Device
pub fn deactivate(&mut self) -> Result<(), Error<E>>
[src]
De-activate the Device
pub fn change_reading_type(&mut self, pa: PressureAlt) -> Result<(), Error<E>>
[src]
Change between altitude and pressure
pub fn take_one_pa_reading(&mut self) -> Result<f32, Error<E>>
[src]
Get one (blocking) Pressure or Altitude value
pub fn take_one_temp_reading(&mut self) -> Result<f32, Error<E>>
[src]
Get one (blocking) Temperature value
pub fn start_reading(&mut self) -> Result<(), Error<E>>
[src]
Clear then set the OST bit which causes the sensor to immediately take another reading Needed to sample faster than 1Hz
pub fn check_pa_reading(&mut self) -> Result<bool, Error<E>>
[src]
Check the PDR bit for new data
pub fn check_temp_reading(&mut self) -> Result<bool, Error<E>>
[src]
Check the TDR bit for new data
pub fn get_pa_reading(&mut self) -> Result<f32, Error<E>>
[src]
Get and process the pressure or altitude data
pub fn get_temp_reading(&mut self) -> Result<f32, Error<E>>
[src]
Get and process the temperature data
pub fn set_oversample_rate(&mut self, sample_rate: u8) -> Result<(), Error<E>>
[src]
Set the number of samples the device makes before saving the data Call with a rate from 0 to 7. Datasheet calls for 128 but you can set it from 1 to 128 samples. The higher the oversample rate the greater the time between data samples.
Example Times:
- 0 = 8ms
- 3 = 30ms
- 7 = 380ms
Auto Trait Implementations
impl<I2C> Send for MPL3115A2<I2C> where
I2C: Send,
I2C: Send,
impl<I2C> Sync for MPL3115A2<I2C> where
I2C: Sync,
I2C: Sync,
impl<I2C> Unpin for MPL3115A2<I2C> where
I2C: Unpin,
I2C: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,