diff options
author | Stephane D'Alu <sdalu@sdalu.com> | 2016-07-07 20:41:09 +0200 |
---|---|---|
committer | Stephane D'Alu <sdalu@sdalu.com> | 2016-07-07 20:41:09 +0200 |
commit | 9c88423d66e9b4eafecc658058f25f79e08ff120 (patch) | |
tree | 7a3bd206daee9784bf95c0f4c2cb077f8b195fff /os/hal/ports/NRF51/NRF51822/hal_qei_lld.h | |
parent | af18f7d43fe8f07016e985fed9e5dcd021da3303 (diff) | |
download | ChibiOS-Contrib-9c88423d66e9b4eafecc658058f25f79e08ff120.tar.gz ChibiOS-Contrib-9c88423d66e9b4eafecc658058f25f79e08ff120.tar.bz2 ChibiOS-Contrib-9c88423d66e9b4eafecc658058f25f79e08ff120.zip |
move functions to hal_qei.*, fixed comments
Diffstat (limited to 'os/hal/ports/NRF51/NRF51822/hal_qei_lld.h')
-rw-r--r-- | os/hal/ports/NRF51/NRF51822/hal_qei_lld.h | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h b/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h index 4de946e..5037591 100644 --- a/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h +++ b/os/hal/ports/NRF51/NRF51822/hal_qei_lld.h @@ -35,14 +35,26 @@ /* Driver constants. */
/*===========================================================================*/
+/**
+ * @brief For LED active on LOW
+ */
#define QEI_LED_POLARITY_LOW 0
+
+/**
+ * @brief For LED active on HIGH
+ */
#define QEI_LED_POLARITY_HIGH 1
+/**
+ * @brief Mininum usable value for defining counter underflow
+ */
#define QEI_COUNT_MIN (-2147483648)
-#define QEI_COUNT_MAX (2147483647)
-#define HAL_QEI_SUPPORT_OVERFLOW_MINMAX TRUE
-#define HAM_QEI_SUPPORT_OVERFLOW_DISCARD TRUE
+/**
+ * @brief Maximum usable value for defining counter overflow
+ */
+#define QEI_COUNT_MAX ( 2147483647)
+
/*===========================================================================*/
@@ -69,8 +81,8 @@ * is included.
* @note The default is @p FALSE.
*/
-#if !defined(NRF51_QEI_USE_ACC_OVERFLOW_CB) || defined(__DOXYGEN__)
-#define NRF51_QEI_USE_ACC_OVERFLOW_CB FALSE
+#if !defined(NRF51_QEI_USE_ACC_OVERFLOWED_CB) || defined(__DOXYGEN__)
+#define NRF51_QEI_USE_ACC_OVERFLOWED_CB FALSE
#endif
/**
@@ -143,21 +155,6 @@ typedef enum { QEI_REPORT_280 = 0x07UL, /**< 280 samples per report. */
} qeireport_t;
-
-// XXX: to be moved in hal_qei
-/**
- * @brief Handling of counter overflow/underflow.
- */
-typedef enum {
- QEI_OVERFLOW_WRAP = 0, /**< Counter value will wrap around. */
-#if HAL_QEI_SUPPORT_OVERFLOW_DISCARD == TRUE
- QEI_OVERFLOW_DISCARD = 1, /**< Counter doesn't change. */
-#endif
-#if HAL_QEI_SUPPORT_OVERFLOW_MINMAX == TRUE
- QEI_OVERFLOW_MINMAX = 2, /**< Counter will be updated to min or max. */
-#endif
-} qeioverflow_t;
-
/**
* @brief QEI direction inversion.
*/
@@ -252,7 +249,8 @@ typedef struct { /**
* @brief Period in µs the LED is switched on prior to sampling.
*
- * @details LED warming is between 0 and 511 (including boundaries)
+ * @details LED warming is expressed in micro-seconds and value
+ * is [0..511]
*
* @note 31µs is the recommanded default.
*
@@ -273,16 +271,16 @@ typedef struct { */
bool debouncing;
/**
- * @brief Number of sample per report
+ * @brief Number of samples per report
*
* @details Default to QEI_REPORT_10
*/
qeireport_t report;
-#if NRF51_QEI_USE_ACC_OVERFLOW_CB == TRUE
+#if NRF51_QEI_USE_ACC_OVERFLOWED_CB == TRUE
/**
* @brief Notify of internal accumulator overflowed
+ * (ie: MCU discarding samples)
*
- * @note MCU has discarded some of the samples.
* @note Called from ISR context.
*/
qeicallback_t overflowed_cb;
@@ -313,7 +311,7 @@ struct QEIDriver { * @brief Counter
*/
qeicnt_t count;
-#if NRF51_QEI_USE_ACC_OVERFLOW_CB == TRUE
+#if NRF51_QEI_USE_ACC_OVERFLOWED_CB == TRUE
/**
* @brief Number of time the MCU discarded updates due to
* accumulator overflow
|