From c7d33767e06000f9da3befd6a7954b82c42d080d Mon Sep 17 00:00:00 2001 From: Peter Date: Sat, 10 Sep 2016 15:13:23 +0200 Subject: [PATCH] change qei types to int16_t --- os/hal/ports/NRF5/LLD/hal_qei_lld.h | 2 +- os/hal/ports/STM32/LLD/TIMv1/hal_qei_lld.h | 2 +- os/hal/src/hal_qei.c | 2 +- 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 6328babb..85c96a50 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 c708b5ef..ba33a291 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 eb6223e0..9b084f70 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;