[][src]Struct stemma_soil_sensor::SoilSensor

pub struct SoilSensor<D: DelayUs<u16>> { /* fields omitted */ }

Implementations

impl<D: DelayUs<u16>> SoilSensor<D>[src]

pub fn init(delay: D) -> Result<Self>[src]

Initializes the sensor

pub fn init_with_channel(delay: D, channel: I2c) -> Result<Self>[src]

Creates an instance from a pre-set channel. Useful if you want to communicate with the sensors through a multiplexer or if your sensor for some reason is not in the standard address range or needs some additional initialization before communicating with the sensor.

This method still initializes the sensor and performs the necessary checks.

pub fn get_temp(&mut self) -> Result<f32>[src]

Reads the temperature off the soil sensor. The temperature is in Celsius.

The temperature sensor is not high precision but should be indicate the temperature +/- 2 degrees.

pub fn get_capacitance(&mut self) -> Result<u16>[src]

Read the value of the moisture sensor

The values ranges from 200 (very dry) to 2000 (very wet).

Errors

This method will try to read the value from the sensors 3 times before it returns a SoilSensErr::MoistureReadErr if no read is successful.

Auto Trait Implementations

impl<D> RefUnwindSafe for SoilSensor<D> where
    D: RefUnwindSafe

impl<D> Send for SoilSensor<D> where
    D: Send

impl<D> !Sync for SoilSensor<D>

impl<D> Unpin for SoilSensor<D> where
    D: Unpin

impl<D> UnwindSafe for SoilSensor<D> where
    D: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.