WPILibC++  2020.3.2-60-g3011ebe
DoubleSolenoid.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2019 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 #include "frc/smartdashboard/Sendable.h"
14 #include "frc/smartdashboard/SendableHelper.h"
15 
16 namespace frc {
17 
18 class SendableBuilder;
19 
28  public Sendable,
29  public SendableHelper<DoubleSolenoid> {
30  public:
31  enum Value { kOff, kForward, kReverse };
32 
41  explicit DoubleSolenoid(int forwardChannel, int reverseChannel);
42 
50  DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel);
51 
52  ~DoubleSolenoid() override;
53 
54  DoubleSolenoid(DoubleSolenoid&&) = default;
55  DoubleSolenoid& operator=(DoubleSolenoid&&) = default;
56 
62  virtual void Set(Value value);
63 
69  virtual Value Get() const;
70 
80  bool IsFwdSolenoidBlackListed() const;
81 
91  bool IsRevSolenoidBlackListed() const;
92 
93  void InitSendable(SendableBuilder& builder) override;
94 
95  private:
96  int m_forwardChannel; // The forward channel on the module to control.
97  int m_reverseChannel; // The reverse channel on the module to control.
98  int m_forwardMask; // The mask for the forward channel.
99  int m_reverseMask; // The mask for the reverse channel.
100  hal::Handle<HAL_SolenoidHandle> m_forwardHandle;
101  hal::Handle<HAL_SolenoidHandle> m_reverseHandle;
102 };
103 
104 } // namespace frc
frc::DoubleSolenoid::Set
virtual void Set(Value value)
Set the value of a solenoid.
frc::DoubleSolenoid
DoubleSolenoid class for running 2 channels of high voltage Digital Output (PCM).
Definition: DoubleSolenoid.h:27
frc::DoubleSolenoid::IsFwdSolenoidBlackListed
bool IsFwdSolenoidBlackListed() const
Check if the forward solenoid is blacklisted.
frc::SolenoidBase
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:18
frc::Sendable
Interface for Sendable objects.
Definition: Sendable.h:17
frc
A class that enforces constraints on the differential drive kinematics.
Definition: PDPSim.h:16
frc::DoubleSolenoid::InitSendable
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
frc::DoubleSolenoid::DoubleSolenoid
DoubleSolenoid(int forwardChannel, int reverseChannel)
Constructor.
frc::DoubleSolenoid::IsRevSolenoidBlackListed
bool IsRevSolenoidBlackListed() const
Check if the reverse solenoid is blacklisted.
frc::SendableHelper
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:28
frc::SendableBuilder
Definition: SendableBuilder.h:23
frc::DoubleSolenoid::Get
virtual Value Get() const
Read the current value of the solenoid.