Update temp_sensor.rst documentation to match example (GitHub PR)

This commit is contained in:
BOT 2024-03-06 10:11:40 +08:00 committed by C.S.M
parent 64d37664b4
commit c07862cee8
3 changed files with 9 additions and 11 deletions

View File

@ -104,7 +104,11 @@ esp_err_t temperature_sensor_install(const temperature_sensor_config_t *tsens_co
temperature_sensor_handle_t tsens = NULL;
tsens = (temperature_sensor_obj_t *) heap_caps_calloc(1, sizeof(temperature_sensor_obj_t), MALLOC_CAP_DEFAULT);
ESP_RETURN_ON_FALSE((tsens != NULL), ESP_ERR_NO_MEM, TAG, "no mem for temp sensor");
tsens->clk_src = tsens_config->clk_src;
if (tsens->clk_src == 0) {
tsens->clk_src = TEMPERATURE_SENSOR_CLK_SRC_DEFAULT;
} else {
tsens->clk_src = tsens_config->clk_src;
}
temperature_sensor_power_acquire();
temperature_sensor_ll_clk_sel(tsens->clk_src);

View File

@ -75,11 +75,8 @@ Creating a Temperature Sensor Handle
.. code:: c
temperature_sensor_handle_t temp_handle = NULL;
temperature_sensor_config_t temp_sensor = {
.range_min = 20,
.range_max = 50,
};
ESP_ERROR_CHECK(temperature_sensor_install(&temp_sensor, &temp_handle));
temperature_sensor_config_t temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(20, 50);
ESP_ERROR_CHECK(temperature_sensor_install(&temp_sensor_config, &temp_handle));
.. _temp-enable-and-disable-temperature-sensor:

View File

@ -74,11 +74,8 @@
.. code:: c
temperature_sensor_handle_t temp_handle = NULL;
temperature_sensor_config_t temp_sensor = {
.range_min = 20,
.range_max = 50,
};
ESP_ERROR_CHECK(temperature_sensor_install(&temp_sensor, &temp_handle));
temperature_sensor_config_t temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(20, 50);
ESP_ERROR_CHECK(temperature_sensor_install(&temp_sensor_config, &temp_handle));
.. _temp-enable-and-disable-temperature-sensor: