WPILibC++  unspecified
DoubleSolenoid.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <HAL/Types.h>
11 
12 #include "SolenoidBase.h"
13 
14 namespace frc {
15 
23 class DoubleSolenoid : public SolenoidBase {
24  public:
25  enum Value { kOff, kForward, kReverse };
26 
27  explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
28  DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
29  ~DoubleSolenoid() override;
30  virtual void Set(Value value);
31  virtual Value Get() const;
32  bool IsFwdSolenoidBlackListed() const;
33  bool IsRevSolenoidBlackListed() const;
34 
35  void InitSendable(SendableBuilder& builder) override;
36 
37  private:
38  int m_forwardChannel; // The forward channel on the module to control.
39  int m_reverseChannel; // The reverse channel on the module to control.
40  int m_forwardMask; // The mask for the forward channel.
41  int m_reverseMask; // The mask for the reverse channel.
42  HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle;
43  HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle;
44 };
45 
46 } // namespace frc
Definition: RobotController.cpp:14
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:19
~DoubleSolenoid() override
Destructor.
Definition: DoubleSolenoid.cpp:98
DoubleSolenoid class for running 2 channels of high voltage Digital Output (PCM). ...
Definition: DoubleSolenoid.h:23
virtual Value Get() const
Read the current value of the solenoid.
Definition: DoubleSolenoid.cpp:141
bool IsRevSolenoidBlackListed() const
Check if the reverse solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:179
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Definition: DoubleSolenoid.cpp:184
DoubleSolenoid(int forwardChannel, int reverseChannel)
Constructor.
Definition: DoubleSolenoid.cpp:28
virtual void Set(Value value)
Set the value of a solenoid.
Definition: DoubleSolenoid.cpp:108
Definition: SendableBuilder.h:23
bool IsFwdSolenoidBlackListed() const
Check if the forward solenoid is blacklisted.
Definition: DoubleSolenoid.cpp:165