2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2017-01-01 01:05:57 -07:00
|
|
|
/* Copyright (c) FIRST 2008-2017. All Rights Reserved. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
|
2014-05-02 17:54:01 -04:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-09-05 13:55:31 -07:00
|
|
|
#include <memory>
|
|
|
|
|
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "AnalogTriggerOutput.h"
|
2016-07-12 10:45:14 -07:00
|
|
|
#include "HAL/Types.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "SensorBase.h"
|
|
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
namespace frc {
|
|
|
|
|
|
2014-06-12 18:07:45 -04:00
|
|
|
class AnalogInput;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
class AnalogTrigger : public SensorBase {
|
|
|
|
|
friend class AnalogTriggerOutput;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
public:
|
2016-09-06 00:01:45 -07:00
|
|
|
explicit AnalogTrigger(int channel);
|
2016-05-20 17:30:37 -07:00
|
|
|
explicit AnalogTrigger(AnalogInput* channel);
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual ~AnalogTrigger();
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-11-20 07:25:03 -08:00
|
|
|
void SetLimitsVoltage(double lower, double upper);
|
2016-09-06 00:01:45 -07:00
|
|
|
void SetLimitsRaw(int lower, int upper);
|
2015-06-25 15:07:55 -04:00
|
|
|
void SetAveraged(bool useAveragedValue);
|
|
|
|
|
void SetFiltered(bool useFilteredValue);
|
2016-09-06 00:01:45 -07:00
|
|
|
int GetIndex() const;
|
2015-06-25 15:07:55 -04:00
|
|
|
bool GetInWindow();
|
|
|
|
|
bool GetTriggerState();
|
2016-05-20 17:30:37 -07:00
|
|
|
std::shared_ptr<AnalogTriggerOutput> CreateOutput(
|
|
|
|
|
AnalogTriggerType type) const;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
private:
|
2016-09-06 00:01:45 -07:00
|
|
|
int m_index;
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_AnalogTriggerHandle m_trigger;
|
2016-06-27 21:32:30 -07:00
|
|
|
AnalogInput* m_analogInput = nullptr;
|
|
|
|
|
bool m_ownsAnalog = false;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|