Trait kernel::hil::sensors::Distance

source ·
pub trait Distance<'a> {
    // Required methods
    fn set_client(&self, client: &'a dyn DistanceClient);
    fn read_distance(&self) -> Result<(), ErrorCode>;
    fn get_maximum_distance(&self) -> u32;
    fn get_minimum_distance(&self) -> u32;
}
Expand description

A basic interface for distance sensor.

Required Methods§

source

fn set_client(&self, client: &'a dyn DistanceClient)

Set the client

source

fn read_distance(&self) -> Result<(), ErrorCode>

Initiates a distance reading from the sensor.

This function might return the following errors:

  • BUSY: Indicates that the hardware is currently busy.
  • FAIL: Indicates that there was a failure in communication.
source

fn get_maximum_distance(&self) -> u32

Get the maximum distance the sensor can measure in mm

source

fn get_minimum_distance(&self) -> u32

Get the minimum distance the sensor can measure in mm

Implementors§