[][src]Struct wpilib::AnalogInput

pub struct AnalogInput { /* fields omitted */ }

An analog input on the RoboRIO

Methods

impl AnalogInput
[src]

pub fn new(channel: i32) -> HalResult<AnalogInput>
[src]

Create a new analog input on the specified channel, returning an error if initialization fails.

Errors

Returns Err(HalError(0)) if the channel is invalid.

pub fn value(&self) -> HalResult<i32>
[src]

Read a value from the analog input.

pub fn average_value(&self) -> HalResult<i32>
[src]

Read the average value of the analog input over some defined time period.

pub fn voltage(&self) -> HalResult<f64>
[src]

Read the raw value of the analog input in volts.

pub fn average_voltage(&self) -> HalResult<f64>
[src]

Read the average raw value of the analog input in volts over some defined time period.

pub fn channel(&self) -> i32
[src]

Get the channel number for this analog input.

pub fn set_average_bits(&mut self, bits: i32) -> HalResult<()>
[src]

Set the number of bits to use in averaging. Averaging will sample 2^bits actual reads.

pub fn average_bits(&self) -> HalResult<i32>
[src]

Get the previously-set number of average bits.

pub fn set_oversample_bits(&mut self, bits: i32) -> HalResult<()>
[src]

Set the number of bits to use in oversampling to improve resolution with a slower rate. Oversampling will use 2^bits actual reads.

pub fn oversample_bits(&self) -> HalResult<i32>
[src]

Get the previously-set number of oversample bits.

pub fn lsb_weight(&self) -> HalResult<i32>
[src]

Get the factory scaling LSB weight constant: voltage = ((lsb_weight * 1e-9) * raw) - (offset * 1e-9)

pub fn offset(&self) -> HalResult<i32>
[src]

Get the factory scaling offset constant: voltage = ((lsb_weight * 1e-9) * raw) - (offset * 1e-9)

pub fn is_accumulator_channel(&self) -> HalResult<bool>
[src]

Returns true if this analog input is attached to an accumulator

pub fn init_accumulator(&mut self) -> HalResult<()>
[src]

Initialize an accumulator on this channel.

pub fn set_accumulator_offset(&mut self, value: i64)
[src]

Set the offset for the accumulator.

pub fn reset_accumulator(&mut self) -> HalResult<()>
[src]

Reset the accumulator and wait for the next sample. This blocks until new values are potentially available.

pub fn set_accumulator_center(&mut self, center: i32) -> HalResult<()>
[src]

Set the center of the accumulator. This value will be subtracted from all accumulated reads.

pub fn set_accumulator_deadband(&self, deadband: i32) -> HalResult<()>
[src]

Set the deadband for the accumulator. Anything within deadband of the accumulator center will be ignored in the accumulator.

pub fn accumulator_value(&self) -> HalResult<i64>
[src]

Get a value from the accumulator.

pub fn accumulator_count(&self) -> HalResult<i64>
[src]

Get the number of accumulated values.

pub fn accumulator_output(&self) -> HalResult<(i64, i64)>
[src]

Read the accumulator's value and the count of samples at the same time. Returns a tuple of (value, count).

pub fn set_sample_rate(samples_per_second: f64) -> HalResult<()>
[src]

Set the sample rate for analog inputs.

pub fn sample_rate() -> HalResult<f64>
[src]

Get the sample rate for analog inputs.

Trait Implementations

impl Drop for AnalogInput
[src]

impl Debug for AnalogInput
[src]

Auto Trait Implementations

impl Send for AnalogInput

impl Sync for AnalogInput

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]