[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:
Thad House
2026-04-17 19:38:25 -07:00
committed by GitHub
parent fdb454a6b1
commit 6cb6903780
73 changed files with 69 additions and 1834 deletions

View File

@@ -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.
*

View File

@@ -16,12 +16,7 @@ namespace wpi {
class AddressableLED;
/**
* Class implements the PWM generation in the FPGA.
*
* The values supplied as arguments for PWM outputs range from -1.0 to 1.0. They
* are mapped to the microseconds to keep the pulse high, with a range of 0
* (off) to 4096. Changes are immediately sent to the FPGA, and the update
* occurs at the next FPGA cycle (5.05ms). There is no delay.
* Class for sending pulse-width modulation (PWM) signals.
*/
class PWM : public wpi::util::Sendable, public wpi::util::SendableHelper<PWM> {
public:

View File

@@ -59,58 +59,6 @@ class AnalogInputSim {
*/
void SetInitialized(bool initialized);
/**
* Register a callback on the number of average bits.
*
* @param callback the callback that will be called whenever the number of
* average bits is changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAverageBitsCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the number of average bits.
*
* @return the number of average bits
*/
int GetAverageBits() const;
/**
* Change the number of average bits.
*
* @param averageBits the new value
*/
void SetAverageBits(int averageBits);
/**
* Register a callback on the amount of oversampling bits.
*
* @param callback the callback that will be called whenever the oversampling
* bits are changed
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterOversampleBitsCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the amount of oversampling bits.
*
* @return the amount of oversampling bits
*/
int GetOversampleBits() const;
/**
* Change the amount of oversampling bits.
*
* @param oversampleBits the new value
*/
void SetOversampleBits(int oversampleBits);
/**
* Register a callback on the voltage.
*

View File

@@ -9,12 +9,9 @@ namespace wpi {
* Runtime type.
*/
enum class RuntimeType {
/// roboRIO 1.0.
ROBORIO,
/// roboRIO 2.0.
ROBORIO_2,
/// Systemcore runtime.
SYSTEMCORE,
/// Simulation runtime.
SIMULATION,
SYSTEMCORE
SIMULATION
};
} // namespace wpi

View File

@@ -28,39 +28,7 @@ class SensorUtil final {
*/
static int GetDefaultREVPHModule();
/**
* Check that the digital channel number is valid.
*
* Verify that the channel number is one of the legal channel numbers. Channel
* numbers are 0-based.
*
* @return Digital channel is valid
*/
static bool CheckDigitalChannel(int channel);
/**
* Check that the PWM channel number is valid.
*
* Verify that the channel number is one of the legal channel numbers. Channel
* numbers are 0-based.
*
* @return PWM channel is valid
*/
static bool CheckPWMChannel(int channel);
/**
* Check that the analog input number is value.
*
* Verify that the analog input number is one of the legal channel numbers.
* Channel numbers are 0-based.
*
* @return Analog channel is valid
*/
static bool CheckAnalogInputChannel(int channel);
static int GetNumDigitalChannels();
static int GetNumAnalogInputs();
static int GetNumPwmChannels();
static int GetNumSmartIoPorts();
};
} // namespace wpi