Struct aht20_driver::AHT20
source · [−]Expand description
An AHT20 sensor on the I2C bus I
.
The address of the sensor will be SENSOR_ADDRESS
from this package, unless there is some kind
of special address translating hardware in use.
Implementations
sourceimpl<E, I> AHT20<I> where
I: Read<Error = E> + Write<Error = E>,
impl<E, I> AHT20<I> where
I: Read<Error = E> + Write<Error = E>,
sourcepub fn new(i2c: I, address: u8) -> Self
pub fn new(i2c: I, address: u8) -> Self
Initializes the SCD30 driver.
This consumes the I2C bus I
. Before you can get temperature and humidity measurements,
you must call the init
method which calibrates the sensor. The address will almost always
be SENSOR_ADDRESS
from this crate.
sourcepub fn init(
&mut self,
delay: &mut impl DelayUs<u16> + DelayMs<u16>
) -> Result<AHT20Initialized<'_, I>, Error<E>>
pub fn init(
&mut self,
delay: &mut impl DelayUs<u16> + DelayMs<u16>
) -> Result<AHT20Initialized<'_, I>, Error<E>>
Run the AHT20 init and calibration routines.
This must be called before any other methods except check_status
. This method will take
at least 40ms to return.
Start (Power on)
│
▼
Wait 40 ms
│
▼
Command::CheckStatus (0x71) ◄─── Wait 10 ms
│ ▲
▼ │
Status::Calibrated ──► No ──► Command::Initialize (0xBE)
│
▼
Yes
Auto Trait Implementations
impl<I> RefUnwindSafe for AHT20<I> where
I: RefUnwindSafe,
impl<I> Send for AHT20<I> where
I: Send,
impl<I> Sync for AHT20<I> where
I: Sync,
impl<I> Unpin for AHT20<I> where
I: Unpin,
impl<I> UnwindSafe for AHT20<I> where
I: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more