WPILibC++  2019.1.1-beta-2-30-g0d0492b
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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 "frc/SolenoidBase.h"
13 
14 namespace frc {
15 
23 class DoubleSolenoid : public SolenoidBase {
24  public:
25  enum Value { kOff, kForward, kReverse };
26 
35  explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
36 
44  DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
45 
46  ~DoubleSolenoid() override;
47 
49  DoubleSolenoid& operator=(DoubleSolenoid&& rhs);
50 
56  virtual void Set(Value value);
57 
63  virtual Value Get() const;
64 
74  bool IsFwdSolenoidBlackListed() const;
75 
85  bool IsRevSolenoidBlackListed() const;
86 
87  void InitSendable(SendableBuilder& builder) override;
88 
89  private:
90  int m_forwardChannel; // The forward channel on the module to control.
91  int m_reverseChannel; // The reverse channel on the module to control.
92  int m_forwardMask; // The mask for the forward channel.
93  int m_reverseMask; // The mask for the reverse channel.
94  HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle;
95  HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle;
96 };
97 
98 } // namespace frc
bool IsRevSolenoidBlackListed() const
Check if the reverse solenoid is blacklisted.
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:19
bool IsFwdSolenoidBlackListed() const
Check if the forward solenoid is blacklisted.
virtual void Set(Value value)
Set the value of a solenoid.
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: SendableBuilder.h:23
DoubleSolenoid(int forwardChannel, int reverseChannel)
Constructor.