mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
[wpilib] Add AnalogEncoder(int) ctor (#3273)
This commit is contained in:
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
using namespace frc;
|
using namespace frc;
|
||||||
|
|
||||||
|
AnalogEncoder::AnalogEncoder(int channel)
|
||||||
|
: AnalogEncoder(std::make_shared<AnalogInput>(channel)) {}
|
||||||
|
|
||||||
AnalogEncoder::AnalogEncoder(AnalogInput& analogInput)
|
AnalogEncoder::AnalogEncoder(AnalogInput& analogInput)
|
||||||
: m_analogInput{&analogInput, NullDeleter<AnalogInput>{}},
|
: m_analogInput{&analogInput, NullDeleter<AnalogInput>{}},
|
||||||
m_analogTrigger{m_analogInput.get()},
|
m_analogTrigger{m_analogInput.get()},
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ class AnalogEncoder : public ErrorBase,
|
|||||||
public Sendable,
|
public Sendable,
|
||||||
public SendableHelper<AnalogEncoder> {
|
public SendableHelper<AnalogEncoder> {
|
||||||
public:
|
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.
|
* Construct a new AnalogEncoder attached to a specific AnalogInput.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,6 +23,15 @@ public class AnalogEncoder implements Sendable, AutoCloseable {
|
|||||||
protected SimDevice m_simDevice;
|
protected SimDevice m_simDevice;
|
||||||
protected SimDouble m_simPosition;
|
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.
|
* Construct a new AnalogEncoder attached to a specific AnalogInput.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user