pub struct Encoder { /* private fields */ }Expand description
An encoder.
Uses quadrature on two separate channels to read the distance and direction travelled by a shaft. All integration is done by the FPGA.
Implementations
sourceimpl Encoder
impl Encoder
sourcepub fn new(
channel_a: i32,
channel_b: i32,
encoding: EncodingType
) -> HalResult<Encoder>
pub fn new(
channel_a: i32,
channel_b: i32,
encoding: EncodingType
) -> HalResult<Encoder>
Create a new encoder given two channels and an encoding type, returning an error if initialization fails.
sourcepub fn fpga_index(&self) -> HalResult<i32>
pub fn fpga_index(&self) -> HalResult<i32>
Get the FPGA index of this encoder.
sourcepub fn get(&self) -> HalResult<i32>
pub fn get(&self) -> HalResult<i32>
Get the current value read by this encoder, with any scaling factors applied.
sourcepub fn get_raw(&self) -> HalResult<i32>
pub fn get_raw(&self) -> HalResult<i32>
Get the raw value of this encoder, without any scaling factors.
sourcepub fn encoding_scale(&self) -> HalResult<i32>
pub fn encoding_scale(&self) -> HalResult<i32>
Get the current scaling factor for this encoder.
sourcepub fn rate(&self) -> HalResult<f64>
pub fn rate(&self) -> HalResult<f64>
Get the current (estimated) speed this encoder is travelling at.
sourcepub fn set_min_rate(&mut self, min_rate: f64) -> HalResult<()>
pub fn set_min_rate(&mut self, min_rate: f64) -> HalResult<()>
Set the minimum rate that this encoder must be moving at to be considered “moving”.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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