Misc fixes to quadrature encoder debug output

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4411 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-02-21 23:23:18 +00:00
parent 20b15f2d8c
commit d8c42f1ed5
3 changed files with 15 additions and 8 deletions

View File

@ -310,7 +310,7 @@ int MAIN_NAME(int argc, char *argv[])
else
{
message(MAIN_STRING " %d\n", position);
message(MAIN_STRING "%3d. %d\n", nloops+1, position);
}
/* Delay a little bit */

View File

@ -77,18 +77,18 @@
# ifdef CONFIG_DEBUG_VERBOSE
# define qevdbg vdbg
# define qellvdbg llvdbg
# define stm32_dumpgpio(p,m) stm32_dumpgpio(p,m)
# define qe_dumpgpio(p,m) stm32_dumpgpio(p,m)
# else
# define qelldbg(x...)
# define qevdbg(x...)
# define qellvdbg(x...)
# define stm32_dumpgpio(p,m)
# define qe_dumpgpio(p,m)
# endif
#else
# define qedbg(x...)
# define qelldbg(x...)
# define qevdbg(x...)
# define qellvdbg(x...)
# define stm32_dumpgpio(p,m)
# define qe_dumpgpio(p,m)
#endif
/************************************************************************************
@ -604,6 +604,7 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
uint16_t ccmr1;
uint16_t ccer;
uint16_t cr1;
uint16_t regval;
int ret;
/* 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;
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 |= 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;
irqstate_t flags;
qevdbg("Resetting position to zero\n");
DEBUGASSERT(lower && priv->inuse);
/* Reset the timer and the counter. Interrupts are disabled to make this atomic

View File

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