fix(tsens): 300us delay in phy cause extra power consumption

This commit is contained in:
Cao Sen Miao 2024-01-09 18:37:38 +08:00
parent 515ca77e89
commit bc1478f0b0
4 changed files with 8 additions and 8 deletions

View File

@ -177,6 +177,10 @@ esp_err_t temperature_sensor_enable(temperature_sensor_handle_t tsens)
temperature_sensor_ll_clk_sel(tsens->clk_src);
temperature_sensor_power_acquire();
// After enabling/reseting the temperature sensor,
// the output value gradually approaches the true temperature
// value as the measurement time increases. 300us is recommended.
esp_rom_delay_us(300);
tsens->fsm = TEMP_SENSOR_FSM_ENABLE;
return ESP_OK;
}

View File

@ -45,7 +45,7 @@ void temperature_sensor_power_acquire(void)
s_temperature_sensor_power_cnt++;
if (s_temperature_sensor_power_cnt == 1) {
regi2c_saradc_enable();
#if !SOC_TEMPERATURE_SENSOR_IS_INDEPENDENT_FROM_ADC
#if !SOC_TSENS_IS_INDEPENDENT_FROM_ADC
adc_apb_periph_claim();
#endif
TSENS_RCC_ATOMIC() {
@ -55,10 +55,6 @@ void temperature_sensor_power_acquire(void)
temperature_sensor_ll_enable(true);
}
portEXIT_CRITICAL(&rtc_spinlock);
// After enabling/reseting the temperature sensor,
// the output value gradually approaches the true temperature
// value as the measurement time increases. 300us is recommended.
esp_rom_delay_us(300);
}
void temperature_sensor_power_release(void)
@ -75,7 +71,7 @@ void temperature_sensor_power_release(void)
TSENS_RCC_ATOMIC() {
temperature_sensor_ll_bus_clk_enable(false);
}
#if !SOC_TEMPERATURE_SENSOR_IS_INDEPENDENT_FROM_ADC
#if !SOC_TSENS_IS_INDEPENDENT_FROM_ADC
adc_apb_periph_free();
#endif
regi2c_saradc_disable();

View File

@ -1339,7 +1339,7 @@ config SOC_TEMPERATURE_SENSOR_INTR_SUPPORT
bool
default y
config SOC_TEMPERATURE_SENSOR_IS_INDEPENDENT_FROM_ADC
config SOC_TSENS_IS_INDEPENDENT_FROM_ADC
bool
default y

View File

@ -577,7 +577,7 @@
/*-------------------------- Temperature Sensor CAPS -------------------------------------*/
#define SOC_TEMPERATURE_SENSOR_LP_PLL_SUPPORT (1)
#define SOC_TEMPERATURE_SENSOR_INTR_SUPPORT (1)
#define SOC_TEMPERATURE_SENSOR_IS_INDEPENDENT_FROM_ADC (1) /*!< Temperature sensor is a separate module, not share regs with ADC */
#define SOC_TSENS_IS_INDEPENDENT_FROM_ADC (1) /*!< Temperature sensor is a separate module, not share regs with ADC */
/*-------------------------- Memory CAPS --------------------------*/
#define SOC_MEM_TCM_SUPPORTED (1)