Public Member Functions | Private Attributes | List of all members
phidgets::Encoders Class Referencefinal

#include <encoders.h>

Public Member Functions

 Encoders (int32_t serial_number, int hub_port, bool is_hub_port_device, std::function< void(int, int, double, int)> position_change_handler)
 
uint32_t getDataInterval (int index) const
 
bool getEnabled (int index) const
 Checks if an encoder is powered on and receiving events. More...
 
uint32_t getEncoderCount () const
 Gets the number of encoder input channels supported by this board. More...
 
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. More...
 
Phidget_EncoderIOMode getIOMode (int index) const
 
int64_t getPosition (int index) const
 Reads the current position of an encoder. More...
 
void setDataInterval (int index, uint32_t data_interval_ms) const
 
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. More...
 
void setIOMode (int index, Phidget_EncoderIOMode io_mode) const
 
void setPosition (int index, int64_t position) const
 Sets the offset of an encoder such that current position is the specified value. More...
 
 ~Encoders ()
 

Private Attributes

uint32_t encoder_count_
 
std::vector< std::unique_ptr< Encoder > > encs_
 

Detailed Description

Definition at line 42 of file encoders.h.

Constructor & Destructor Documentation

◆ Encoders()

phidgets::Encoders::Encoders ( int32_t  serial_number,
int  hub_port,
bool  is_hub_port_device,
std::function< void(int, int, double, int)>  position_change_handler 
)
explicit

Definition at line 40 of file encoders.cpp.

◆ ~Encoders()

phidgets::Encoders::~Encoders ( )

Definition at line 81 of file encoders.cpp.

Member Function Documentation

◆ getDataInterval()

uint32_t phidgets::Encoders::getDataInterval ( int  index) const

Definition at line 125 of file encoders.cpp.

◆ getEnabled()

bool phidgets::Encoders::getEnabled ( int  index) const

Checks if an encoder is powered on and receiving events.

Parameters
indexThe index of the encoder to check

Definition at line 105 of file encoders.cpp.

◆ getEncoderCount()

uint32_t phidgets::Encoders::getEncoderCount ( ) const

Gets the number of encoder input channels supported by this board.

Definition at line 85 of file encoders.cpp.

◆ getIndexPosition()

int64_t phidgets::Encoders::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
indexThe index of the encoder to read

Definition at line 100 of file encoders.cpp.

◆ getIOMode()

Phidget_EncoderIOMode phidgets::Encoders::getIOMode ( int  index) const

Definition at line 115 of file encoders.cpp.

◆ getPosition()

int64_t phidgets::Encoders::getPosition ( int  index) const

Reads the current position of an encoder.

Parameters
indexThe index of the encoder to read

Definition at line 90 of file encoders.cpp.

◆ setDataInterval()

void phidgets::Encoders::setDataInterval ( int  index,
uint32_t  data_interval_ms 
) const

Definition at line 130 of file encoders.cpp.

◆ setEnabled()

void phidgets::Encoders::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
indexThe index of the encoder to change
enabledThe new powered state of the encoder

Definition at line 110 of file encoders.cpp.

◆ setIOMode()

void phidgets::Encoders::setIOMode ( int  index,
Phidget_EncoderIOMode  io_mode 
) const

Definition at line 120 of file encoders.cpp.

◆ setPosition()

void phidgets::Encoders::setPosition ( int  index,
int64_t  position 
) const

Sets the offset of an encoder such that current position is the specified value.

Parameters
indexThe index of the encoder to set
positionThe new value that should be returned by 'getPosition(index)' at the current position of the encoder

Definition at line 95 of file encoders.cpp.

Member Data Documentation

◆ encoder_count_

uint32_t phidgets::Encoders::encoder_count_
private

Definition at line 92 of file encoders.h.

◆ encs_

std::vector<std::unique_ptr<Encoder> > phidgets::Encoders::encs_
private

Definition at line 93 of file encoders.h.


The documentation for this class was generated from the following files:


phidgets_api
Author(s): Tully Foote, Ivan Dryanovski
autogenerated on Sun May 11 2025 02:20:27