Skip to content

Latest commit

 

History

History
105 lines (72 loc) · 2.78 KB

README.md

File metadata and controls

105 lines (72 loc) · 2.78 KB

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

  • complete device options (only quadrature base mode works)

Supported architectures

Header file : qei.h

Family Implementation files
pic24f qei_pic24f_dspic33f.c / qei_pic24f_dspic33f.h
pic24fj qei_pic24f_dspic33f.c / qei_pic24f_dspic33f.h
pic24hj qei_pic24f_dspic33f.c / qei_pic24f_dspic33f.h
dspic33fj qei_pic24f_dspic33f.c / qei_pic24f_dspic33f.h
dspic30f qei_dspic30f.c / qei_dspic30f.h
dspic33ch qei_pic24e_dspic33e.c / qei_pic24e_dspic33e.h
dspic33ck qei_pic24e_dspic33e.c / qei_pic24e_dspic33e.h
pic24ep qei_pic24e_dspic33e.c / qei_pic24e_dspic33e.h
dspic33ep qei_pic24e_dspic33e.c / qei_pic24e_dspic33e.h
dspic33ev qei_pic24e_dspic33e.c / qei_pic24e_dspic33e.h
pic32mk qei_pic32mk.c / qei_pic32mk.h