Misc fixes to quadrature encoder debug output

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4411 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-02-21 23:23:18 +00:00
parent 9ee1f7838e
commit b7fcd27d48
2 changed files with 14 additions and 7 deletions

View File

@ -77,18 +77,18 @@
# ifdef CONFIG_DEBUG_VERBOSE # ifdef CONFIG_DEBUG_VERBOSE
# define qevdbg vdbg # define qevdbg vdbg
# define qellvdbg llvdbg # define qellvdbg llvdbg
# define stm32_dumpgpio(p,m) stm32_dumpgpio(p,m) # define qe_dumpgpio(p,m) stm32_dumpgpio(p,m)
# else # else
# define qelldbg(x...) # define qevdbg(x...)
# define qellvdbg(x...) # define qellvdbg(x...)
# define stm32_dumpgpio(p,m) # define qe_dumpgpio(p,m)
# endif # endif
#else #else
# define qedbg(x...) # define qedbg(x...)
# define qelldbg(x...) # define qelldbg(x...)
# define qevdbg(x...) # define qevdbg(x...)
# define qellvdbg(x...) # define qellvdbg(x...)
# define stm32_dumpgpio(p,m) # define qe_dumpgpio(p,m)
#endif #endif
/************************************************************************************ /************************************************************************************
@ -604,6 +604,7 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
uint16_t ccmr1; uint16_t ccmr1;
uint16_t ccer; uint16_t ccer;
uint16_t cr1; uint16_t cr1;
uint16_t regval;
int ret; int ret;
/* NOTE: Clocking should have been enabled in the low-level RCC logic at boot-up */ /* NOTE: Clocking should have been enabled in the low-level RCC logic at boot-up */
@ -754,7 +755,12 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
cr1 &= ~GTIM_CR1_URS; cr1 &= ~GTIM_CR1_URS;
stm32_putreg16(priv, STM32_GTIM_CR1_OFFSET, cr1); stm32_putreg16(priv, STM32_GTIM_CR1_OFFSET, cr1);
/* Enable the update interrupt */ /* Clear any pending update interrupts */
regval = stm32_getreg16(priv, STM32_GTIM_SR_OFFSET);
stm32_putreg16(priv, STM32_GTIM_SR_OFFSET, regval & ~GTIM_SR_UIF)
/* Then enable the update interrupt */
dier = stm32_getreg16(priv, STM32_GTIM_DIER_OFFSET); dier = stm32_getreg16(priv, STM32_GTIM_DIER_OFFSET);
dier |= GTIM_DIER_UIE; dier |= GTIM_DIER_UIE;
@ -947,6 +953,7 @@ static int stm32_reset(FAR struct qe_lowerhalf_s *lower)
FAR struct stm32_lowerhalf_s *priv = (FAR struct stm32_lowerhalf_s *)lower; FAR struct stm32_lowerhalf_s *priv = (FAR struct stm32_lowerhalf_s *)lower;
irqstate_t flags; irqstate_t flags;
qevdbg("Resetting position to zero\n");
DEBUGASSERT(lower && priv->inuse); DEBUGASSERT(lower && priv->inuse);
/* Reset the timer and the counter. Interrupts are disabled to make this atomic /* Reset the timer and the counter. Interrupts are disabled to make this atomic

View File

@ -89,7 +89,7 @@
# define qevdbg vdbg # define qevdbg vdbg
# define qellvdbg llvdbg # define qellvdbg llvdbg
# else # else
# define qelldbg(x...) # define qevdbg(x...)
# define qellvdbg(x...) # define qellvdbg(x...)
# endif # endif
#else #else
@ -118,7 +118,7 @@
int qe_devinit(void) int qe_devinit(void)
{ {
static initialized = false; static bool initialized = false;
int ret; int ret;
/* Check if we are already initialized */ /* Check if we are already initialized */