[−][src]Struct am2320::Am2320
Sensor configuration
Methods
impl<I2C, Delay, E> Am2320<I2C, Delay> where
I2C: Read<Error = E> + Write<Error = E>,
Delay: DelayUs<u16>,
[src]
I2C: Read<Error = E> + Write<Error = E>,
Delay: DelayUs<u16>,
pub fn new(device: I2C, delay: Delay) -> Self
[src]
Create a AM2320 temperature sensor driver.
Example with rppal
:
ⓘThis example is not tested
use am2320::*; use rppal::{hal::Delay, i2c::I2c}; fn main() -> Result<(), Error> { let device = I2c::new().expect("could not initialize I2c on your RPi"); let delay = Delay::new(); let mut am2320 = Am2320::new(device, delay); println!("{:?}", am2320.read()); Ok(()) }
pub fn read(&mut self) -> Result<Measurement, Error>
[src]
Reads one Measurement
from the sensor
The operation is blocking, and should take ~3 ms according the spec. This is because the sensor goes into sleep and has to be waken up first. Then it'll wait a while before sending data in-order for the measurement to be more accurate.
Auto Trait Implementations
impl<I2C, Delay> Unpin for Am2320<I2C, Delay> where
Delay: Unpin,
I2C: Unpin,
Delay: Unpin,
I2C: Unpin,
impl<I2C, Delay> Send for Am2320<I2C, Delay> where
Delay: Send,
I2C: Send,
Delay: Send,
I2C: Send,
impl<I2C, Delay> Sync for Am2320<I2C, Delay> where
Delay: Sync,
I2C: Sync,
Delay: Sync,
I2C: Sync,
Blanket Implementations
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,