mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[hal] Add a unified PCM object (#3331)
This commit is contained in:
@@ -4,9 +4,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <hal/Types.h>
|
||||
|
||||
#include "frc/SolenoidBase.h"
|
||||
#include "frc/PneumaticsBase.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
@@ -21,30 +23,16 @@ class SendableBuilder;
|
||||
* The DoubleSolenoid class is typically used for pneumatics solenoids that
|
||||
* have two positions controlled by two separate channels.
|
||||
*/
|
||||
class DoubleSolenoid : public SolenoidBase,
|
||||
public Sendable,
|
||||
public SendableHelper<DoubleSolenoid> {
|
||||
class DoubleSolenoid : public Sendable, public SendableHelper<DoubleSolenoid> {
|
||||
public:
|
||||
enum Value { kOff, kForward, kReverse };
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Uses the default PCM ID of 0.
|
||||
*
|
||||
* @param forwardChannel The forward channel number on the PCM (0..7).
|
||||
* @param reverseChannel The reverse channel number on the PCM (0..7).
|
||||
*/
|
||||
explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param moduleNumber The CAN ID of the PCM.
|
||||
* @param forwardChannel The forward channel on the PCM to control (0..7).
|
||||
* @param reverseChannel The reverse channel on the PCM to control (0..7).
|
||||
*/
|
||||
DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
|
||||
DoubleSolenoid(PneumaticsBase& module, int forwardChannel,
|
||||
int reverseChannel);
|
||||
DoubleSolenoid(PneumaticsBase* module, int forwardChannel,
|
||||
int reverseChannel);
|
||||
DoubleSolenoid(std::shared_ptr<PneumaticsBase> module, int forwardChannel,
|
||||
int reverseChannel);
|
||||
|
||||
~DoubleSolenoid() override;
|
||||
|
||||
@@ -89,26 +77,26 @@ class DoubleSolenoid : public SolenoidBase,
|
||||
int GetRevChannel() const;
|
||||
|
||||
/**
|
||||
* Check if the forward solenoid is blacklisted.
|
||||
* Check if the forward solenoid is Disabled.
|
||||
*
|
||||
* If a solenoid is shorted, it is added to the blacklist and disabled until
|
||||
* power cycle, or until faults are cleared.
|
||||
* If a solenoid is shorted, it is added to the DisabledList and disabled
|
||||
* until power cycle, or until faults are cleared.
|
||||
*
|
||||
* @see ClearAllPCMStickyFaults()
|
||||
* @return If solenoid is disabled due to short.
|
||||
*/
|
||||
bool IsFwdSolenoidBlackListed() const;
|
||||
bool IsFwdSolenoidDisabled() const;
|
||||
|
||||
/**
|
||||
* Check if the reverse solenoid is blacklisted.
|
||||
* Check if the reverse solenoid is Disabled.
|
||||
*
|
||||
* If a solenoid is shorted, it is added to the blacklist and disabled until
|
||||
* power cycle, or until faults are cleared.
|
||||
* If a solenoid is shorted, it is added to the DisabledList and disabled
|
||||
* until power cycle, or until faults are cleared.
|
||||
*
|
||||
* @see ClearAllPCMStickyFaults()
|
||||
* @return If solenoid is disabled due to short.
|
||||
*/
|
||||
bool IsRevSolenoidBlackListed() const;
|
||||
bool IsRevSolenoidDisabled() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
@@ -117,8 +105,8 @@ class DoubleSolenoid : public SolenoidBase,
|
||||
int m_reverseChannel; // The reverse channel on the module to control.
|
||||
int m_forwardMask; // The mask for the forward channel.
|
||||
int m_reverseMask; // The mask for the reverse channel.
|
||||
hal::Handle<HAL_SolenoidHandle> m_forwardHandle;
|
||||
hal::Handle<HAL_SolenoidHandle> m_reverseHandle;
|
||||
int m_mask;
|
||||
std::shared_ptr<PneumaticsBase> m_module;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
Reference in New Issue
Block a user