AdiUltrasonic

Struct AdiUltrasonic 

Source
pub struct AdiUltrasonic { /* private fields */ }
Expand description

Represents a V5 ADI port pair configured as an ultrasonic sensor.

Implementations§

Source§

impl AdiUltrasonic

Source

pub unsafe fn new( out_port: u8, in_port: u8, smart_port: u8, ) -> Result<Self, AdiUltrasonicError>

Initializes an ultrasonic sensor on two ADI ports.

§Safety

This function is unsafe because it allows the user to create multiple mutable references to the same ADI ultrasonic sensor. You likely want to implement Robot::new() instead.

Source

pub fn get(&self) -> Result<u32, AdiUltrasonicError>

Gets the current value of the ultrasonic sensor.

Trait Implementations§

Source§

impl DataSource for AdiUltrasonic

Source§

type Data = u32

The type of data produced by the data source.
Source§

type Error = AdiUltrasonicError

The type of errors which could occur while reading data.
Source§

fn read(&self) -> Result<Self::Data, Self::Error>

Tries to read a new value form the data source.
Source§

impl Drop for AdiUltrasonic

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl TryFrom<(AdiPort, AdiPort)> for AdiUltrasonic

Source§

type Error = AdiUltrasonicError

The type returned in the event of a conversion error.
Source§

fn try_from(ports: (AdiPort, AdiPort)) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoBroadcast for T
where T: DataSource,

Source§

fn into_broadcast( self, ) -> Result<BroadcastWrapper<T>, (<T as DataSource>::Error, T)>

Converts the data source into a BroadcastWrapper. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.