pub struct SensorIOCtx {
    io: SensorIO,
    bridge_gpio: Option<BridgeGPIO>,
    i2cdev: Option<Arc<I2CDevice>>,
    next_update: Box<dyn FnMut(&Sensor) -> BoxFuture<'static, ()> + Send + Sync>,
}
Expand description

A SensorIO plus some surrounding context.

Fields

io: SensorIO

The sensor I/O mechanism.

bridge_gpio: Option<BridgeGPIO>

A GPIO that must be asserted before reading the sensor.

i2cdev: Option<Arc<I2CDevice>>

A reference to an I2C device associated with the sensor.

next_update: Box<dyn FnMut(&Sensor) -> BoxFuture<'static, ()> + Send + Sync>

Function returning a future to await before performing an update of the sensor’s value.

Implementations

Create a new sensor I/O context from a given I/O mechanism.

Add a BridgeGPIO to a sensor I/O context.

Add an I2CDevice to a sensor I/O context.

Replace the default (periodic polling) next_update function of a sensor I/O context.

Take a sample from the sensor, asserting its bridge GPIO if required.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.