This library supports the internal QEI hardware of the LPC1768. WARNING: requires modification of the mbed module.
Dependents: Bracky-MPU6050-DMP mbed__motor_QEIHWv2_interupt_timer_sy_2017_RD_ver020 realtimeMM_V3 realtimeMM_V3 ... more
Revision 1:018226f83d80, committed 2010-12-11
- Comitter:
- hexley
- Date:
- Sat Dec 11 01:51:58 2010 +0000
- Parent:
- 0:20a27391f6dc
- Child:
- 2:53f8ae2cf502
- Commit message:
Changed in this revision
qeihw.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/qeihw.h Sat Dec 11 01:34:35 2010 +0000 +++ b/qeihw.h Sat Dec 11 01:51:58 2010 +0000 @@ -35,6 +35,38 @@ /* Public Functions ----------------------------------------------------------- */ /** @defgroup QEI_Public_Functions QEI Public Functions */ + +/** QEI hardware interface class +* Requires mbed hardware modification: connect +* encoder PhA to p1.20, and PhB to p1.23. +* +* Example: +* @code +* // Display changes in encoder position and direction +#include "mbed.h" +* #include "qeihw.h" +* +* DigitalOut led1(LED1); +* DigitalOut led3(LED3); +* QEIHW qei(QEI_DIRINV_NONE, QEI_SIGNALMODE_QUAD, QEI_CAPMODE_2X, QEI_INVINX_NONE ); +* +* int main() { +* int32_t temp, position = 0; +* qei.SetDigiFilter(480UL); +* qei.SetMaxPosition(0xFFFFFFFF); +* +* while(1) { +* while(position == (temp = qei.GetPosition()) ); +* position = temp; +* printf("New position = %d.\r\n", temp); +* led1 = qei.Direction() == SET ? 1 : 0; +* led3 = !led1; +* wait(0.1); +* } +* } +* @endcode +*/ + class QEIHW { public: