diff options
author | Uladzimir Pylinski <barthess@yandex.ru> | 2016-07-08 00:26:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-08 00:26:19 +0300 |
commit | 0375554e956f96453e9381bf01bbe092ae218359 (patch) | |
tree | 6f284c2788d237553abfea2e5a503f977871903d /os/hal/ports/NRF51/NRF51822 | |
parent | ba752b1b7e14402fabce7a5d11a24dadfbc6e0ba (diff) | |
parent | 60ce974437bd0cd4f59a7bf2617a81644253aacf (diff) | |
download | ChibiOS-Contrib-0375554e956f96453e9381bf01bbe092ae218359.tar.gz ChibiOS-Contrib-0375554e956f96453e9381bf01bbe092ae218359.tar.bz2 ChibiOS-Contrib-0375554e956f96453e9381bf01bbe092ae218359.zip |
Merge pull request #87 from sdalu/qei
qeiAdjustI
Diffstat (limited to 'os/hal/ports/NRF51/NRF51822')
-rw-r--r-- | os/hal/ports/NRF51/NRF51822/hal_qei_lld.c | 38 |
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 */
|