OneshotSensorAsync

Trait OneshotSensorAsync 

Source
pub trait OneshotSensorAsync {
    type Error: Debug;
    type Measurement: Measurement;

    // Required method
    async fn measure(&mut self) -> Result<Self::Measurement, Self::Error>;
}
Expand description

A sensor supporting one-shot measurements.

If the hardware device itself doesn’t support one-shot measurements but they can be meaningfully emulated by starting and stopping continuous measurements without drawbacks, it may also implement this trait. If the sensor requires a certain amount of time in continuous measurement mode to yield meaningful results, this trait should not be implemented.

Required Associated Types§

Source

type Error: Debug

The error type which may occur on associated functions

Source

type Measurement: Measurement

A type holding the measurements obtained by this sensor

Required Methods§

Source

async fn measure(&mut self) -> Result<Self::Measurement, Self::Error>

Performs a one-shot measurement.

If the device supports several measurement modes, this function attempts to switch to oneshot mode on best effort. The mode in which the device is left after measurement is not specified further, but if possible, a sleep mode or equivalent mode should be preferred.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<D: DelayNs, I: CommandInterfaceAsync> OneshotSensorAsync for SCD41Async<D, I>

Source§

impl<D: DelayNs, I: CommandInterfaceAsync> OneshotSensorAsync for SCD43Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for MAX31865Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for BL0942Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for BME280CommonAsync<D, I, false>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for BME280CommonAsync<D, I, true>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for BMP390Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for MCP9808Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for INA219Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for INA226Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for INA228Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for TMP102Async<D, I>

Source§

impl<D: DelayNs, I: RegisterInterfaceAsync> OneshotSensorAsync for TMP117Async<D, I>