Struct vex_rt::adi::AdiEncoder
source · [−]pub struct AdiEncoder { /* private fields */ }
Expand description
A struct which represents a V5 ADI port configured as an ADI encoder.
Implementations
sourceimpl AdiEncoder
impl AdiEncoder
sourcepub unsafe fn new(
top_port: u8,
bottom_port: u8,
reverse: bool,
extender_port: u8
) -> Result<AdiEncoder, AdiEncoderError>
pub unsafe fn new(
top_port: u8,
bottom_port: u8,
reverse: bool,
extender_port: u8
) -> Result<AdiEncoder, AdiEncoderError>
Initializes and enables a quadrature encoder on two ADI ports.
Safety
This function is unsafe because it allows the user to create multiple
mutable references to the same ADI encoder. You likely want to
implement Robot::new()
instead.
sourcepub fn reset(&mut self) -> Result<(), AdiEncoderError>
pub fn reset(&mut self) -> Result<(), AdiEncoderError>
Resets the encoder to zero. It is safe to use this method while an encoder is enabled. It is not necessary to call this method before stopping or starting an encoder.
sourcepub fn get(&self) -> Result<i32, AdiEncoderError>
pub fn get(&self) -> Result<i32, AdiEncoderError>
Gets the number of ticks recorded by the encoder. There are 360 ticks in one revolution.
Trait Implementations
sourceimpl Drop for AdiEncoder
impl Drop for AdiEncoder
sourceimpl TryFrom<(AdiPort, AdiPort)> for AdiEncoder
impl TryFrom<(AdiPort, AdiPort)> for AdiEncoder
sourcefn try_from(ports: (AdiPort, AdiPort)) -> Result<Self, Self::Error>
fn try_from(ports: (AdiPort, AdiPort)) -> Result<Self, Self::Error>
Converts an (AdiPort, AdiPort)
into an
AdiEncoder
.
type Error = AdiEncoderError
type Error = AdiEncoderError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for AdiEncoder
impl Send for AdiEncoder
impl Sync for AdiEncoder
impl Unpin for AdiEncoder
impl UnwindSafe for AdiEncoder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more