mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
rtc: add pwdet and sar adc power related low level func
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,11 +19,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "soc/soc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PWDET_CONF_REG 0x600A8010
|
||||
#define PWDET_SAR_POWER_FORCE BIT(24)
|
||||
#define PWDET_SAR_POWER_CNTL BIT(23)
|
||||
|
||||
|
||||
typedef enum {
|
||||
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||
@@ -45,6 +50,24 @@ static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set SAR power mode when controlled by PWDET
|
||||
*
|
||||
* @param[in] mode See `sar_ctrl_ll_power_t`
|
||||
*/
|
||||
static inline void sar_ctrl_ll_set_power_mode_from_pwdet(sar_ctrl_ll_power_t mode)
|
||||
{
|
||||
if (mode == SAR_CTRL_LL_POWER_FSM) {
|
||||
REG_CLR_BIT(PWDET_CONF_REG, PWDET_SAR_POWER_FORCE);
|
||||
} else if (mode == SAR_CTRL_LL_POWER_ON) {
|
||||
REG_SET_BIT(PWDET_CONF_REG, PWDET_SAR_POWER_FORCE);
|
||||
REG_SET_BIT(PWDET_CONF_REG, PWDET_SAR_POWER_CNTL);
|
||||
} else if (mode == SAR_CTRL_LL_POWER_OFF) {
|
||||
REG_SET_BIT(PWDET_CONF_REG, PWDET_SAR_POWER_FORCE);
|
||||
REG_CLR_BIT(PWDET_CONF_REG, PWDET_SAR_POWER_CNTL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user