aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/NRF51/NRF51822/hal_qei_lld.c
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-07-07 21:25:51 +0200
committerStephane D'Alu <sdalu@sdalu.com>2016-07-07 21:25:51 +0200
commitf75abd1037a5c2eb119533eb2f4c7c16d874abf2 (patch)
tree0c2af621c9380d1cea37df8cdddd55eccd3b6088 /os/hal/ports/NRF51/NRF51822/hal_qei_lld.c
parent9c88423d66e9b4eafecc658058f25f79e08ff120 (diff)
downloadChibiOS-Contrib-f75abd1037a5c2eb119533eb2f4c7c16d874abf2.tar.gz
ChibiOS-Contrib-f75abd1037a5c2eb119533eb2f4c7c16d874abf2.tar.bz2
ChibiOS-Contrib-f75abd1037a5c2eb119533eb2f4c7c16d874abf2.zip
added qeiAdjustI. added new field and checking in STM32
Diffstat (limited to 'os/hal/ports/NRF51/NRF51822/hal_qei_lld.c')
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_qei_lld.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/os/hal/ports/NRF51/NRF51822/hal_qei_lld.c b/os/hal/ports/NRF51/NRF51822/hal_qei_lld.c
index fbaf3aa..0979551 100644
--- a/os/hal/ports/NRF51/NRF51822/hal_qei_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_qei_lld.c
@@ -85,7 +85,7 @@ static void serve_interrupt(QEIDriver *qeip) {
acc = -acc; // acc is [-1024..+1023], its okay on int16_t
/* Adjust counter */
- qei_lld_adjust_count(qeip, acc);
+ qeiAdjustI(qeip, acc);
}
}
@@ -266,42 +266,6 @@ void qei_lld_disable(QEIDriver *qeip) {
qeip->qdec->TASKS_STOP = 1;
}
-/**
- * @brief Adjust counter
- *
- * @param[in] qeip pointer to the @p QEIDriver object
- * @param[in] delta value to use for adjustement
- * @return remaining adjustement that were not applied
- *
- * @notapi
- */
-qeidelta_t qei_lld_adjust_count(QEIDriver *qeip, qeidelta_t delta) {
- /* Get boundaries */
- qeicnt_t min = QEI_COUNT_MIN;
- qeicnt_t max = QEI_COUNT_MAX;
- if (qeip->config->min != qeip->config->max) {
- min = qeip->config->min;
- max = qeip->config->max;
- }
-
- /* Snapshot counter for later comparison */
- qeicnt_t count = qeip->count;
-
- /* Adjust counter value */
- bool overflowed = qei_adjust_count(&qeip->count, &delta,
- min, max, qeip->config->overflow);
-
- /* Notify for value change */
- if ((qeip->count != count) && qeip->config->notify_cb)
- qeip->config->notify_cb(qeip);
-
- /* Notify for overflow (passing the remaining delta) */
- if (overflowed && qeip->config->overflow_cb)
- qeip->config->overflow_cb(qeip, delta);
-
- /* Remaining delta */
- return delta;
-}
#endif /* HAL_USE_QEI */