Class Encoders
Defined in File encoders.hpp
Class Documentation
-
class Encoders
Public Functions
-
explicit Encoders(int32_t serial_number, int hub_port, bool is_hub_port_device, std::function<void(int, int, double, int)> position_change_handler)
-
~Encoders() = default
-
int32_t getSerialNumber() const noexcept
-
uint32_t getEncoderCount() const
Gets the number of encoder input channels supported by this board.
-
int64_t getPosition(int index) const
Reads the current position of an encoder.
- Parameters:
index – The index of the encoder to read
-
void setPosition(int index, int64_t position) const
Sets the offset of an encoder such that current position is the specified value.
- Parameters:
index – The index of the encoder to set
position – The new value that should be returned by ‘getPosition(index)’ at the current position of the encoder
-
int64_t getIndexPosition(int index) const
Gets the position of an encoder the last time an index pulse occured. An index pulse in this context refers to an input from the encoder the pulses high once every revolution.
- Parameters:
index – The index of the encoder to read
-
bool getEnabled(int index) const
Checks if an encoder is powered on and receiving events.
- Parameters:
index – The index of the encoder to check
-
void setEnabled(int index, bool enabled) const
Set the powered state of an encoder. If an encoder is not enabled, it will not be given power, and events and changes in position will not be captured.
- Parameters:
index – The index of the encoder to change
enabled – The new powered state of the encoder
-
explicit Encoders(int32_t serial_number, int hub_port, bool is_hub_port_device, std::function<void(int, int, double, int)> position_change_handler)