WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
AnalogTrigger.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2017. 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 "AnalogTriggerOutput.h"
13 #include "HAL/Types.h"
14 #include "SensorBase.h"
15 
16 namespace frc {
17 
18 class AnalogInput;
19 
20 class AnalogTrigger : public SensorBase {
21  friend class AnalogTriggerOutput;
22 
23  public:
24  explicit AnalogTrigger(int channel);
25  explicit AnalogTrigger(AnalogInput* channel);
26  virtual ~AnalogTrigger();
27 
28  void SetLimitsVoltage(double lower, double upper);
29  void SetLimitsRaw(int lower, int upper);
30  void SetAveraged(bool useAveragedValue);
31  void SetFiltered(bool useFilteredValue);
32  int GetIndex() const;
33  bool GetInWindow();
34  bool GetTriggerState();
35  std::shared_ptr<AnalogTriggerOutput> CreateOutput(
36  AnalogTriggerType type) const;
37 
38  private:
39  int m_index;
40  HAL_AnalogTriggerHandle m_trigger;
41  AnalogInput* m_analogInput = nullptr;
42  bool m_ownsAnalog = false;
43 };
44 
45 } // namespace frc
void SetLimitsVoltage(double lower, double upper)
Set the upper and lower limits of the analog trigger.
Definition: AnalogTrigger.cpp:86
Base class for all sensors.
Definition: SensorBase.h:22
void SetAveraged(bool useAveragedValue)
Configure the analog trigger to use the averaged vs.
Definition: AnalogTrigger.cpp:102
bool GetInWindow()
Return the InWindow output of the analog trigger.
Definition: AnalogTrigger.cpp:145
void SetLimitsRaw(int lower, int upper)
Set the upper and lower limits of the analog trigger.
Definition: AnalogTrigger.cpp:71
Class to represent a specific output from an analog trigger.
Definition: AnalogTriggerOutput.h:48
bool GetTriggerState()
Return the TriggerState output of the analog trigger.
Definition: AnalogTrigger.cpp:163
Definition: AnalogTrigger.h:20
void SetFiltered(bool useFilteredValue)
Configure the analog trigger to use a filtered value.
Definition: AnalogTrigger.cpp:119
std::shared_ptr< AnalogTriggerOutput > CreateOutput(AnalogTriggerType type) const
Creates an AnalogTriggerOutput object.
Definition: AnalogTrigger.cpp:180
AnalogTrigger(int channel)
Constructor for an analog trigger given a channel number.
Definition: AnalogTrigger.cpp:24
Analog input class.
Definition: AnalogInput.h:32
int GetIndex() const
Return the index of the analog trigger.
Definition: AnalogTrigger.cpp:133