Robot Control Library
|
C interface for quadrature encoder counting.
Functions for reading the eQEP hardware-accelerated quadrature encoder counters and the PRU accelerated encoder counter.Channels 1-3 on the Robotics Cape and BeagleBone Blue are counted using the Sitara's eQEP counter. Channel 4 is counted with the PRU.
Functions | |
int | rc_encoder_init (void) |
Initializes counters for channels 1-4. More... | |
int | rc_encoder_cleanup (void) |
Stops the encoder counters and closes file descriptors. This is not strictly necessary but is recommended that the user calls this function at the end of their program. More... | |
int | rc_encoder_read (int ch) |
Reads the current position of an encoder channel. More... | |
int | rc_encoder_write (int ch, int pos) |
Sets the current position of an eQEP encoder channel. Usually for resetting a counter to 0 but can set an arbitrary position if desired. More... | |
int rc_encoder_init | ( | void | ) |
Initializes counters for channels 1-4.
This also resets the encoder position to 0 so the first position read is consistent.
int rc_encoder_cleanup | ( | void | ) |
Stops the encoder counters and closes file descriptors. This is not strictly necessary but is recommended that the user calls this function at the end of their program.
int rc_encoder_read | ( | int | ch | ) |
Reads the current position of an encoder channel.
This is a signed 32-bit integer that wraps around if the position is allowed to read +- 2^31
[in] | ch | channel 1-4 |
int rc_encoder_write | ( | int | ch, |
int | pos | ||
) |
Sets the current position of an eQEP encoder channel. Usually for resetting a counter to 0 but can set an arbitrary position if desired.
[in] | ch | channel 1-4 |
[in] | pos | The new position |