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§
sourcefn set_client(&self, client: &'a dyn DistanceClient)
fn set_client(&self, client: &'a dyn DistanceClient)
Set the client
sourcefn read_distance(&self) -> Result<(), ErrorCode>
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.
sourcefn get_maximum_distance(&self) -> u32
fn get_maximum_distance(&self) -> u32
Get the maximum distance the sensor can measure in mm
sourcefn get_minimum_distance(&self) -> u32
fn get_minimum_distance(&self) -> u32
Get the minimum distance the sensor can measure in mm