fix(gpio): fix pu, pd, drv value incorrect from gpio_dump_io_configuration on esp32

Closes https://github.com/espressif/esp-idf/issues/14931
This commit is contained in:
Song Ruo Jing
2024-12-13 17:40:31 +08:00
parent 4d9d164541
commit c749ec66f6
21 changed files with 564 additions and 167 deletions

View File

@@ -57,15 +57,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{
*pu = IO_MUX.gpion[gpio_num].gpion_fun_wpu;
*pd = IO_MUX.gpion[gpio_num].gpion_fun_wpd;
*ie = IO_MUX.gpion[gpio_num].gpion_fun_ie;
*oe = (hw->enable.val & (1 << gpio_num)) >> gpio_num;
*od = hw->pinn[gpio_num].pinn_pad_driver;
*drv = IO_MUX.gpion[gpio_num].gpion_fun_drv;
*fun_sel = IO_MUX.gpion[gpio_num].gpion_mcu_sel;
*sig_out = hw->funcn_out_sel_cfg[gpio_num].funcn_out_sel;
*slp_sel = IO_MUX.gpion[gpio_num].gpion_slp_sel;
if (pu) {
*pu = IO_MUX.gpion[gpio_num].gpion_fun_wpu;
}
if (pd) {
*pd = IO_MUX.gpion[gpio_num].gpion_fun_wpd;
}
if (ie) {
*ie = IO_MUX.gpion[gpio_num].gpion_fun_ie;
}
if (oe) {
*oe = (hw->enable.val & (1 << gpio_num)) >> gpio_num;
}
if (od) {
*od = hw->pinn[gpio_num].pinn_pad_driver;
}
if (drv) {
*drv = IO_MUX.gpion[gpio_num].gpion_fun_drv;
}
if (fun_sel) {
*fun_sel = IO_MUX.gpion[gpio_num].gpion_mcu_sel;
}
if (sig_out) {
*sig_out = hw->funcn_out_sel_cfg[gpio_num].funcn_out_sel;
}
if (slp_sel) {
*slp_sel = IO_MUX.gpion[gpio_num].gpion_slp_sel;
}
}
/**

View File

@@ -229,6 +229,17 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
LP_IO_MUX.gpion[rtcio_num].gpion_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_MUX.gpion[rtcio_num].gpion_fun_wpu;
}
/**
* RTC GPIO pulldown enable.
*
@@ -251,6 +262,17 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
LP_IO_MUX.gpion[rtcio_num].gpion_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_MUX.gpion[rtcio_num].gpion_fun_wpd;
}
/**
* Enable force hold function for an RTC IO pad.
*