feat(temperature_sensor): Add temperature sensor support on esp32p4

This commit is contained in:
Cao Sen Miao
2023-12-22 11:26:53 +08:00
parent 227c5d2cb7
commit 439bc719fe
24 changed files with 424 additions and 37 deletions

View File

@@ -48,11 +48,28 @@ static inline void temperature_sensor_ll_enable(bool enable)
/**
* @brief Enable the clock
*/
static inline void temperature_sensor_ll_clk_enable(bool enable)
static inline void temperature_sensor_ll_bus_clk_enable(bool enable)
{
SENS.sar_peri_clk_gate_conf.tsens_clk_en = enable;
}
/// use a macro to wrap the function, force the caller to use it in a critical section
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
#define temperature_sensor_ll_bus_clk_enable(...) do {(void)__DECLARE_RCC_ATOMIC_ENV; temperature_sensor_ll_bus_clk_enable(__VA_ARGS__);} while(0)
/**
* @brief Enable the clock
*/
static inline void temperature_sensor_ll_reset_module(void)
{
SENS.sar_peri_reset_conf.tsens_reset = 1;
SENS.sar_peri_reset_conf.tsens_reset = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
#define temperature_sensor_ll_reset_module(...) do {(void)__DECLARE_RCC_ATOMIC_ENV; temperature_sensor_ll_reset_module(__VA_ARGS__);} while(0)
/**
* @brief Choose the clock. No need to choose the clock source on ESP32-S3. ESP32-S3
* can use RTC clock.