mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
Merge branch 'contrib/github_pr_14923' into 'master'
GPIO: Add gpio_get_io_config(). (GitHub PR) Closes IDFGH-14117 and IDFGH-14127 See merge request espressif/esp-idf!35266
This commit is contained in:
@@ -59,15 +59,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
|
||||
{
|
||||
uint32_t bit_mask = 1 << gpio_num;
|
||||
uint32_t iomux_reg_val = REG_READ(IO_MUX_GPIO0_REG + (gpio_num * 4));
|
||||
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
|
||||
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
|
||||
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
|
||||
*oe = (hw->enable.val & bit_mask) >> gpio_num;
|
||||
*od = hw->pin[gpio_num].pad_driver;
|
||||
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
|
||||
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
|
||||
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel;
|
||||
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
|
||||
if (pu) {
|
||||
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
|
||||
}
|
||||
if (pd) {
|
||||
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
|
||||
}
|
||||
if (ie) {
|
||||
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
|
||||
}
|
||||
if (oe) {
|
||||
*oe = (hw->enable.val & bit_mask) >> gpio_num;
|
||||
}
|
||||
if (od) {
|
||||
*od = hw->pin[gpio_num].pad_driver;
|
||||
}
|
||||
if (drv) {
|
||||
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
|
||||
}
|
||||
if (fun_sel) {
|
||||
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
|
||||
}
|
||||
if (sig_out) {
|
||||
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel;
|
||||
}
|
||||
if (slp_sel) {
|
||||
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -228,6 +228,17 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
|
||||
LP_IO.gpio[rtcio_num].fun_wpu = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get RTC GPIO pad pullup status.
|
||||
*
|
||||
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
|
||||
* @return Whether the pullup of the pad is enabled or not.
|
||||
*/
|
||||
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
|
||||
{
|
||||
return LP_IO.gpio[rtcio_num].fun_wpu;
|
||||
}
|
||||
|
||||
/**
|
||||
* RTC GPIO pulldown enable.
|
||||
*
|
||||
@@ -250,6 +261,17 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
|
||||
LP_IO.gpio[rtcio_num].fun_wpd = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get RTC GPIO pad pulldown status.
|
||||
*
|
||||
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
|
||||
* @return Whether the pulldown of the pad is enabled or not.
|
||||
*/
|
||||
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
|
||||
{
|
||||
return LP_IO.gpio[rtcio_num].fun_wpd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable force hold function for an RTC IO pad.
|
||||
*
|
||||
|
Reference in New Issue
Block a user