mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(ledc): make esp_driver_ledc as component
This commit is contained in:
parent
227c5d2cb7
commit
82f26471f0
@ -10,7 +10,6 @@ set(srcs)
|
|||||||
# Always included headers
|
# Always included headers
|
||||||
set(includes "deprecated"
|
set(includes "deprecated"
|
||||||
"i2c/include"
|
"i2c/include"
|
||||||
"ledc/include"
|
|
||||||
"parlio/include"
|
"parlio/include"
|
||||||
"touch_sensor/include"
|
"touch_sensor/include"
|
||||||
"twai/include"
|
"twai/include"
|
||||||
@ -54,13 +53,6 @@ if(CONFIG_SOC_I2S_SUPPORTED)
|
|||||||
list(APPEND srcs "deprecated/i2s_legacy.c")
|
list(APPEND srcs "deprecated/i2s_legacy.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# LEDC related source files
|
|
||||||
if(CONFIG_SOC_LEDC_SUPPORTED)
|
|
||||||
list(APPEND srcs "ledc/ledc.c")
|
|
||||||
|
|
||||||
list(APPEND ldfragments "ledc/linker.lf")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# MCPWM legacy driver
|
# MCPWM legacy driver
|
||||||
if(CONFIG_SOC_MCPWM_SUPPORTED)
|
if(CONFIG_SOC_MCPWM_SUPPORTED)
|
||||||
list(APPEND srcs "deprecated/mcpwm_legacy.c")
|
list(APPEND srcs "deprecated/mcpwm_legacy.c")
|
||||||
@ -127,7 +119,7 @@ else()
|
|||||||
esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm
|
esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm
|
||||||
esp_driver_ana_cmpr esp_driver_i2s esp_driver_sdmmc esp_driver_sdspi esp_driver_sdio
|
esp_driver_ana_cmpr esp_driver_i2s esp_driver_sdmmc esp_driver_sdspi esp_driver_sdio
|
||||||
esp_driver_dac esp_driver_rmt esp_driver_tsens esp_driver_sdm esp_driver_i2c
|
esp_driver_dac esp_driver_rmt esp_driver_tsens esp_driver_sdm esp_driver_i2c
|
||||||
esp_driver_uart
|
esp_driver_uart esp_driver_ledc
|
||||||
LDFRAGMENTS ${ldfragments}
|
LDFRAGMENTS ${ldfragments}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -101,6 +101,4 @@ menu "Driver Configurations"
|
|||||||
|
|
||||||
endmenu # Parallel IO Configuration
|
endmenu # Parallel IO Configuration
|
||||||
|
|
||||||
orsource "./ledc/Kconfig.ledc"
|
|
||||||
|
|
||||||
endmenu # Driver configurations
|
endmenu # Driver configurations
|
||||||
|
@ -18,10 +18,6 @@ components/driver/test_apps/i2s_test_apps/legacy_i2s_driver:
|
|||||||
temporary: true
|
temporary: true
|
||||||
reason: lack of runners
|
reason: lack of runners
|
||||||
|
|
||||||
components/driver/test_apps/ledc:
|
|
||||||
disable:
|
|
||||||
- if: SOC_LEDC_SUPPORTED != 1
|
|
||||||
|
|
||||||
components/driver/test_apps/legacy_adc_driver:
|
components/driver/test_apps/legacy_adc_driver:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_ADC_SUPPORTED != 1
|
- if: SOC_ADC_SUPPORTED != 1
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
# This is the project CMakeLists.txt file for the test subproject
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
|
|
||||||
set(COMPONENTS main)
|
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
||||||
project(ledc_test)
|
|
||||||
|
|
||||||
if(CONFIG_COMPILER_DUMP_RTL_FILES)
|
|
||||||
add_custom_target(check_test_app_sections ALL
|
|
||||||
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
|
|
||||||
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/driver/,${CMAKE_BINARY_DIR}/esp-idf/hal/
|
|
||||||
--elf-file ${CMAKE_BINARY_DIR}/ledc_test.elf
|
|
||||||
find-refs
|
|
||||||
--from-sections=.iram0.text
|
|
||||||
--to-sections=.flash.text,.flash.rodata
|
|
||||||
--exit-code
|
|
||||||
DEPENDS ${elf}
|
|
||||||
)
|
|
||||||
endif()
|
|
14
components/esp_driver_ledc/CMakeLists.txt
Normal file
14
components/esp_driver_ledc/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
set(srcs)
|
||||||
|
set(public_include "include")
|
||||||
|
|
||||||
|
if(CONFIG_SOC_LEDC_SUPPORTED)
|
||||||
|
list(APPEND srcs "src/ledc.c")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
idf_component_register(
|
||||||
|
SRCS ${srcs}
|
||||||
|
INCLUDE_DIRS ${public_include}
|
||||||
|
PRIV_REQUIRES "esp_pm" "esp_driver_gpio"
|
||||||
|
LDFRAGMENTS "linker.lf"
|
||||||
|
)
|
@ -1,4 +1,4 @@
|
|||||||
menu "LEDC Configuration"
|
menu "ESP-Driver:LEDC Configurations"
|
||||||
|
|
||||||
config LEDC_CTRL_FUNC_IN_IRAM
|
config LEDC_CTRL_FUNC_IN_IRAM
|
||||||
bool "Place LEDC control functions into IRAM"
|
bool "Place LEDC control functions into IRAM"
|
||||||
@ -8,4 +8,4 @@ menu "LEDC Configuration"
|
|||||||
so that these functions can be IRAM-safe and able to be called in an IRAM context.
|
so that these functions can be IRAM-safe and able to be called in an IRAM context.
|
||||||
Enabling this option can improve driver performance as well.
|
Enabling this option can improve driver performance as well.
|
||||||
|
|
||||||
endmenu # LEDC Configuration
|
endmenu
|
@ -1,5 +1,5 @@
|
|||||||
[mapping:ledc_driver]
|
[mapping:ledc_driver]
|
||||||
archive: libdriver.a
|
archive: libesp_driver_ledc.a
|
||||||
entries:
|
entries:
|
||||||
if LEDC_CTRL_FUNC_IN_IRAM = y:
|
if LEDC_CTRL_FUNC_IN_IRAM = y:
|
||||||
ledc: ledc_stop (noflash)
|
ledc: ledc_stop (noflash)
|
@ -453,7 +453,6 @@ static uint32_t ledc_auto_clk_divisor(ledc_mode_t speed_mode, int freq_hz, uint3
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function setting the LEDC timer divisor with the given source clock,
|
* @brief Function setting the LEDC timer divisor with the given source clock,
|
||||||
* frequency and resolution. If the clock configuration passed is
|
* frequency and resolution. If the clock configuration passed is
|
||||||
@ -593,11 +592,12 @@ static esp_err_t ledc_timer_del(ledc_mode_t speed_mode, ledc_timer_t timer_sel)
|
|||||||
bool is_configured = true;
|
bool is_configured = true;
|
||||||
bool is_deleted = false;
|
bool is_deleted = false;
|
||||||
portENTER_CRITICAL(&ledc_spinlock);
|
portENTER_CRITICAL(&ledc_spinlock);
|
||||||
if (p_ledc_obj[speed_mode]->glb_clk_is_acquired[timer_sel] == false
|
|
||||||
#if SOC_LEDC_HAS_TIMER_SPECIFIC_MUX
|
#if SOC_LEDC_HAS_TIMER_SPECIFIC_MUX
|
||||||
&& p_ledc_obj[speed_mode]->timer_specific_clk[timer_sel] == LEDC_TIMER_SPECIFIC_CLK_UNINIT
|
if (p_ledc_obj[speed_mode]->glb_clk_is_acquired[timer_sel] == false && p_ledc_obj[speed_mode]->timer_specific_clk[timer_sel] == LEDC_TIMER_SPECIFIC_CLK_UNINIT)
|
||||||
|
#else
|
||||||
|
if (p_ledc_obj[speed_mode]->glb_clk_is_acquired[timer_sel] == false)
|
||||||
#endif
|
#endif
|
||||||
) {
|
{
|
||||||
is_configured = false;
|
is_configured = false;
|
||||||
} else if (p_ledc_obj[speed_mode]->timer_is_stopped[timer_sel] == true) {
|
} else if (p_ledc_obj[speed_mode]->timer_is_stopped[timer_sel] == true) {
|
||||||
is_deleted = true;
|
is_deleted = true;
|
@ -0,0 +1,7 @@
|
|||||||
|
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||||
|
|
||||||
|
components/esp_driver_ledc/test_apps/ledc:
|
||||||
|
disable:
|
||||||
|
- if: SOC_LEDC_SUPPORTED != 1
|
||||||
|
depends_components:
|
||||||
|
- esp_driver_ledc
|
22
components/esp_driver_ledc/test_apps/ledc/CMakeLists.txt
Normal file
22
components/esp_driver_ledc/test_apps/ledc/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# This is the project CMakeLists.txt file for the test subproject
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
|
||||||
|
set(COMPONENTS main)
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(ledc_test)
|
||||||
|
|
||||||
|
if(CONFIG_COMPILER_DUMP_RTL_FILES)
|
||||||
|
add_custom_target(
|
||||||
|
check_test_app_sections ALL
|
||||||
|
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
|
||||||
|
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_ledc/,${CMAKE_BINARY_DIR}/esp-idf/hal/
|
||||||
|
--elf-file ${CMAKE_BINARY_DIR}/ledc_test.elf
|
||||||
|
find-refs
|
||||||
|
--from-sections=.iram0.text
|
||||||
|
--to-sections=.flash.text,.flash.rodata
|
||||||
|
--exit-code
|
||||||
|
DEPENDS ${elf}
|
||||||
|
)
|
||||||
|
endif()
|
@ -3,6 +3,8 @@ set(srcs "test_app_main.c"
|
|||||||
|
|
||||||
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
|
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
|
||||||
# the component can be registered as WHOLE_ARCHIVE
|
# the component can be registered as WHOLE_ARCHIVE
|
||||||
idf_component_register(SRCS ${srcs}
|
idf_component_register(
|
||||||
PRIV_REQUIRES unity esp_driver_pcnt driver esp_timer esp_psram
|
SRCS ${srcs}
|
||||||
WHOLE_ARCHIVE)
|
PRIV_REQUIRES unity esp_driver_pcnt esp_driver_ledc esp_driver_gpio esp_timer esp_psram
|
||||||
|
WHOLE_ARCHIVE
|
||||||
|
)
|
@ -73,7 +73,6 @@ INPUT = \
|
|||||||
$(PROJECT_PATH)/components/bt/host/bluedroid/api/include/api/esp_spp_api.h \
|
$(PROJECT_PATH)/components/bt/host/bluedroid/api/include/api/esp_spp_api.h \
|
||||||
$(PROJECT_PATH)/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h \
|
$(PROJECT_PATH)/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h \
|
||||||
$(PROJECT_PATH)/components/console/esp_console.h \
|
$(PROJECT_PATH)/components/console/esp_console.h \
|
||||||
$(PROJECT_PATH)/components/driver/ledc/include/driver/ledc.h \
|
|
||||||
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_tx.h \
|
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_tx.h \
|
||||||
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_types.h \
|
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_types.h \
|
||||||
$(PROJECT_PATH)/components/driver/touch_sensor/include/driver/touch_sensor_common.h \
|
$(PROJECT_PATH)/components/driver/touch_sensor/include/driver/touch_sensor_common.h \
|
||||||
@ -108,6 +107,7 @@ INPUT = \
|
|||||||
$(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer.h \
|
$(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer.h \
|
||||||
$(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer_etm.h \
|
$(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer_etm.h \
|
||||||
$(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer_types.h \
|
$(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer_types.h \
|
||||||
|
$(PROJECT_PATH)/components/esp_driver_ledc/include/driver/ledc.h \
|
||||||
$(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_cap.h \
|
$(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_cap.h \
|
||||||
$(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_cmpr.h \
|
$(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_cmpr.h \
|
||||||
$(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_etm.h \
|
$(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_etm.h \
|
||||||
|
@ -24,6 +24,7 @@ In order to control the dependence of other components on drivers at a smaller g
|
|||||||
- `esp_driver_sdm` - Driver for Sigma-Delta Modulator
|
- `esp_driver_sdm` - Driver for Sigma-Delta Modulator
|
||||||
- `esp_driver_i2c` - Driver for I2C
|
- `esp_driver_i2c` - Driver for I2C
|
||||||
- `esp_driver_uart` - Driver for UART
|
- `esp_driver_uart` - Driver for UART
|
||||||
|
- `esp_driver_ledc` - Driver for LEDC
|
||||||
|
|
||||||
For compatibility, the original `driver`` component is still treated as an all-in-one component by registering these `esp_driver_xyz`` components as its public dependencies. In other words, you do not need to modify the CMake file of an existing project, but you now have a way to specify the specific peripheral driver that your project depends on.
|
For compatibility, the original `driver`` component is still treated as an all-in-one component by registering these `esp_driver_xyz`` components as its public dependencies. In other words, you do not need to modify the CMake file of an existing project, but you now have a way to specify the specific peripheral driver that your project depends on.
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
- `esp_driver_sdm` - Sigma-Delta 调制器驱动
|
- `esp_driver_sdm` - Sigma-Delta 调制器驱动
|
||||||
- `esp_driver_i2c` - I2C 驱动
|
- `esp_driver_i2c` - I2C 驱动
|
||||||
- `esp_driver_uart` - UART 驱动
|
- `esp_driver_uart` - UART 驱动
|
||||||
|
- `esp_driver_ledc` - LEDC 驱动
|
||||||
|
|
||||||
为了兼容性,原来的 `driver` 组件仍然存在,并作为一个 “all-in-one" 的组件,将以上这些 `esp_driver_xyz` 组件注册成自己的公共依赖。换句话说,你无需修改既有项目的 CMake 文件,但是你现在多了一个途径去指定你项目依赖的具体的外设驱动。
|
为了兼容性,原来的 `driver` 组件仍然存在,并作为一个 “all-in-one" 的组件,将以上这些 `esp_driver_xyz` 组件注册成自己的公共依赖。换句话说,你无需修改既有项目的 CMake 文件,但是你现在多了一个途径去指定你项目依赖的具体的外设驱动。
|
||||||
|
|
||||||
|
@ -7,6 +7,6 @@ set(COMPONENT_SRCS
|
|||||||
set(COMPONENT_ADD_INCLUDEDIRS ". include")
|
set(COMPONENT_ADD_INCLUDEDIRS ". include")
|
||||||
|
|
||||||
# requirements can't depend on config
|
# requirements can't depend on config
|
||||||
set(COMPONENT_REQUIRES example_nvs driver esp_driver_gpio)
|
set(COMPONENT_REQUIRES example_nvs driver esp_driver_gpio esp_driver_ledc)
|
||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
@ -169,10 +169,14 @@ examples/peripherals/lcd/tjpgd:
|
|||||||
examples/peripherals/ledc:
|
examples/peripherals/ledc:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_LEDC_SUPPORTED != 1
|
- if: SOC_LEDC_SUPPORTED != 1
|
||||||
|
depends_components:
|
||||||
|
- esp_driver_ledc
|
||||||
|
|
||||||
examples/peripherals/ledc/ledc_gamma_curve_fade:
|
examples/peripherals/ledc/ledc_gamma_curve_fade:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_LEDC_SUPPORTED != 1 or SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED != 1
|
- if: SOC_LEDC_SUPPORTED != 1 or SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED != 1
|
||||||
|
depends_components:
|
||||||
|
- esp_driver_ledc
|
||||||
|
|
||||||
examples/peripherals/mcpwm:
|
examples/peripherals/mcpwm:
|
||||||
disable:
|
disable:
|
||||||
|
Loading…
Reference in New Issue
Block a user