mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-11 02:07:46 +00:00
Merge branch 'feature/gpio_dump_io_info' into 'master'
feat(gpio): add a dump API to dump IO configurations Closes IDFGH-10987 See merge request espressif/esp-idf!26158
This commit is contained in:
@@ -83,6 +83,7 @@ INPUT = \
|
||||
$(PROJECT_PATH)/components/driver/gpio/include/driver/gpio.h \
|
||||
$(PROJECT_PATH)/components/driver/gpio/include/driver/gpio_etm.h \
|
||||
$(PROJECT_PATH)/components/driver/gpio/include/driver/gpio_filter.h \
|
||||
$(PROJECT_PATH)/components/driver/gpio/include/driver/lp_io.h \
|
||||
$(PROJECT_PATH)/components/driver/gpio/include/driver/rtc_io.h \
|
||||
$(PROJECT_PATH)/components/driver/gptimer/include/driver/gptimer.h \
|
||||
$(PROJECT_PATH)/components/driver/gptimer/include/driver/gptimer_etm.h \
|
||||
|
||||
@@ -10,6 +10,34 @@ GPIO Summary
|
||||
:start-after: gpio-summary
|
||||
:end-before: ---
|
||||
|
||||
GPIO driver offers a dump function :cpp:func:`gpio_dump_io_configuration` to show the configurations of the IOs at the moment, such as pull-up / pull-down, input / output enable, pin mapping etc. Below is an example dump:
|
||||
|
||||
::
|
||||
|
||||
================IO DUMP Start================
|
||||
IO[4] -
|
||||
Pullup: 1, Pulldown: 0, DriveCap: 2
|
||||
InputEn: 1, OutputEn: 0, OpenDrain: 0
|
||||
FuncSel: 1 (GPIO)
|
||||
GPIO Matrix SigIn ID: (simple GPIO input)
|
||||
SleepSelEn: 1
|
||||
|
||||
IO[18] -
|
||||
Pullup: 0, Pulldown: 0, DriveCap: 2
|
||||
InputEn: 0, OutputEn: 1, OpenDrain: 0
|
||||
FuncSel: 1 (GPIO)
|
||||
GPIO Matrix SigOut ID: 256 (simple GPIO output)
|
||||
SleepSelEn: 1
|
||||
|
||||
IO[26] **RESERVED** -
|
||||
Pullup: 1, Pulldown: 0, DriveCap: 2
|
||||
InputEn: 1, OutputEn: 0, OpenDrain: 0
|
||||
FuncSel: 0 (IOMUX)
|
||||
SleepSelEn: 1
|
||||
|
||||
=================IO DUMP End==================
|
||||
|
||||
If an IO pin is routed to a peripheral signal through the GPIO matrix, the signal ID printed in the dump information is defined in the ``soc/gpio_sig_map.h`` file. The word ``**RESERVED**`` indicates the IO is occupied by either FLASH or PSRAM. It is strongly not recommended to reconfigure them for other application purposes.
|
||||
|
||||
.. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
|
||||
@@ -96,6 +124,7 @@ API Reference - Normal GPIO
|
||||
------------------------
|
||||
|
||||
.. include-build-file:: inc/rtc_io.inc
|
||||
.. include-build-file:: inc/lp_io.inc
|
||||
.. include-build-file:: inc/rtc_io_types.inc
|
||||
|
||||
.. only:: SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER or SOC_GPIO_FLEX_GLITCH_FILTER_NUM
|
||||
|
||||
@@ -10,6 +10,34 @@ GPIO 汇总
|
||||
:start-after: gpio-summary
|
||||
:end-before: ---
|
||||
|
||||
GPIO 驱动提供了一个函数 :cpp:func:`gpio_dump_io_configuration` 用来输出指定管脚的实时配置状态,包括上下拉、输入输出使能、管脚映射等。输出示例如下:
|
||||
|
||||
::
|
||||
|
||||
================IO DUMP Start================
|
||||
IO[4] -
|
||||
Pullup: 1, Pulldown: 0, DriveCap: 2
|
||||
InputEn: 1, OutputEn: 0, OpenDrain: 0
|
||||
FuncSel: 1 (GPIO)
|
||||
GPIO Matrix SigIn ID: (simple GPIO input)
|
||||
SleepSelEn: 1
|
||||
|
||||
IO[18] -
|
||||
Pullup: 0, Pulldown: 0, DriveCap: 2
|
||||
InputEn: 0, OutputEn: 1, OpenDrain: 0
|
||||
FuncSel: 1 (GPIO)
|
||||
GPIO Matrix SigOut ID: 256 (simple GPIO output)
|
||||
SleepSelEn: 1
|
||||
|
||||
IO[26] **RESERVED** -
|
||||
Pullup: 1, Pulldown: 0, DriveCap: 2
|
||||
InputEn: 1, OutputEn: 0, OpenDrain: 0
|
||||
FuncSel: 0 (IOMUX)
|
||||
SleepSelEn: 1
|
||||
|
||||
=================IO DUMP End==================
|
||||
|
||||
当 IO 管脚是通过 GPIO 交换矩阵连接到内部外设信号,输出信息打印中的外设信号 ID 定义可以在 ``soc/gpio_sig_map.h`` 文件中查看。``**RESERVED**`` 字样则表示此 IO 被用于连接 FLASH 或 PSRAM,因此该引脚不应该被其他任何应用场景所征用并进行重新配置。
|
||||
|
||||
.. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
|
||||
@@ -96,6 +124,7 @@ API 参考 - 普通 GPIO
|
||||
------------------------
|
||||
|
||||
.. include-build-file:: inc/rtc_io.inc
|
||||
.. include-build-file:: inc/lp_io.inc
|
||||
.. include-build-file:: inc/rtc_io_types.inc
|
||||
|
||||
.. only:: SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER or SOC_GPIO_FLEX_GLITCH_FILTER_NUM
|
||||
|
||||
Reference in New Issue
Block a user