mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-31 13:09:38 +00:00 
			
		
		
		
	temperature_sensor: Implement temperature monitor interrupt feature on ESP32H2/ESP32C6
This commit is contained in:
		| @@ -19,6 +19,7 @@ | ||||
| #include "hal/regi2c_ctrl.h" | ||||
| #include "soc/regi2c_saradc.h" | ||||
| #include "soc/apb_saradc_struct.h" | ||||
| #include "soc/apb_saradc_reg.h" | ||||
| #include "soc/soc.h" | ||||
| #include "soc/soc_caps.h" | ||||
| #include "soc/pcr_struct.h" | ||||
| @@ -34,6 +35,13 @@ extern "C" { | ||||
| #define TEMPERATURE_SENSOR_LL_DAC_FACTOR     (27.88) | ||||
| #define TEMPERATURE_SENSOR_LL_OFFSET_FACTOR  (20.52) | ||||
|  | ||||
| #define TEMPERATURE_SENSOR_LL_INTR_MASK      APB_SARADC_APB_SARADC_TSENS_INT_ST | ||||
|  | ||||
| typedef enum { | ||||
|     TEMPERATURE_SENSOR_LL_WAKE_ABSOLUTE = 0, | ||||
|     TEMPERATURE_SENSOR_LL_WAKE_DELTA = 1, | ||||
| } temperature_sensor_ll_wakeup_mode_t; | ||||
|  | ||||
| /** | ||||
|  * @brief Enable the temperature sensor power. | ||||
|  * | ||||
| @@ -90,6 +98,7 @@ static inline void temperature_sensor_ll_set_range(uint32_t range) | ||||
|  * | ||||
|  * @return uint32_t raw_value | ||||
|  */ | ||||
| __attribute__((always_inline)) | ||||
| static inline uint32_t temperature_sensor_ll_get_raw_value(void) | ||||
| { | ||||
|     return APB_SARADC.saradc_apb_tsens_ctrl.saradc_tsens_out; | ||||
| @@ -187,6 +196,7 @@ static inline void temperature_sensor_ll_enable_intr(bool enable) | ||||
| /** | ||||
|  * @brief Clear temperature sensor interrupt | ||||
|  */ | ||||
| __attribute__((always_inline)) | ||||
| static inline void temperature_sensor_ll_clear_intr(void) | ||||
| { | ||||
|     APB_SARADC.saradc_int_clr.saradc_apb_saradc_tsens_int_clr = 1; | ||||
| @@ -194,12 +204,10 @@ static inline void temperature_sensor_ll_clear_intr(void) | ||||
|  | ||||
| /** | ||||
|  * @brief Get temperature sensor interrupt status. | ||||
|  * | ||||
|  * @param[out] int_status interrupt status. | ||||
|  */ | ||||
| static inline void temperature_sensor_ll_get_intr_status(uint8_t *int_status) | ||||
| static inline volatile void *temperature_sensor_ll_get_intr_status(void) | ||||
| { | ||||
|     *int_status = APB_SARADC.saradc_int_st.saradc_apb_saradc_tsens_int_st; | ||||
|     return &APB_SARADC.saradc_int_st; | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Cao Sen Miao
					Cao Sen Miao