mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[hal,wpilib] Remove a ton of things related to the FPGA (#7846)
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
This commit is contained in:
@@ -51,52 +51,15 @@ class AnalogInput : public wpi::util::Sendable,
|
||||
*/
|
||||
int GetValue() const;
|
||||
|
||||
/**
|
||||
* Get a sample from the output of the oversample and average engine for this
|
||||
* channel.
|
||||
*
|
||||
* The sample is 12-bit + the bits configured in SetOversampleBits().
|
||||
* The value configured in SetAverageBits() will cause this value to be
|
||||
* averaged 2**bits number of samples.
|
||||
*
|
||||
* This is not a sliding window. The sample will not change until
|
||||
* 2**(OversampleBits + AverageBits) samples have been acquired from the
|
||||
* module on this channel.
|
||||
*
|
||||
* Use GetAverageVoltage() to get the analog value in calibrated units.
|
||||
*
|
||||
* @return A sample from the oversample and average engine for this channel.
|
||||
*/
|
||||
int GetAverageValue() const;
|
||||
|
||||
/**
|
||||
* Get a scaled sample straight from this channel.
|
||||
*
|
||||
* The value is scaled to units of Volts using the calibrated scaling data
|
||||
* from GetLSBWeight() and GetOffset().
|
||||
* The value is scaled to units of Volts.
|
||||
*
|
||||
* @return A scaled sample straight from this channel.
|
||||
*/
|
||||
double GetVoltage() const;
|
||||
|
||||
/**
|
||||
* Get a scaled sample from the output of the oversample and average engine
|
||||
* for this channel.
|
||||
*
|
||||
* The value is scaled to units of Volts using the calibrated scaling data
|
||||
* from GetLSBWeight() and GetOffset().
|
||||
*
|
||||
* Using oversampling will cause this value to be higher resolution, but it
|
||||
* will update more slowly.
|
||||
*
|
||||
* Using averaging will cause this value to be more stable, but it will update
|
||||
* more slowly.
|
||||
*
|
||||
* @return A scaled sample from the output of the oversample and average
|
||||
* engine for this channel.
|
||||
*/
|
||||
double GetAverageVoltage() const;
|
||||
|
||||
/**
|
||||
* Get the channel number.
|
||||
*
|
||||
@@ -104,88 +67,6 @@ class AnalogInput : public wpi::util::Sendable,
|
||||
*/
|
||||
int GetChannel() const;
|
||||
|
||||
/**
|
||||
* Set the number of averaging bits.
|
||||
*
|
||||
* This sets the number of averaging bits. The actual number of averaged
|
||||
* samples is 2^bits.
|
||||
*
|
||||
* Use averaging to improve the stability of your measurement at the expense
|
||||
* of sampling rate. The averaging is done automatically in the FPGA.
|
||||
*
|
||||
* @param bits Number of bits of averaging.
|
||||
*/
|
||||
void SetAverageBits(int bits);
|
||||
|
||||
/**
|
||||
* Get the number of averaging bits previously configured.
|
||||
*
|
||||
* This gets the number of averaging bits from the FPGA. The actual number of
|
||||
* averaged samples is 2^bits. The averaging is done automatically in the
|
||||
* FPGA.
|
||||
*
|
||||
* @return Number of bits of averaging previously configured.
|
||||
*/
|
||||
int GetAverageBits() const;
|
||||
|
||||
/**
|
||||
* Set the number of oversample bits.
|
||||
*
|
||||
* This sets the number of oversample bits. The actual number of oversampled
|
||||
* values is 2^bits. Use oversampling to improve the resolution of your
|
||||
* measurements at the expense of sampling rate. The oversampling is done
|
||||
* automatically in the FPGA.
|
||||
*
|
||||
* @param bits Number of bits of oversampling.
|
||||
*/
|
||||
void SetOversampleBits(int bits);
|
||||
|
||||
/**
|
||||
* Get the number of oversample bits previously configured.
|
||||
*
|
||||
* This gets the number of oversample bits from the FPGA. The actual number of
|
||||
* oversampled values is 2^bits. The oversampling is done automatically in the
|
||||
* FPGA.
|
||||
*
|
||||
* @return Number of bits of oversampling previously configured.
|
||||
*/
|
||||
int GetOversampleBits() const;
|
||||
|
||||
/**
|
||||
* Get the factory scaling least significant bit weight constant.
|
||||
*
|
||||
* Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
|
||||
*
|
||||
* @return Least significant bit weight.
|
||||
*/
|
||||
int GetLSBWeight() const;
|
||||
|
||||
/**
|
||||
* Get the factory scaling offset constant.
|
||||
*
|
||||
* Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
|
||||
*
|
||||
* @return Offset constant.
|
||||
*/
|
||||
int GetOffset() const;
|
||||
|
||||
/**
|
||||
* Set the sample rate per channel for all analog channels.
|
||||
*
|
||||
* The maximum rate is 500kS/s divided by the number of channels in use.
|
||||
* This is 62500 samples/s per channel.
|
||||
*
|
||||
* @param samplesPerSecond The number of samples per second.
|
||||
*/
|
||||
static void SetSampleRate(double samplesPerSecond);
|
||||
|
||||
/**
|
||||
* Get the current sample rate for all channels
|
||||
*
|
||||
* @return Sample rate.
|
||||
*/
|
||||
static double GetSampleRate();
|
||||
|
||||
/**
|
||||
* Indicates this input is used by a simulated device.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user