Phidget Encoder
[Specific Phidgets]


Typedefs

typedef struct _CPhidgetEncoder * CPhidgetEncoderHandle

Functions

int CPhidgetEncoder_create (CPhidgetEncoderHandle *phid)
int CPhidgetEncoder_getInputCount (CPhidgetEncoderHandle phid, int *count)
int CPhidgetEncoder_getInputState (CPhidgetEncoderHandle phid, int index, int *inputState)
int CPhidgetEncoder_set_OnInputChange_Handler (CPhidgetEncoderHandle phid, int(*fptr)(CPhidgetEncoderHandle phid, void *userPtr, int index, int inputState), void *userPtr)
int CPhidgetEncoder_getEncoderCount (CPhidgetEncoderHandle phid, int *count)
int CPhidgetEncoder_getPosition (CPhidgetEncoderHandle phid, int index, int *position)
int CPhidgetEncoder_setPosition (CPhidgetEncoderHandle phid, int index, int position)
int CPhidgetEncoder_set_OnPositionChange_Handler (CPhidgetEncoderHandle phid, int(*fptr)(CPhidgetEncoderHandle phid, void *userPtr, int index, int time, int positionChange), void *userPtr)
int CPhidgetEncoder_set_OnIndex_Handler (CPhidgetEncoderHandle phid, int(*fptr)(CPhidgetEncoderHandle phid, void *userPtr, int index, int indexPosition), void *userPtr)
int CPhidgetEncoder_getIndexPosition (CPhidgetEncoderHandle phid, int index, int *position)
int CPhidgetEncoder_getEnabled (CPhidgetEncoderHandle phid, int index, int *enabledState)
int CPhidgetEncoder_setEnabled (CPhidgetEncoderHandle phid, int index, int enabledState)

Detailed Description

These calls are specific to the Phidget Encoder object. See your device's User Guide for more specific API details, technical information, and revision details. The User Guide, along with other resources, can be found on the product page for your device.

Typedef Documentation

typedef struct _CPhidgetEncoder* CPhidgetEncoderHandle

A Phidget Encoder handle


Function Documentation

int CPhidgetEncoder_create ( CPhidgetEncoderHandle phid  ) 

Creates a Phidget Encoder handle.

Parameters:
phid A pointer to an unallocated Phidget Encoder handle.

int CPhidgetEncoder_getInputCount ( CPhidgetEncoderHandle  phid,
int *  count 
)

Gets the number of digital inputs supported by this board.

Parameters:
phid An attached phidget encoder handle
count The input count.

int CPhidgetEncoder_getInputState ( CPhidgetEncoderHandle  phid,
int  index,
int *  inputState 
)

Gets the state of a digital input.

Parameters:
phid An attached phidget encoder handle
index The input index.
inputState The input state. Possible values are PTRUE and PFALSE.

int CPhidgetEncoder_set_OnInputChange_Handler ( CPhidgetEncoderHandle  phid,
int(*)(CPhidgetEncoderHandle phid, void *userPtr, int index, int inputState)  fptr,
void *  userPtr 
)

Sets an input change handler. This is called when a digital input changes.

Parameters:
phid An attached phidget encoder handle
fptr Callback function pointer.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetEncoder_getEncoderCount ( CPhidgetEncoderHandle  phid,
int *  count 
)

Gets the number of encoder inputs supported by this board.

Parameters:
phid An attached phidget encoder handle
count The encoder input count.

int CPhidgetEncoder_getPosition ( CPhidgetEncoderHandle  phid,
int  index,
int *  position 
)

Gets the current position of an encoder.

Parameters:
phid An attached phidget encoder handle
index The encoder input index.
position The current position

int CPhidgetEncoder_setPosition ( CPhidgetEncoderHandle  phid,
int  index,
int  position 
)

Sets the current position of an encoder.

Parameters:
phid An attached phidget encoder handle
index The encoder input index.
position The new position

int CPhidgetEncoder_set_OnPositionChange_Handler ( CPhidgetEncoderHandle  phid,
int(*)(CPhidgetEncoderHandle phid, void *userPtr, int index, int time, int positionChange)  fptr,
void *  userPtr 
)

Sets an encoder position change handler. This is called when an encoder position changes.

Parameters:
phid An attached phidget encoder handle
fptr Callback function pointer. Note that positionChange is a relative not absolute change and time is the time in ms since the last position change event.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetEncoder_set_OnIndex_Handler ( CPhidgetEncoderHandle  phid,
int(*)(CPhidgetEncoderHandle phid, void *userPtr, int index, int indexPosition)  fptr,
void *  userPtr 
)

Sets an encoder index handler. This is called when there is a pulse on the index pin.

Parameters:
phid An attached phidget encoder handle
fptr Callback function pointer. This returns the encoder position at which the index pulse occured.
userPtr A pointer for use by the user - this value is passed back into the callback function.

int CPhidgetEncoder_getIndexPosition ( CPhidgetEncoderHandle  phid,
int  index,
int *  position 
)

Gets the position of the last index pulse, as referenced to CPhidgetEncoder_getPosition. This will return EPHIDGET_UNKNOWN if there hasn't been an index event, or if the encoder doesn't support index.

Parameters:
phid An attached phidget encoder handle
index The encoder index.
position The index position.

int CPhidgetEncoder_getEnabled ( CPhidgetEncoderHandle  phid,
int  index,
int *  enabledState 
)

Gets the enabled state of an encoder. This is whether the encoder is powered or not.

Parameters:
phid An attached phidget encoder handle
index The encoder index.
enabledState The enabled state. Possible values are PTRUE and PFALSE.

int CPhidgetEncoder_setEnabled ( CPhidgetEncoderHandle  phid,
int  index,
int  enabledState 
)

Sets the enabled state of an encoder. This is whether the encoder is powered or not.

Parameters:
phid An attached phidget encoder handle
index The encoder index.
enabledState The enabled state. Possible values are PTRUE and PFALSE.


Generated on Wed Jan 5 12:08:42 2022 for Phidget21 by  doxygen 1.5.9