mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[hal] [wpilib] Add initial support for the REV PDH (#3503)
This commit is contained in:
@@ -17,10 +17,13 @@ namespace frc {
|
||||
class PowerDistribution : public wpi::Sendable,
|
||||
public wpi::SendableHelper<PowerDistribution> {
|
||||
public:
|
||||
static constexpr int kDefaultModule = -1;
|
||||
enum class ModuleType { kAutomatic = 0, kCTRE = 1, kRev = 2 };
|
||||
|
||||
/**
|
||||
* Constructs a PowerDistribution.
|
||||
*
|
||||
* Uses the default CAN ID (0).
|
||||
* Uses the default CAN ID.
|
||||
*/
|
||||
PowerDistribution();
|
||||
|
||||
@@ -28,9 +31,11 @@ class PowerDistribution : public wpi::Sendable,
|
||||
* Constructs a PowerDistribution.
|
||||
*
|
||||
* @param module The CAN ID of the PDP
|
||||
* @param moduleType The type of module
|
||||
*/
|
||||
explicit PowerDistribution(int module);
|
||||
PowerDistribution(int module, ModuleType moduleType);
|
||||
|
||||
~PowerDistribution() override;
|
||||
PowerDistribution(PowerDistribution&&) = default;
|
||||
PowerDistribution& operator=(PowerDistribution&&) = default;
|
||||
|
||||
@@ -93,10 +98,14 @@ class PowerDistribution : public wpi::Sendable,
|
||||
*/
|
||||
int GetModule() const;
|
||||
|
||||
bool GetSwitchableChannel() const;
|
||||
|
||||
void SetSwitchableChannel(bool enabled);
|
||||
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
hal::Handle<HAL_PDPHandle> m_handle;
|
||||
hal::Handle<HAL_PowerDistributionHandle> m_handle;
|
||||
int m_module;
|
||||
};
|
||||
|
||||
|
||||
@@ -71,29 +71,11 @@ class SensorUtil final {
|
||||
*/
|
||||
static bool CheckAnalogOutputChannel(int channel);
|
||||
|
||||
/**
|
||||
* Verify that the power distribution channel number is within limits.
|
||||
*
|
||||
* @return PDP channel is valid
|
||||
*/
|
||||
static bool CheckPDPChannel(int channel);
|
||||
|
||||
/**
|
||||
* Verify that the PDP module number is within limits. module numbers are
|
||||
* 0-based
|
||||
*
|
||||
* @return PDP module is valid
|
||||
*/
|
||||
static bool CheckPDPModule(int module);
|
||||
|
||||
static const int kDigitalChannels;
|
||||
static const int kAnalogInputs;
|
||||
static const int kAnalogOutputs;
|
||||
static const int kSolenoidChannels;
|
||||
static const int kSolenoidModules;
|
||||
static const int kPwmChannels;
|
||||
static const int kRelayChannels;
|
||||
static const int kPDPChannels;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -142,7 +142,7 @@ class PowerDistributionSim {
|
||||
* array must be big enough to hold all the PowerDistribution
|
||||
* channels
|
||||
*/
|
||||
void GetAllCurrents(double* currents) const;
|
||||
void GetAllCurrents(double* currents, int length) const;
|
||||
|
||||
/**
|
||||
* Change the current in all of the PowerDistribution channels.
|
||||
@@ -151,7 +151,7 @@ class PowerDistributionSim {
|
||||
* array must be big enough to hold all the PowerDistribution
|
||||
* channels
|
||||
*/
|
||||
void SetAllCurrents(const double* currents);
|
||||
void SetAllCurrents(const double* currents, int length);
|
||||
|
||||
/**
|
||||
* Reset all PowerDistribution simulation data.
|
||||
|
||||
Reference in New Issue
Block a user