Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2008. All Rights Reserved. |
| 3 | */ |
| 4 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 5 | /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ |
| 6 | /*----------------------------------------------------------------------------*/ |
| 7 | #pragma once |
| 8 | |
| 9 | #include "HAL/HAL.hpp" |
| 10 | #include "AnalogTriggerOutput.h" |
| 11 | #include "SensorBase.h" |
| 12 | |
| 13 | class AnalogInput; |
| 14 | |
| 15 | class AnalogTrigger : public SensorBase { |
| 16 | friend class AnalogTriggerOutput; |
| 17 | |
| 18 | public: |
| 19 | explicit AnalogTrigger(int32_t channel); |
| 20 | explicit AnalogTrigger(AnalogInput *channel); |
| 21 | virtual ~AnalogTrigger(); |
| 22 | |
| 23 | void SetLimitsVoltage(float lower, float upper); |
| 24 | void SetLimitsRaw(int32_t lower, int32_t upper); |
| 25 | void SetAveraged(bool useAveragedValue); |
| 26 | void SetFiltered(bool useFilteredValue); |
| 27 | uint32_t GetIndex() const; |
| 28 | bool GetInWindow(); |
| 29 | bool GetTriggerState(); |
| 30 | std::shared_ptr<AnalogTriggerOutput> CreateOutput(AnalogTriggerType type) const; |
| 31 | |
| 32 | private: |
| 33 | uint8_t m_index; |
| 34 | void *m_trigger; |
| 35 | }; |