pub struct Hs3003<I2C> { /* private fields */ }Expand description
HS3003 temperature and humidity sensor driver
Implementations§
Source§impl<I2C, E> Hs3003<I2C>where
I2C: I2c<Error = E>,
impl<I2C, E> Hs3003<I2C>where
I2C: I2c<Error = E>,
Sourcepub fn new_with_address(i2c: I2C, address: u8) -> Self
pub fn new_with_address(i2c: I2C, address: u8) -> Self
Sourcepub fn read<D>(&mut self, delay: &mut D) -> Result<Measurement, Error<E>>where
D: DelayNs,
pub fn read<D>(&mut self, delay: &mut D) -> Result<Measurement, Error<E>>where
D: DelayNs,
Triggers a measurement and reads temperature and humidity
This function:
- Sends a measurement request to the sensor
- Waits for the measurement to complete (100ms)
- Reads the raw data from the sensor
- Converts the raw data to temperature and humidity values
§Arguments
delay- A delay provider implementingembedded_hal::delay::DelayNs
§Returns
A Result containing a Measurement with temperature and humidity values,
or an Error if the operation fails.
§Example
let mut sensor = Hs3003::new(i2c);
let measurement = sensor.read(&mut delay)?;
// Use measurement.temperature and measurement.humidityTrait Implementations§
Auto Trait Implementations§
impl<I2C> Freeze for Hs3003<I2C>where
I2C: Freeze,
impl<I2C> RefUnwindSafe for Hs3003<I2C>where
I2C: RefUnwindSafe,
impl<I2C> Send for Hs3003<I2C>where
I2C: Send,
impl<I2C> Sync for Hs3003<I2C>where
I2C: Sync,
impl<I2C> Unpin for Hs3003<I2C>where
I2C: Unpin,
impl<I2C> UnwindSafe for Hs3003<I2C>where
I2C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more