libgpiod yocto
使用以下设置将 libgpiod 和从属库调用图像:
IMAGE_INSTALL:append = " libgpiod libgpiod-dev libgpiod-tools"
测试 libgpiod
登录到您的定制嵌入式系统或通过 SSH 连接。现在,您可以使用 libgpiod 命令,查看实现是否成功。#### 报告 gpio banks
首先,您需要检测安装了多少 gpio bank。使用以下命令:
gpiodetect
输出应该是这个样子:
gpiochip0 [gpio0] (32 lines)
gpiochip1 [gpio1] (32 lines)
gpiochip2 [gpio2] (32 lines)
gpiochip3 [gpio3] (32 lines)
gpiochip4 [gpio4] (32 lines)
获取所有设置
要获取所有设置,请使用以下命令:
gpioinfo
输出应该是这个样子:
gpiochip0 - 32 lines:
line 0: unnamed unused input active-high
...
line 4: unnamed "host-wakeup" input active-high [used]
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed "cd" input active-low [used]
line 8: unnamed unused input active-high
line 9: unnamed "shutdown" output active-high [used]
line 10: unnamed "reset" output active-low [used]
...
gpiochip1 - 32 lines:
line 0: unnamed unused input active-high
...
line 31: unnamed unused input active-high
gpiochip2 - 32 lines:
line 0: unnamed unused input active-high
...
line 31: unnamed unused input active-high
gpiochip3 - 32 lines:
line 0: unnamed unused input active-high
...
line 31: unnamed unused input active-high
gpiochip4 - 32 lines:
line 0: unnamed unused input active-high
...
line 29: "GPIO4_D5" unused input active-high
设置一个 GPIO 命令行
要将 gpiochip4 上的 GPIO 第 29 行设置为输出和高,请使用以下命令:
gpioset gpiochip4 29=1
版权许可
版权所有 © 2022 Interelectronix e.K.
本项目源代码根据 GPL-3.0 许可证获得许可。