EasyManua.ls Logo

Espressif ESP32-S2 - Page 1295

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 4. API Guides
Kconfig:
config ENABLE_LCD_OUTPUT
bool "Enable LCD output."
help
Select this if your board has a LCD.
config ENABLE_LCD_CONSOLE
bool "Output console text to LCD"
depends on ENABLE_LCD_OUTPUT
help
Select this to output debugging output to the lcd
config ENABLE_LCD_PLOT
bool "Output temperature plots to LCD"
depends on ENABLE_LCD_OUTPUT
help
Select this to output temperature plots
CMakeLists.txt:
if(CONFIG_ENABLE_LCD_OUTPUT)
set(srcs lcd-real.c lcd-spi.c)
else()
set(srcs lcd-dummy.c)
endif()
# We need font if either console or plot is enabled
if(CONFIG_ENABLE_LCD_CONSOLE OR CONFIG_ENABLE_LCD_PLOT)
list(APPEND srcs "font.c")
endif()
idf_component_register(SRCS "${srcs}"
...)
Conditions which depend on the target
The current target is available to CMake files via IDF_TARGET variable.
In addition to that, if target xyz is used (IDF_TARGET=xyz), then Kconfig variable CON-
FIG_IDF_TARGET_XYZ will be set.
Note that component dependencies may depend on IDF_TARGET variable, but not on Kconfig variables. Also one
can not use Kconfig variables in include statements in CMake files, but IDF_TARGET can be used in such context.
Source Code Generation
Some components will have a situation where a source file isnt supplied with the component itself but has to be
generated from another file. Say our component has a header file that consists of the converted binary data of a BMP
file, converted using a hypothetical tool called bmp2h. The header file is then included in as C source file called
graphics_lib.c:
add_custom_command(OUTPUT logo.h
COMMAND bmp2h -i ${COMPONENT_DIR}/logo.bmp -o log.h
DEPENDS ${COMPONENT_DIR}/logo.bmp
VERBATIM)
add_custom_target(logo DEPENDS logo.h)
add_dependencies(${COMPONENT_LIB} logo)
(continues on next page)
Espressif Systems 1284
Submit Document Feedback
Release v4.4

Table of Contents