写一段设备树配置,有4个输入中断,位于不同组,2个输出gpio口,默认输出高
时间: 2023-04-06 15:00:48 浏览: 79
STM32开发项目:如何配置GPIO的外部中断
我可以回答这个问题。以下是设备树配置的代码:
```
interrupt-parent = <&gpio>;
gpio-controller;
#gpio-cells = <2>;
input@0 {
compatible = "gpio-keys";
gpios = <&gpio 1 0>;
interrupt-parent = <&gpio>;
interrupts = <0 2>;
label = "Button 1";
};
input@1 {
compatible = "gpio-keys";
gpios = <&gpio 2 0>;
interrupt-parent = <&gpio>;
interrupts = <0 3>;
label = "Button 2";
};
input@2 {
compatible = "gpio-keys";
gpios = <&gpio 3 0>;
interrupt-parent = <&gpio>;
interrupts = <1 2>;
label = "Button 3";
};
input@3 {
compatible = "gpio-keys";
gpios = <&gpio 4 0>;
interrupt-parent = <&gpio>;
interrupts = <1 3>;
label = "Button 4";
};
output@0 {
compatible = "gpio-leds";
gpios = <&gpio 5 0>;
label = "LED 1";
default-state = "on";
};
output@1 {
compatible = "gpio-leds";
gpios = <&gpio 6 0>;
label = "LED 2";
default-state = "on";
};
```
这个设备树配置有4个输入中断,位于不同组,2个输出gpio口,默认输出高。其中,Button 1和Button 2位于一组,Button 3和Button 4位于另一组。LED 1和LED 2是输出gpio口,默认输出高。
阅读全文