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
Diff: qeihw.cpp
- Revision:
- 2:53f8ae2cf502
- Parent:
- 0:20a27391f6dc
--- a/qeihw.cpp Sat Dec 11 01:51:58 2010 +0000 +++ b/qeihw.cpp Tue Dec 28 19:32:07 2010 +0000 @@ -8,8 +8,8 @@ * @brief Driver file for the QEI hardware. Requires connection to * internal mbed circuit nodes. Adapted from the CMSIS * driver, lpc17xx_qei.c, v 2.0 - * @version 0.0 - * @date 10 Dec 2010 + * @version 0.1 + * @date 28 Dec 2010 * @author hb **************************************************************************/ #include "mbed.h" @@ -245,7 +245,9 @@ div = 8; break; } - LPC_QEI->QEILOAD = cclk; + cclk /=div; + cclk =((uint64_t)cclk / (1000000/ulReloadValue)) - 1; + LPC_QEI->QEILOAD = (uint32_t) cclk; } /*********************************************************************//**