代码拉取完成,页面将自动刷新
通过使用动态改变设备树,使用内核gpio-poweroff驱动实现LED控制
gpiochip0: GPIOs 0-53, parent: platform/fe200000.gpio, pinctrl-bcm2835:
gpio-0 (ID_SDA )
gpio-1 (ID_SCL )
gpio-2 (SDA1 )
gpio-3 (SCL1 )
gpio-4 (GPIO_GCLK )
gpio-5 (GPIO5 )
gpio-6 (GPIO6 )
gpio-7 (SPI_CE1_N )
gpio-8 (SPI_CE0_N )
gpio-9 (SPI_MISO )
gpio-10 (SPI_MOSI )
...省略
dtoverlay=gpio-poweroff,gpiopin=10,export=1
gpiochip0: GPIOs 0-53, parent: platform/fe200000.gpio, pinctrl-bcm2835:
gpio-0 (ID_SDA )
gpio-1 (ID_SCL )
gpio-2 (SDA1 )
gpio-3 (SCL1 )
gpio-4 (GPIO_GCLK )
gpio-5 (GPIO5 )
gpio-6 (GPIO6 )
gpio-7 (SPI_CE1_N )
gpio-8 (SPI_CE0_N )
gpio-9 (SPI_MISO )
gpio-10 (SPI_MOSI |power_ctrl ) out lo
...省略
// Definitions for gpio-poweroff module
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target-path = "/";
__overlay__ {
power_ctrl: power_ctrl {
compatible = "gpio-poweroff";
gpios = <&gpio 26 0>;
force;
};
};
};
fragment@1 {
target = <&gpio>;
__overlay__ {
power_ctrl_pins: power_ctrl_pins {
brcm,pins = <26>;
brcm,function = <1>; // out
};
};
};
__overrides__ {
gpiopin = <&power_ctrl>,"gpios:4",
<&power_ctrl_pins>,"brcm,pins:0";
active_low = <&power_ctrl>,"gpios:8";
input = <&power_ctrl>,"input?";
export = <&power_ctrl>,"export?";
timeout_ms = <&power_ctrl>,"timeout-ms:0";
};
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。