WPILibC++  2020.2.2-33-g65eab93
AnalogTriggerOutput.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 "frc/DigitalSource.h"
11 #include "frc/smartdashboard/Sendable.h"
12 #include "frc/smartdashboard/SendableHelper.h"
13 
14 namespace frc {
15 
16 class AnalogTrigger;
17 
50  public Sendable,
51  public SendableHelper<AnalogTriggerOutput> {
52  friend class AnalogTrigger;
53 
54  public:
60  bool Get() const;
61 
62  // DigitalSource interface
66  HAL_Handle GetPortHandleForRouting() const override;
67 
71  AnalogTriggerType GetAnalogTriggerTypeForRouting() const override;
72 
76  bool IsAnalogTrigger() const override;
77 
81  int GetChannel() const override;
82 
83  void InitSendable(SendableBuilder& builder) override;
84 
85  protected:
97  AnalogTriggerOutput(const AnalogTrigger& trigger,
98  AnalogTriggerType outputType);
99 
100  private:
101  // Uses pointer rather than smart pointer because a user can not construct
102  // an AnalogTriggerOutput themselves and because the AnalogTriggerOutput
103  // should always be in scope at the same time as an AnalogTrigger.
104  const AnalogTrigger* m_trigger;
105  AnalogTriggerType m_outputType;
106 };
107 
108 } // namespace frc
frc::AnalogTriggerOutput
Class to represent a specific output from an analog trigger.
Definition: AnalogTriggerOutput.h:49
frc::AnalogTriggerOutput::GetChannel
int GetChannel() const override
frc::AnalogTrigger
Definition: AnalogTrigger.h:25
frc::AnalogTriggerOutput::InitSendable
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
frc::AnalogTriggerOutput::AnalogTriggerOutput
AnalogTriggerOutput(const AnalogTrigger &trigger, AnalogTriggerType outputType)
Create an object that represents one of the four outputs from an analog trigger.
frc::AnalogTriggerOutput::Get
bool Get() const
Get the state of the analog trigger output.
frc::AnalogTriggerOutput::IsAnalogTrigger
bool IsAnalogTrigger() const override
Is source an AnalogTrigger.
frc::Sendable
Interface for Sendable objects.
Definition: Sendable.h:17
frc
WPILib FRC namespace.
Definition: AnalogOutSim.h:16
frc::DigitalSource
DigitalSource Interface.
Definition: DigitalSource.h:25
frc::AnalogTriggerOutput::GetAnalogTriggerTypeForRouting
AnalogTriggerType GetAnalogTriggerTypeForRouting() const override
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::AnalogTriggerOutput::GetPortHandleForRouting
HAL_Handle GetPortHandleForRouting() const override