View on Github

QEI

Quadrature Encoder Interface support driver for hardware abstraction layer.

Minimalist code

rt_dev_t qei1;
int position;

// init
qei1 = qei(1);
qei_setConfig(qei1, QEI_X4MODE);
qei_enable(qei1);

// qei read
position = qei_getValue(qei1);

API

Device assignation

qei_getFreeDevice

rt_dev_t qei_getFreeDevice();

Gives a free qei device number and opens it

qei_open

int qei_open(rt_dev_t device);

Opens an qei

qei_close

int qei_close(rt_dev_t device);

Closes an qei

Device enable/disable

qei_enable

int qei_enable(rt_dev_t device);

Enables the specified qei device

qei_disable

int qei_disable(rt_dev_t device);

Disables the specified qei device

Device settings

qei_setConfig

int qei_setConfig(rt_dev_t device, uint16_t config);

Configures the specified QEI device with bits in config.

Device read / write

qei_getValue

qei_type qei_getValue(rt_dev_t device);

Returns the actual position of the specified QEI.

Development status

Device assignation, configuration, write and read data are fully functional

TODO

Supported architectures

Header file : qei.h