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
@@ -14,6 +14,9 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -62,6 +65,33 @@ void sar_periph_ctrl_pwdet_power_acquire(void);
*/
void sar_periph_ctrl_pwdet_power_release(void);
/**
* @brief Acquire the temperature sensor power
*/
void temperature_sensor_power_acquire(void);
/**
* @brief Release the temperature sensor power
*/
void temperature_sensor_power_release(void);
/**
* @brief Get the temperature value and choose the temperature sensor range. Will be both used in phy and peripheral.
*
* @param range_changed Pointer to whether range has been changed here. If you don't need this param, you can
* set NULL directly.
*
* @return temperature sensor value.
*/
int16_t temp_sensor_get_raw_value(bool *range_changed);
/**
* @brief Synchronize the tsens_idx between sar_periph and driver
*
* @param tsens_idx index value of temperature sensor attribute
*/
void temp_sensor_sync_tsens_idx(int tsens_idx);
/**
* @brief Enable SAR power when system wakes up
*/