mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
feat(gpio): Add gpio_get_io_config()
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
This commit is contained in:
committed by
Song Ruo Jing
parent
13e8541007
commit
4d9d164541
@@ -590,6 +590,28 @@ esp_err_t gpio_deep_sleep_wakeup_disable(gpio_num_t gpio_num);
|
||||
*/
|
||||
esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask);
|
||||
|
||||
/**
|
||||
* @brief Get the configuration for an IO
|
||||
*
|
||||
* @param gpio_num GPIO number
|
||||
* @param pu Pull-up enabled or not
|
||||
* @param pd Pull-down enabled or not
|
||||
* @param ie Input enabled or not
|
||||
* @param oe Output enabled or not
|
||||
* @param od Open-drain enabled or not
|
||||
* @param drv Drive strength value
|
||||
* @param fun_sel IOMUX function selection value
|
||||
* @param sig_out Outputting peripheral signal index
|
||||
* @param slp_sel Pin sleep mode enabled or not
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t gpio_get_io_config(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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1055,7 +1055,16 @@ esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask)
|
||||
fprintf(out_stream, " SleepSelEn: %d\n", slp_sel);
|
||||
fprintf(out_stream, "\n");
|
||||
}
|
||||
fprintf(out_stream, "=================IO DUMP End==================\n");
|
||||
fprintf(out_stream, "=================IO DUMP End=================\n");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t gpio_get_io_config(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)
|
||||
{
|
||||
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
|
||||
gpio_hal_get_io_config(gpio_context.gpio_hal, gpio_num, pu, pd, ie, oe, od, drv, fun_sel, sig_out, slp_sel);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user