WPILibC++  2019.1.1-beta-2-41-gd65547e
 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 
47  AnalogTrigger& operator=(AnalogTrigger&& rhs);
48 
57  void SetLimitsVoltage(double lower, double upper);
58 
68  void SetLimitsRaw(int lower, int upper);
69 
79  void SetAveraged(bool useAveragedValue);
80 
91  void SetFiltered(bool useFilteredValue);
92 
100  int GetIndex() const;
101 
109  bool GetInWindow();
110 
121  bool GetTriggerState();
122 
132  std::shared_ptr<AnalogTriggerOutput> CreateOutput(
133  AnalogTriggerType type) const;
134 
135  void InitSendable(SendableBuilder& builder) override;
136 
137  private:
138  int m_index;
139  HAL_AnalogTriggerHandle m_trigger = HAL_kInvalidHandle;
140  AnalogInput* m_analogInput = nullptr;
141  bool m_ownsAnalog = false;
142 };
143 
144 } // 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:47
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.