samv7: build sam_qencoder.c only if at least one timer counter is enabled

Option CONFIG_SENSORS_QENCODER might be configured even if SAMv7 qencoder
over timer counter is not used (for example encoder over GPIO is selected
with CONFIG_SAMV7_GPIO_ENC). This can cause compile warnings, also build
of sam_qencoder.c file is unnecessary in that case.

New hidden option CONFIG_SAMV7_QENCODER is added and automatically
selected if at least one timer counter is enabled for qencoder. Build
is triggered on this option.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc 2024-04-29 09:59:14 +02:00 committed by Xiang Xiao
parent 45568229ef
commit 8f23a2db01
4 changed files with 13 additions and 5 deletions

View File

@ -275,6 +275,10 @@ config SAMV7_DAC
bool bool
default n default n
config SAMV7_QENCODER
bool
default n
config SAMV7_HAVE_DAC1 config SAMV7_HAVE_DAC1
bool bool
default n default n
@ -3794,6 +3798,7 @@ config SAMV7_TC0_QE
bool "TC0" bool "TC0"
default n default n
depends on SAMV7_TC0 depends on SAMV7_TC0
select SAMV7_QENCODER
select SAMV7_TC0_TIOA0 select SAMV7_TC0_TIOA0
select SAMV7_TC0_TIOB0 select SAMV7_TC0_TIOB0
---help--- ---help---
@ -3803,6 +3808,7 @@ config SAMV7_TC1_QE
bool "TC1" bool "TC1"
default n default n
depends on SAMV7_TC1 depends on SAMV7_TC1
select SAMV7_QENCODER
select SAMV7_TC1_TIOA3 select SAMV7_TC1_TIOA3
select SAMV7_TC1_TIOB3 select SAMV7_TC1_TIOB3
---help--- ---help---
@ -3812,6 +3818,7 @@ config SAMV7_TC2_QE
bool "TC2" bool "TC2"
default n default n
depends on SAMV7_TC2 depends on SAMV7_TC2
select SAMV7_QENCODER
select SAMV7_TC2_TIOA6 select SAMV7_TC2_TIOA6
select SAMV7_TC2_TIOB6 select SAMV7_TC2_TIOB6
---help--- ---help---
@ -3821,6 +3828,7 @@ config SAMV7_TC3_QE
bool "TC3" bool "TC3"
default n default n
depends on SAMV7_TC3 depends on SAMV7_TC3
select SAMV7_QENCODER
select SAMV7_TC3_TIOA9 select SAMV7_TC3_TIOA9
select SAMV7_TC3_TIOB9 select SAMV7_TC3_TIOB9
---help--- ---help---

View File

@ -108,7 +108,7 @@ endif
ifeq ($(CONFIG_SCHED_TICKLESS),y) ifeq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += sam_tickless.c CHIP_CSRCS += sam_tickless.c
endif endif
ifeq ($(CONFIG_SENSORS_QENCODER),y) ifeq ($(CONFIG_SAMV7_QENCODER),y)
CHIP_CSRCS += sam_qencoder.c CHIP_CSRCS += sam_qencoder.c
endif endif
endif endif

View File

@ -41,7 +41,7 @@
#include "sam_tc.h" #include "sam_tc.h"
#include "sam_qencoder.h" #include "sam_qencoder.h"
#ifdef CONFIG_SENSORS_QENCODER #if defined(CONFIG_SENSORS_QENCODER) && defined(CONFIG_SAMV7_QENCODER)
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -541,4 +541,4 @@ int sam_qeinitialize(const char *devpath, int tc)
return OK; return OK;
} }
#endif /* CONFIG_SENSORS_QENCODER */ #endif /* CONFIG_SENSORS_QENCODER && CONFIG_SAMV7_QENCODER */

View File

@ -29,7 +29,7 @@
#include "chip.h" #include "chip.h"
#ifdef CONFIG_SENSORS_QENCODER #if defined(CONFIG_SENSORS_QENCODER) && defined(CONFIG_SAMV7_QENCODER)
/**************************************************************************** /****************************************************************************
* Included Files * Included Files
@ -77,5 +77,5 @@
int sam_qeinitialize(const char *devpath, int tc); int sam_qeinitialize(const char *devpath, int tc);
#endif /* CONFIG_SENSORS_QENCODER */ #endif /* CONFIG_SENSORS_QENCODER && CONFIG_SAMV7_QENCODER */
#endif /* __ARCH_ARM_SRC_SAMV7_SAM_QENCODER_H */ #endif /* __ARCH_ARM_SRC_SAMV7_SAM_QENCODER_H */