kernel::hil::sensors

Trait 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§