WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
AnalogTrigger.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2016. 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/HAL.hpp"
11 #include "AnalogTriggerOutput.h"
12 #include "SensorBase.h"
13 
14 class AnalogInput;
15 
16 class AnalogTrigger : public SensorBase {
17  friend class AnalogTriggerOutput;
18 
19  public:
20  explicit AnalogTrigger(int32_t channel);
21  explicit AnalogTrigger(AnalogInput *channel);
22  virtual ~AnalogTrigger();
23 
24  void SetLimitsVoltage(float lower, float upper);
25  void SetLimitsRaw(int32_t lower, int32_t upper);
26  void SetAveraged(bool useAveragedValue);
27  void SetFiltered(bool useFilteredValue);
28  uint32_t GetIndex() const;
29  bool GetInWindow();
30  bool GetTriggerState();
31  std::shared_ptr<AnalogTriggerOutput> CreateOutput(AnalogTriggerType type) const;
32 
33  private:
34  uint8_t m_index;
35  void *m_trigger;
36 };
Definition: AnalogTrigger.h:16
Class to represent a specific output from an analog trigger.
Definition: AnalogTriggerOutput.h:57
std::shared_ptr< AnalogTriggerOutput > CreateOutput(AnalogTriggerType type) const
Creates an AnalogTriggerOutput object.
Definition: AnalogTrigger.cpp:156
void SetAveraged(bool useAveragedValue)
Configure the analog trigger to use the averaged vs.
Definition: AnalogTrigger.cpp:87
void SetLimitsVoltage(float lower, float upper)
Set the upper and lower limits of the analog trigger.
Definition: AnalogTrigger.cpp:72
Base class for all sensors.
Definition: SensorBase.h:20
bool GetInWindow()
Return the InWindow output of the analog trigger.
Definition: AnalogTrigger.cpp:125
AnalogTrigger(int32_t channel)
Constructor for an analog trigger given a channel number.
Definition: AnalogTrigger.cpp:23
uint32_t GetIndex() const
Return the index of the analog trigger.
Definition: AnalogTrigger.cpp:115
Analog input class.
Definition: AnalogInput.h:32
void SetLimitsRaw(int32_t lower, int32_t upper)
Set the upper and lower limits of the analog trigger.
Definition: AnalogTrigger.cpp:59
bool GetTriggerState()
Return the TriggerState output of the analog trigger.
Definition: AnalogTrigger.cpp:141
void SetFiltered(bool useFilteredValue)
Configure the analog trigger to use a filtered value.
Definition: AnalogTrigger.cpp:103