Small changes to debug
Fork of QEI_hw by
Diff: qeihw.h
- Revision:
- 1:018226f83d80
- Parent:
- 0:20a27391f6dc
--- 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: