Merge pull request #116 from andresv/qei-tim-used-checks
Add checks to STM32 QEI driver if TIMx is already used
This commit is contained in:
commit
3ff5a092fc
|
@ -182,6 +182,56 @@
|
|||
#error "QEI driver activated but no TIM peripheral assigned"
|
||||
#endif
|
||||
|
||||
/* Checks on allocation of TIMx units.*/
|
||||
#if STM32_QEI_USE_TIM1
|
||||
#if defined(STM32_TIM1_IS_USED)
|
||||
#error "QEID1 requires TIM1 but the timer is already used"
|
||||
#else
|
||||
#define STM32_TIM1_IS_USED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if STM32_QEI_USE_TIM2
|
||||
#if defined(STM32_TIM2_IS_USED)
|
||||
#error "QEID2 requires TIM2 but the timer is already used"
|
||||
#else
|
||||
#define STM32_TIM2_IS_USED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if STM32_QEI_USE_TIM3
|
||||
#if defined(STM32_TIM3_IS_USED)
|
||||
#error "QEID3 requires TIM3 but the timer is already used"
|
||||
#else
|
||||
#define STM32_TIM3_IS_USED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if STM32_QEI_USE_TIM4
|
||||
#if defined(STM32_TIM4_IS_USED)
|
||||
#error "QEID4 requires TIM4 but the timer is already used"
|
||||
#else
|
||||
#define STM32_TIM4_IS_USED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if STM32_QEI_USE_TIM5
|
||||
#if defined(STM32_TIM5_IS_USED)
|
||||
#error "QEID5 requires TIM5 but the timer is already used"
|
||||
#else
|
||||
#define STM32_TIM5_IS_USED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if STM32_QEI_USE_TIM8
|
||||
#if defined(STM32_TIM8_IS_USED)
|
||||
#error "QEID8 requires TIM8 but the timer is already used"
|
||||
#else
|
||||
#define STM32_TIM8_IS_USED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* IRQ priority checks.*/
|
||||
#if STM32_QEI_USE_TIM1 && \
|
||||
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_QEI_TIM1_IRQ_PRIORITY)
|
||||
#error "Invalid IRQ priority assigned to TIM1"
|
||||
|
|
Loading…
Reference in New Issue