aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/ports/NRF5/LLD/hal_qei_lld.h2
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/hal_qei_lld.h2
-rw-r--r--os/hal/src/hal_qei.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/os/hal/ports/NRF5/LLD/hal_qei_lld.h b/os/hal/ports/NRF5/LLD/hal_qei_lld.h
index 6328bab..85c96a5 100644
--- a/os/hal/ports/NRF5/LLD/hal_qei_lld.h
+++ b/os/hal/ports/NRF5/LLD/hal_qei_lld.h
@@ -166,7 +166,7 @@ typedef enum {
/**
* @brief QEI counter type.
*/
-typedef int32_t qeicnt_t;
+typedef int16_t qeicnt_t;
/**
* @brief QEI delta type.
diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_qei_lld.h b/os/hal/ports/STM32/LLD/TIMv1/hal_qei_lld.h
index c708b5e..ba33a29 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/hal_qei_lld.h
+++ b/os/hal/ports/STM32/LLD/TIMv1/hal_qei_lld.h
@@ -251,7 +251,7 @@ typedef enum {
/**
* @brief QEI counter type.
*/
-typedef uint16_t qeicnt_t;
+typedef int16_t qeicnt_t;
/**
* @brief QEI delta type.
diff --git a/os/hal/src/hal_qei.c b/os/hal/src/hal_qei.c
index eb6223e..9b084f7 100644
--- a/os/hal/src/hal_qei.c
+++ b/os/hal/src/hal_qei.c
@@ -364,7 +364,7 @@ qeidelta_t qeiUpdateI(QEIDriver *qeip) {
"invalid state");
cnt = qei_lld_get_count(qeip);
- delta = cnt - qeip->last;
+ delta = (qeicnt_t)(cnt - qeip->last);
qeip->last = cnt;
return delta;