mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
More STM32 quadrature encoder code
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4391 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************************************
|
||||
* arch/arm/src/stm32/chip/stm32_tim.h
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,6 +46,47 @@
|
||||
|
||||
#ifdef CONFIG_QENCODER
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
/* Timer devices may be used for different purposes. One special purpose is as
|
||||
* a quadrature encoder input device. If CONFIG_STM32_TIMn is defined then the
|
||||
* CONFIG_STM32_TIMn_QE must also be defined to indicate that timer "n" is intended
|
||||
* to be used for as a quadrature encoder.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_STM32_TIM1
|
||||
# undef CONFIG_STM32_TIM1_QE
|
||||
#endif
|
||||
#ifndef CONFIG_STM32_TIM2
|
||||
# undef CONFIG_STM32_TIM2_QE
|
||||
#endif
|
||||
#ifndef CONFIG_STM32_TIM3
|
||||
# undef CONFIG_STM32_TIM3_QE
|
||||
#endif
|
||||
#ifndef CONFIG_STM32_TIM4
|
||||
# undef CONFIG_STM32_TIM4_QE
|
||||
#endif
|
||||
#ifndef CONFIG_STM32_TIM5
|
||||
# undef CONFIG_STM32_TIM5_QE
|
||||
#endif
|
||||
#ifndef CONFIG_STM32_TIM8
|
||||
# undef CONFIG_STM32_TIM8_QE
|
||||
#endif
|
||||
|
||||
/* Only timers 2-5, and 1 & 8 can be used as a quadrature encoder (at least for the
|
||||
* STM32 F4)
|
||||
*/
|
||||
|
||||
#undef CONFIG_STM32_TIM6_QE
|
||||
#undef CONFIG_STM32_TIM7_QE
|
||||
#undef CONFIG_STM32_TIM9_QE
|
||||
#undef CONFIG_STM32_TIM10_QE
|
||||
#undef CONFIG_STM32_TIM11_QE
|
||||
#undef CONFIG_STM32_TIM12_QE
|
||||
#undef CONFIG_STM32_TIM13_QE
|
||||
#undef CONFIG_STM32_TIM14_QE
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
@@ -59,13 +100,14 @@
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the driver to register. E.g., "/dev/qe0"
|
||||
* tim - The timer number to used. time must be an element of {1,2,3,4,5,8}
|
||||
*
|
||||
* Returned Values:
|
||||
* Zero on success; A negated errno value is returned on failure.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_qeinitialize(FAR const char *devpath);
|
||||
int stm32_qeinitialize(FAR const char *devpath, int tim);
|
||||
|
||||
#endif /* CONFIG_QENCODER */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_QENCODER_H */
|
||||
|
||||
@@ -81,49 +81,67 @@
|
||||
* CONFIG_STM32_TIMn_DAC may also be defined to indicate that timer "n" is intended
|
||||
* to be used for that purpose.
|
||||
*
|
||||
* - To use a Quadrature Encoder. If CONFIG_STM32_TIMn is defined then
|
||||
* CONFIG_STM32_TIMn_QE may also be defined to indicate that timer "n" is intended
|
||||
* to be used for that purpose.
|
||||
*
|
||||
* In any of these cases, the timer will not be used by this timer module.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_STM32_TIM1_PWM) || defined (CONFIG_STM32_TIM1_ADC) || defined(CONFIG_STM32_TIM1_DAC)
|
||||
#if defined(CONFIG_STM32_TIM1_PWM) || defined (CONFIG_STM32_TIM1_ADC) || \
|
||||
defined(CONFIG_STM32_TIM1_DAC) || defined(CONFIG_STM32_TIM1_QE)
|
||||
# undef CONFIG_STM32_TIM1
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM2_PWM) || defined (CONFIG_STM32_TIM2_ADC) || defined(CONFIG_STM32_TIM2_DAC)
|
||||
#if defined(CONFIG_STM32_TIM2_PWM) || defined (CONFIG_STM32_TIM2_ADC) || \
|
||||
defined(CONFIG_STM32_TIM2_DAC) || defined(CONFIG_STM32_TIM2_QE)
|
||||
# undef CONFIG_STM32_TIM2
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM3_PWM) || defined (CONFIG_STM32_TIM3_ADC) || defined(CONFIG_STM32_TIM3_DAC)
|
||||
#if defined(CONFIG_STM32_TIM3_PWM) || defined (CONFIG_STM32_TIM3_ADC) || \
|
||||
defined(CONFIG_STM32_TIM3_DAC) || defined(CONFIG_STM32_TIM3_QE)
|
||||
# undef CONFIG_STM32_TIM3
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM4_PWM) || defined (CONFIG_STM32_TIM4_ADC) || defined(CONFIG_STM32_TIM4_DAC)
|
||||
#if defined(CONFIG_STM32_TIM4_PWM) || defined (CONFIG_STM32_TIM4_ADC) || \
|
||||
defined(CONFIG_STM32_TIM4_DAC) || defined(CONFIG_STM32_TIM4_QE)
|
||||
# undef CONFIG_STM32_TIM4
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM5_PWM) || defined (CONFIG_STM32_TIM5_ADC) || defined(CONFIG_STM32_TIM5_DAC)
|
||||
#if defined(CONFIG_STM32_TIM5_PWM) || defined (CONFIG_STM32_TIM5_ADC) || \
|
||||
defined(CONFIG_STM32_TIM5_DAC) || defined(CONFIG_STM32_TIM5_QE)
|
||||
# undef CONFIG_STM32_TIM5
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM6_PWM) || defined (CONFIG_STM32_TIM6_ADC) || defined(CONFIG_STM32_TIM6_DAC)
|
||||
#if defined(CONFIG_STM32_TIM6_PWM) || defined (CONFIG_STM32_TIM6_ADC) || \
|
||||
defined(CONFIG_STM32_TIM6_DAC) || defined(CONFIG_STM32_TIM6_QE)
|
||||
# undef CONFIG_STM32_TIM6
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM7_PWM) || defined (CONFIG_STM32_TIM7_ADC) || defined(CONFIG_STM32_TIM7_DAC)
|
||||
#if defined(CONFIG_STM32_TIM7_PWM) || defined (CONFIG_STM32_TIM7_ADC) || \
|
||||
defined(CONFIG_STM32_TIM7_DAC) || defined(CONFIG_STM32_TIM7_QE)
|
||||
# undef CONFIG_STM32_TIM7
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM8_PWM) || defined (CONFIG_STM32_TIM8_ADC) || defined(CONFIG_STM32_TIM8_DAC)
|
||||
#if defined(CONFIG_STM32_TIM8_PWM) || defined (CONFIG_STM32_TIM8_ADC) || \
|
||||
defined(CONFIG_STM32_TIM8_DAC) || defined(CONFIG_STM32_TIM8_QE)
|
||||
# undef CONFIG_STM32_TIM8
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM9_PWM) || defined (CONFIG_STM32_TIM9_ADC) || defined(CONFIG_STM32_TIM9_DAC)
|
||||
#if defined(CONFIG_STM32_TIM9_PWM) || defined (CONFIG_STM32_TIM9_ADC) || \
|
||||
defined(CONFIG_STM32_TIM9_DAC) || defined(CONFIG_STM32_TIM9_QE)
|
||||
# undef CONFIG_STM32_TIM9
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM10_PWM) || defined (CONFIG_STM32_TIM10_ADC) || defined(CONFIG_STM32_TIM10_DAC)
|
||||
#if defined(CONFIG_STM32_TIM10_PWM) || defined (CONFIG_STM32_TIM10_ADC) || \
|
||||
defined(CONFIG_STM32_TIM10_DAC) || defined(CONFIG_STM32_TIM10_QE)
|
||||
# undef CONFIG_STM32_TIM10
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM11_PWM) || defined (CONFIG_STM32_TIM11_ADC) || defined(CONFIG_STM32_TIM11_DAC)
|
||||
#if defined(CONFIG_STM32_TIM11_PWM) || defined (CONFIG_STM32_TIM11_ADC) || \
|
||||
defined(CONFIG_STM32_TIM11_DAC) || defined(CONFIG_STM32_TIM11_QE)
|
||||
# undef CONFIG_STM32_TIM11
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM12_PWM) || defined (CONFIG_STM32_TIM12_ADC) || defined(CONFIG_STM32_TIM12_DAC)
|
||||
#if defined(CONFIG_STM32_TIM12_PWM) || defined (CONFIG_STM32_TIM12_ADC) || \
|
||||
defined(CONFIG_STM32_TIM12_DAC) || defined(CONFIG_STM32_TIM12_QE)
|
||||
# undef CONFIG_STM32_TIM12
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM13_PWM) || defined (CONFIG_STM32_TIM13_ADC) || defined(CONFIG_STM32_TIM13_DAC)
|
||||
#if defined(CONFIG_STM32_TIM13_PWM) || defined (CONFIG_STM32_TIM13_ADC) || \
|
||||
defined(CONFIG_STM32_TIM13_DAC) || defined(CONFIG_STM32_TIM13_QE)
|
||||
# undef CONFIG_STM32_TIM13
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_TIM14_PWM) || defined (CONFIG_STM32_TIM14_ADC) || defined(CONFIG_STM32_TIM14_DAC)
|
||||
#if defined(CONFIG_STM32_TIM14_PWM) || defined (CONFIG_STM32_TIM14_ADC) || \
|
||||
defined(CONFIG_STM32_TIM14_DAC) || defined(CONFIG_STM32_TIM14_QE)
|
||||
# undef CONFIG_STM32_TIM14
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user