[wpilib] Add AnalogEncoder(int) ctor (#3273)

This commit is contained in:
Starlight220
2021-04-02 18:26:41 +03:00
committed by GitHub
parent 8471c4fb26
commit f57c188f2e
3 changed files with 19 additions and 0 deletions

View File

@@ -12,6 +12,9 @@
using namespace frc;
AnalogEncoder::AnalogEncoder(int channel)
: AnalogEncoder(std::make_shared<AnalogInput>(channel)) {}
AnalogEncoder::AnalogEncoder(AnalogInput& analogInput)
: m_analogInput{&analogInput, NullDeleter<AnalogInput>{}},
m_analogTrigger{m_analogInput.get()},

View File

@@ -26,6 +26,13 @@ class AnalogEncoder : public ErrorBase,
public Sendable,
public SendableHelper<AnalogEncoder> {
public:
/**
* Construct a new AnalogEncoder attached to a specific AnalogIn channel.
*
* @param channel the analog input channel to attach to
*/
explicit AnalogEncoder(int channel);
/**
* Construct a new AnalogEncoder attached to a specific AnalogInput.
*

View File

@@ -23,6 +23,15 @@ public class AnalogEncoder implements Sendable, AutoCloseable {
protected SimDevice m_simDevice;
protected SimDouble m_simPosition;
/**
* Construct a new AnalogEncoder attached to a specific AnalogIn channel.
*
* @param channel the analog input channel to attach to
*/
public AnalogEncoder(int channel) {
this(new AnalogInput(channel));
}
/**
* Construct a new AnalogEncoder attached to a specific AnalogInput.
*