temperature_sensor: Add new interface and reference counts so that phy and driver can use together

This commit is contained in:
Cao Sen Miao
2023-05-17 17:40:59 +08:00
parent dc7ff8676c
commit e304db558b
4 changed files with 166 additions and 0 deletions

View File

@@ -8,6 +8,9 @@
#include "esp_attr.h"
#include "esp_private/regi2c_ctrl.h"
#include "esp_private/sar_periph_ctrl.h"
#include "esp_private/sar_periph_ctrl.h"
#include "freertos/FreeRTOS.h"
/*
* This file is used to override the hooks provided by the PHY lib for some system features.
@@ -58,3 +61,17 @@ void phy_set_pwdet_power(bool en)
sar_periph_ctrl_pwdet_power_release();
}
}
void phy_set_tsens_power(bool en)
{
if (en) {
temperature_sensor_power_acquire();
} else {
temperature_sensor_power_release();
}
}
int16_t phy_get_tsens_value(void)
{
return temp_sensor_get_raw_value(NULL);
}