drivers/qe: Don't compile stm32_qencoder.c if STM32 QE is not enabled

NuttX uses Quadrature Encoder lower half driver to internal QE from
MCUs and also with Magnetic Rotary Encoder sensors. But when the
STM32 QE is not enabled, the board code will try to compile the
stm32_qencoder.c because Magnetic Rotary Encoders enables the
CONFIG_SENSORS_QENCODER. This patch fixes this issue.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
Alan Carvalho de Assis
2026-04-25 16:45:09 -03:00
committed by Alan C. Assis
parent 2b8be4a3da
commit f8e78c1075
6 changed files with 23 additions and 5 deletions
+3 -1
View File
@@ -205,7 +205,9 @@ if(CONFIG_STM32_CAP)
endif()
if(CONFIG_SENSORS_QENCODER)
list(APPEND SRCS stm32_qencoder.c)
if(CONFIG_STM32_QE)
list(APPEND SRCS stm32_qencoder.c)
endif()
endif()
if(CONFIG_SENSORS_HALL3PHASE)
+10
View File
@@ -12004,6 +12004,10 @@ config STM32_DMA2D_REGDEBUG
endmenu
endif # STM32_DMA2D
config STM32_QE
bool
default n
menu "STM32 QEncoder Driver"
depends on SENSORS_QENCODER
depends on STM32_TIM1 || STM32_TIM2 || STM32_TIM3 || STM32_TIM4 || STM32_TIM5 || STM32_TIM8
@@ -12020,6 +12024,7 @@ config STM32_TIM1_QE
bool "TIM1 QE"
default n
depends on STM32_TIM1
select STM32_QE
---help---
Reserve TIM1 for use by QEncoder.
@@ -12038,6 +12043,7 @@ config STM32_TIM2_QE
bool "TIM2 QE"
default n
depends on STM32_TIM2
select STM32_QE
---help---
Reserve TIM2 for use by QEncoder.
@@ -12056,6 +12062,7 @@ config STM32_TIM3_QE
bool "TIM3 QE"
default n
depends on STM32_TIM3
select STM32_QE
---help---
Reserve TIM3 for use by QEncoder.
@@ -12074,6 +12081,7 @@ config STM32_TIM4_QE
bool "TIM4 QE"
default n
depends on STM32_TIM4
select STM32_QE
---help---
Reserve TIM4 for use by QEncoder.
@@ -12092,6 +12100,7 @@ config STM32_TIM5_QE
bool "TIM5 QE"
default n
depends on STM32_TIM5
select STM32_QE
---help---
Reserve TIM5 for use by QEncoder.
@@ -12110,6 +12119,7 @@ config STM32_TIM8_QE
bool "TIM8 QE"
default n
depends on STM32_TIM8
select STM32_QE
---help---
Reserve TIM8 for use by QEncoder.
+3 -1
View File
@@ -189,7 +189,9 @@ CHIP_CSRCS += stm32_capture_lowerhalf.c
endif
ifeq ($(CONFIG_SENSORS_QENCODER),y)
CHIP_CSRCS += stm32_qencoder.c
ifeq ($(CONFIG_STM32_QE),y)
CHIP_CSRCS += stm32_qencoder.c
endif
endif
ifeq ($(CONFIG_SENSORS_HALL3PHASE),y)
+3 -1
View File
@@ -87,7 +87,9 @@ if(CONFIG_SENSORS_ZEROCROSS)
endif()
if(CONFIG_SENSORS_QENCODER)
list(APPEND SRCS stm32_qencoder.c)
if(CONFIG_STM32_QE)
list(APPEND SRCS stm32_qencoder.c)
endif()
endif()
if(CONFIG_SENSORS_INA219)
+3 -1
View File
@@ -95,7 +95,9 @@ ifeq ($(CONFIG_SENSORS_ZEROCROSS),y)
endif
ifeq ($(CONFIG_SENSORS_QENCODER),y)
CSRCS += stm32_qencoder.c
ifeq ($(CONFIG_STM32_QE),y)
CSRCS += stm32_qencoder.c
endif
endif
ifeq ($(CONFIG_SENSORS_HALL3PHASE),y)
@@ -476,7 +476,7 @@ int stm32_bringup(void)
}
#endif
#ifdef CONFIG_SENSORS_QENCODER
#if defined(CONFIG_STM32_QE) && defined(CONFIG_SENSORS_QENCODER)
/* Initialize and register the qencoder driver */
ret = board_qencoder_initialize(0, CONFIG_STM32F4DISCO_QETIMER);