Merge branch 'refactor/esp_driver_tsens' into 'master'

refactor(temperature_sensor): Make temperature sensor driver as a seperate component

See merge request espressif/esp-idf!27408
This commit is contained in:
C.S.M 2023-11-28 10:39:14 +08:00
commit dbe08fbaae
23 changed files with 64 additions and 46 deletions

View File

@ -13,7 +13,6 @@ set(includes "deprecated"
"ledc/include"
"parlio/include"
"sigma_delta/include"
"temperature_sensor/include"
"touch_sensor/include"
"twai/include"
"uart/include"
@ -95,8 +94,7 @@ endif()
# Temperature Sensor related source files
if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
list(APPEND srcs "temperature_sensor/temperature_sensor.c"
"deprecated/rtc_temperature_legacy.c")
list(APPEND srcs "deprecated/rtc_temperature_legacy.c")
endif()
# Touch Sensor related source files
@ -146,7 +144,7 @@ else()
# have a public dependency on other "esp_driver_foo" components
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_dac esp_driver_rmt
esp_driver_dac esp_driver_rmt esp_driver_tsens
LDFRAGMENTS ${ldfragments}
)
endif()

View File

@ -64,34 +64,6 @@ menu "Driver Configurations"
orsource "./twai/Kconfig.twai"
menu "Temperature sensor Configuration"
depends on SOC_TEMP_SENSOR_SUPPORTED
config TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN
bool "Suppress legacy driver deprecated warning"
default n
help
Wether to suppress the deprecation warnings when using legacy temperature sensor driver
(driver/temp_sensor.h). If you want to continue using the legacy driver,
and don't want to see related deprecation warnings, you can enable this option.
config TEMP_SENSOR_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n
help
Wether to enable the debug log message for temperature sensor driver.
Note that, this option only controls the temperature sensor driver log, won't affect other drivers.
config TEMP_SENSOR_ISR_IRAM_SAFE
depends on SOC_TEMPERATURE_SENSOR_INTR_SUPPORT
bool "Temperature sensor ISR IRAM-Safe"
default n
help
Ensure the Temperature Sensor interrupt is IRAM-Safe by allowing the interrupt handler to be
executable when the cache is disabled (e.g. SPI Flash write).
endmenu # TEMP_SENSOR Configuration
orsource "./uart/Kconfig.uart"
menu "Sigma Delta Modulator Configuration"

View File

@ -96,10 +96,6 @@ components/driver/test_apps/sigma_delta:
depends_components:
- esp_driver_gpio
components/driver/test_apps/temperature_sensor:
disable:
- if: SOC_TEMP_SENSOR_SUPPORTED != 1
components/driver/test_apps/touch_sensor_v1:
disable:
- if: SOC_TOUCH_SENSOR_VERSION != 1

View File

@ -0,0 +1,11 @@
set(srcs)
set(priv_req efuse)
set(public_include "include")
if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
list(APPEND srcs "src/temperature_sensor.c")
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
PRIV_REQUIRES ${priv_req}
)

View File

@ -0,0 +1,27 @@
menu "ESP-Driver:Temperature Sensor Configurations"
depends on SOC_TEMP_SENSOR_SUPPORTED
config TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN
bool "Suppress legacy driver deprecated warning"
default n
help
Wether to suppress the deprecation warnings when using legacy temperature sensor driver
(driver/temp_sensor.h). If you want to continue using the legacy driver,
and don't want to see related deprecation warnings, you can enable this option.
config TEMP_SENSOR_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n
help
Wether to enable the debug log message for temperature sensor driver.
Note that, this option only controls the temperature sensor driver log, won't affect other drivers.
config TEMP_SENSOR_ISR_IRAM_SAFE
depends on SOC_TEMPERATURE_SENSOR_INTR_SUPPORT
bool "Temperature sensor ISR IRAM-Safe"
default n
help
Ensure the Temperature Sensor interrupt is IRAM-Safe by allowing the interrupt handler to be
executable when the cache is disabled (e.g. SPI Flash write).
endmenu # TEMP_SENSOR Configuration

View File

@ -43,7 +43,6 @@ struct temperature_sensor_obj_t {
#endif // SOC_TEMPERATURE_SENSOR_INTR_SUPPORT
};
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,8 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/esp_driver_tsens/test_apps/temperature_sensor:
disable:
- if: SOC_TEMP_SENSOR_SUPPORTED != 1
depends_components:
- esp_driver_tsens
- esp_phy

View File

@ -5,5 +5,5 @@ set(srcs "test_app_main.c"
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
PRIV_REQUIRES unity driver esp_wifi test_utils nvs_flash
PRIV_REQUIRES unity esp_wifi test_utils nvs_flash esp_driver_tsens
WHOLE_ARCHIVE)

View File

@ -40,10 +40,11 @@ struct temperature_sensor_obj_t {
static void start_wifi_as_softap(void)
{
uint8_t ssid_len = strlen(TEST_DEFAULT_SSID);
wifi_config_t w_config = {
.ap.ssid = TEST_DEFAULT_SSID,
.ap.password = TEST_DEFAULT_PWD,
.ap.ssid_len = strlen(TEST_DEFAULT_SSID),
.ap.ssid_len = ssid_len,
.ap.channel = TEST_DEFAULT_CHANNEL,
.ap.authmode = WIFI_AUTH_WPA2_PSK,
.ap.ssid_hidden = false,

View File

@ -80,7 +80,6 @@ INPUT = \
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_tx.h \
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_types.h \
$(PROJECT_PATH)/components/driver/sigma_delta/include/driver/sdm.h \
$(PROJECT_PATH)/components/driver/temperature_sensor/include/driver/temperature_sensor.h \
$(PROJECT_PATH)/components/driver/touch_sensor/include/driver/touch_sensor_common.h \
$(PROJECT_PATH)/components/driver/twai/include/driver/twai.h \
$(PROJECT_PATH)/components/driver/uart/include/driver/uart.h \
@ -143,6 +142,7 @@ INPUT = \
$(PROJECT_PATH)/components/esp_driver_spi/include/driver/spi_master.h \
$(PROJECT_PATH)/components/esp_driver_spi/include/driver/spi_slave_hd.h \
$(PROJECT_PATH)/components/esp_driver_spi/include/driver/spi_slave.h \
$(PROJECT_PATH)/components/esp_driver_tsens/include/driver/temperature_sensor.h \
$(PROJECT_PATH)/components/esp_eth/include/esp_eth_com.h \
$(PROJECT_PATH)/components/esp_eth/include/esp_eth_driver.h \
$(PROJECT_PATH)/components/esp_eth/include/esp_eth_mac.h \

View File

@ -17,6 +17,7 @@ In order to control the dependence of other components on drivers at a smaller g
- `esp_driver_i2s` - Driver for I2S
- `esp_driver_dac` - Driver for DAC
- `esp_driver_rmt` - Driver for RMT
- `esp_driver_tsens` - Driver for Temperature Sensor
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.

View File

@ -17,6 +17,7 @@
- `esp_driver_i2s` - I2S 驱动
- `esp_driver_dac` - DAC 驱动
- `esp_driver_rmt` - RMT 驱动
- `esp_driver_tsens` - 温度传感器驱动
为了兼容性,原来的 `driver` 组件仍然存在,并作为一个 “all-in-one" 的组件,将以上这些 `esp_driver_xyz` 组件注册成自己的公共依赖。换句话说,你无需修改既有项目的 CMake 文件,但是你现在多了一个途径去指定你项目依赖的具体的外设驱动。

View File

@ -322,10 +322,14 @@ examples/peripherals/spi_slave_hd/segment_mode/seg_slave:
examples/peripherals/temperature_sensor/temp_sensor:
disable:
- if: SOC_TEMP_SENSOR_SUPPORTED != 1
depends_components:
- esp_driver_tsens
examples/peripherals/temperature_sensor/temp_sensor_monitor:
disable:
- if: SOC_TEMPERATURE_SENSOR_INTR_SUPPORT != 1
depends_components:
- esp_driver_tsens
examples/peripherals/timer_group/gptimer:
disable: