nucleo-l476rg: Add better selection of timer.
This commit is contained in:
parent
3031822518
commit
a3112b231c
@ -5,11 +5,6 @@
|
||||
|
||||
if ARCH_BOARD_NUCLEO_L476RG
|
||||
|
||||
config NUCLEO_L476RG_QETIMER
|
||||
int "Timer to use with QE encoder"
|
||||
default 3
|
||||
depends on QENCODER
|
||||
|
||||
config NUCLEO_L476RG_AJOY_MINBUTTONS
|
||||
bool "Minimal Joystick Buttons"
|
||||
default n if !STM32_USART1
|
||||
|
@ -111,6 +111,10 @@ int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
FAR struct rtc_lowerhalf_s *rtclower;
|
||||
#endif
|
||||
#ifdef CONFIG_QENCODER
|
||||
int index;
|
||||
char buf[9];
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
@ -219,9 +223,14 @@ int board_app_initialize(uintptr_t arg)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_QENCODER
|
||||
|
||||
/* Initialize and register the qencoder driver */
|
||||
|
||||
ret = stm32l4_qencoder_initialize("/dev/qe0", CONFIG_NUCLEO_L476RG_QETIMER);
|
||||
index = 0;
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM1_QE
|
||||
sprintf(buf, "/dev/qe%d", index++);
|
||||
ret = stm32l4_qencoder_initialize(buf, 1);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
@ -231,6 +240,67 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM2_QE
|
||||
sprintf(buf, "/dev/qe%d", index++);
|
||||
ret = stm32l4_qencoder_initialize(buf, 2);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the qencoder: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM3_QE
|
||||
sprintf(buf, "/dev/qe%d", index++);
|
||||
ret = stm32l4_qencoder_initialize(buf, 3);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the qencoder: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM4_QE
|
||||
sprintf(buf, "/dev/qe%d", index++);
|
||||
ret = stm32l4_qencoder_initialize(buf, 4);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the qencoder: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM5_QE
|
||||
sprintf(buf, "/dev/qe%d", index++);
|
||||
ret = stm32l4_qencoder_initialize(buf, 5);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the qencoder: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM8_QE
|
||||
sprintf(buf, "/dev/qe%d", index++);
|
||||
ret = stm32l4_qencoder_initialize(buf, 8);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the qencoder: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user