From dde47ff1ab6d8155adfbaca1b912577f051509b4 Mon Sep 17 00:00:00 2001 From: Stephane D'Alu Date: Wed, 29 Jun 2016 12:14:15 +0200 Subject: renamed QDEC1 to QDEC0, misc... --- os/hal/ports/NRF51/NRF51822/hal_qei_lld.h | 38 +++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'os/hal/ports/NRF51/NRF51822/hal_qei_lld.h') diff --git a/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h b/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h index e4e89b6..f8f29b9 100644 --- a/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h +++ b/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h @@ -56,15 +56,15 @@ * @details If set to @p TRUE the support for QEID1 is included. * @note The default is @p FALSE. */ -#if !defined(NRF51_QEI_USE_QDEC1) || defined(__DOXYGEN__) -#define NRF51_QEI_USE_QDEC1 FALSE +#if !defined(NRF51_QEI_USE_QDEC0) || defined(__DOXYGEN__) +#define NRF51_QEI_USE_QDEC0 FALSE #endif /** * @brief QEID interrupt priority level setting. */ -#if !defined(NRF51_QEI_IRQ_PRIORITY) || defined(__DOXYGEN__) -#define NRF51_QEI_IRQ_PRIORITY 2 +#if !defined(NRF51_QEI_QDEC0_IRQ_PRIORITY) || defined(__DOXYGEN__) +#define NRF51_QEI_QDEC0_IRQ_PRIORITY 2 #endif /** @} */ @@ -72,11 +72,16 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -#if NRF51_QEI_USE_QDEC1 && \ - !OSAL_IRQ_IS_VALID_PRIORITY(NRF51_QEI_IRQ_PRIORITY) -#error "Invalid IRQ priority assigned to QDEC1" +#if NRF51_QEI_USE_QDEC0 && \ + !OSAL_IRQ_IS_VALID_PRIORITY(NRF51_QEI_QDEC0_IRQ_PRIORITY) +#error "Invalid IRQ priority assigned to QDEC0" #endif +#if NRF51_QEI_USE_QDEC0 == FALSE +#error "Requesting QEI driver, but no QDEC peripheric attached" +#endif + + /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ @@ -277,6 +282,7 @@ struct QEIDriver { #endif /* End of the mandatory fields.*/ /** + * @brief Counter */ qeicnt_t count; /** @@ -285,7 +291,7 @@ struct QEIDriver { */ uint32_t overflowed; /** - * @brief Pointer to the ADCx registers block. + * @brief Pointer to the QDECx registers block. */ NRF_QDEC_Type *qdec; }; @@ -305,11 +311,25 @@ struct QEIDriver { #define qei_lld_get_count(qeip) ((qeip)->count) +/** + * @brief Set the counter value. + * + * @param[in] qeip pointer to the @p QEIDriver object + * @param[in] value counter value + * + * @notapi + */ +#define qei_lld_set_count(qeip, value) \ + do { \ + (qeip)->count = value; \ + } while(0) + + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ -#if NRF51_QEI_USE_QDEC1 && !defined(__DOXYGEN__) +#if NRF51_QEI_USE_QDEC0 && !defined(__DOXYGEN__) extern QEIDriver QEID1; #endif -- cgit v1.2.3