Merge branch 'docs/add_gpio_dump_io_configuration_example' into 'master'

docs: Add an example for the function gpio_dump_io_configuration()

See merge request espressif/esp-idf!28873
pull/12800/head
Zhang Xiao Yan 2024-02-08 09:31:47 +08:00
commit ae31dfe4b8
2 zmienionych plików z 26 dodań i 2 usunięć

Wyświetl plik

@ -10,7 +10,13 @@ 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:
GPIO driver offers a dump function :cpp:func:`gpio_dump_io_configuration` to show the current configurations of IOs, such as pull-up/pull-down, input/output enable, pin mapping, etc. Below is an example of how to dump the configuration of GPIO4, GPIO18, and GPIO26:
::
gpio_dump_io_configuration(stdout, (1ULL << 4) | (1ULL << 18) | (1ULL << 26));
The dump will be like this:
::
@ -37,6 +43,12 @@ GPIO driver offers a dump function :cpp:func:`gpio_dump_io_configuration` to sho
=================IO DUMP End==================
In addition, if you would like to dump the configurations of all IOs, you can use:
::
gpio_dump_all_io_configuration(stdout, SOC_GPIO_VALID_GPIO_MASK);
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

Wyświetl plik

@ -10,7 +10,13 @@ GPIO 汇总
:start-after: gpio-summary
:end-before: ---
GPIO 驱动提供了一个函数 :cpp:func:`gpio_dump_io_configuration` 用来输出指定管脚的实时配置状态,包括上下拉、输入输出使能、管脚映射等。输出示例如下:
GPIO 驱动提供了一个函数 :cpp:func:`gpio_dump_io_configuration` 用来输出指定管脚的实时配置状态,包括上下拉、输入输出使能、管脚映射等。例如,以下命令可用于输出 GPIO4GPIO8 与 GPIO26 的配置状态:
::
gpio_dump_io_configuration(stdout, (1ULL << 4) | (1ULL << 18) | (1ULL << 26));
其输出信息如下:
::
@ -37,6 +43,12 @@ GPIO 驱动提供了一个函数 :cpp:func:`gpio_dump_io_configuration` 用来
=================IO DUMP End==================
如果你想要查看所有管脚的配置状态,可以使用命令
::
gpio_dump_all_io_configuration(stdout, SOC_GPIO_VALID_GPIO_MASK);
当 IO 管脚是通过 GPIO 交换矩阵连接到内部外设信号,输出信息打印中的外设信号 ID 定义可以在 ``soc/gpio_sig_map.h`` 文件中查看。``**RESERVED**`` 字样则表示此 IO 被用于连接 FLASH 或 PSRAM因此该引脚不应该被其他任何应用场景所征用并进行重新配置。
.. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED