WPILibC++  2018.4.1-20180729223220-1149-g7bd3f9f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
AnalogTrigger.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 <memory>
11 
12 #include <hal/Types.h>
13 
14 #include "frc/AnalogTriggerOutput.h"
15 #include "frc/ErrorBase.h"
16 #include "frc/smartdashboard/SendableBase.h"
17 
18 namespace frc {
19 
20 class AnalogInput;
21 
22 class AnalogTrigger : public ErrorBase, public SendableBase {
23  friend class AnalogTriggerOutput;
24 
25  public:
32  explicit AnalogTrigger(int channel);
33 
42  explicit AnalogTrigger(AnalogInput* channel);
43 
44  ~AnalogTrigger() override;
45 
54  void SetLimitsVoltage(double lower, double upper);
55 
65  void SetLimitsRaw(int lower, int upper);
66 
76  void SetAveraged(bool useAveragedValue);
77 
88  void SetFiltered(bool useFilteredValue);
89 
97  int GetIndex() const;
98 
106  bool GetInWindow();
107 
118  bool GetTriggerState();
119 
129  std::shared_ptr<AnalogTriggerOutput> CreateOutput(
130  AnalogTriggerType type) const;
131 
132  void InitSendable(SendableBuilder& builder) override;
133 
134  private:
135  int m_index;
136  HAL_AnalogTriggerHandle m_trigger;
137  AnalogInput* m_analogInput = nullptr;
138  bool m_ownsAnalog = false;
139 };
140 
141 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
std::shared_ptr< AnalogTriggerOutput > CreateOutput(AnalogTriggerType type) const
Creates an AnalogTriggerOutput object.
void SetLimitsRaw(int lower, int upper)
Set the upper and lower limits of the analog trigger.
int GetIndex() const
Return the index of the analog trigger.
void SetAveraged(bool useAveragedValue)
Configure the analog trigger to use the averaged vs.
bool GetInWindow()
Return the InWindow output of the analog trigger.
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
void SetLimitsVoltage(double lower, double upper)
Set the upper and lower limits of the analog trigger.
Class to represent a specific output from an analog trigger.
Definition: AnalogTriggerOutput.h:49
void SetFiltered(bool useFilteredValue)
Configure the analog trigger to use a filtered value.
Base class for most objects.
Definition: ErrorBase.h:74
Definition: SendableBase.h:19
Definition: AnalogTrigger.h:22
Definition: SendableBuilder.h:23
AnalogTrigger(int channel)
Constructor for an analog trigger given a channel number.
Analog input class.
Definition: AnalogInput.h:32
bool GetTriggerState()
Return the TriggerState output of the analog trigger.