pub struct AnalogInput { /* fields omitted */ }
An analog input on the RoboRIO
Create a new analog input on the specified channel, returning an error if initialization
fails.
Returns Err(HalError(0))
if the channel is invalid.
Read a value from the analog input.
Read the average value of the analog input over some defined time period.
Read the raw value of the analog input in volts.
Read the average raw value of the analog input in volts over some defined time period.
Get the channel number for this analog input.
Set the number of bits to use in averaging. Averaging will sample 2^bits actual reads.
Get the previously-set number of average bits.
Set the number of bits to use in oversampling to improve resolution with a slower rate.
Oversampling will use 2^bits actual reads.
Get the previously-set number of oversample bits.
Get the factory scaling LSB weight constant:
voltage = ((lsb_weight * 1e-9) * raw) - (offset * 1e-9)
Get the factory scaling offset constant:
voltage = ((lsb_weight * 1e-9) * raw) - (offset * 1e-9)
Returns true if this analog input is attached to an accumulator
Initialize an accumulator on this channel.
Set the offset for the accumulator.
Reset the accumulator and wait for the next sample.
This blocks until new values are potentially available.
Set the center of the accumulator. This value will be subtracted from all accumulated
reads.
Set the deadband for the accumulator. Anything within deadband
of the accumulator center
will be ignored in the accumulator.
Get a value from the accumulator.
Get the number of accumulated values.
Read the accumulator's value and the count of samples at the same time.
Returns a tuple of (value, count)
.
Set the sample rate for analog inputs.
Get the sample rate for analog inputs.
Executes the destructor for this type. Read more
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static