|
本帖最后由 thy110 于 2017-12-28 18:33 编辑
我参照晚上移植按键的教程,直接在设备树下面添加gpio口信息,然后make menuconfig ,添加按键模块,然后编译烧录,
- gpio_keys {
- compatible = "gpio-keys";
- #address-cells = <1>;
- #size-cells = <0>;
- autorepeat;
- button@1 {
- label = "Key1";
- linux,code = <49>;
- gpios = <&gpio8 GPIO_A0 GPIO_ACTIVE_LOW>;
- };
- button@2 {
- label = "Key2";
- linux,code = <50>;
- gpios = <&gpio8 GPIO_A1 GPIO_ACTIVE_LOW>;
- };
-
- button@3 {
- label = "Key3";
- linux,code = <51>;
- gpios = <&gpio8 GPIO_A2 GPIO_ACTIVE_LOW>;
- };
-
- button@4 {
- label = "Key4";
- linux,code = <52>;
- gpios = <&gpio8 GPIO_A3 GPIO_ACTIVE_LOW>;
- };
-
- button@5 {
- label = "Key5";
- linux,code = <53>;
- gpios = <&gpio8 GPIO_A4 GPIO_ACTIVE_LOW>;
- };
-
- button@6 {
- label = "Key6";
- linux,code = <54>;
- gpios = <&gpio6 GPIO_A0 GPIO_ACTIVE_LOW>;
- };
-
- button@7 {
- label = "Key7";
- linux,code = <55>;
- gpios = <&gpio6 GPIO_A1 GPIO_ACTIVE_LOW>;
- };
-
- button@8 {
- label = "Key8";
- linux,code = <56>;
- gpios = <&gpio6 GPIO_A2 GPIO_ACTIVE_LOW>;
- };
-
- button@9 {
- label = "Key9";
- linux,code = <57>;
- gpios = <&gpio6 GPIO_A3 GPIO_ACTIVE_LOW>;
- };
-
- button@10 {
- label = "Key10";
- linux,code = <58>;
- gpios = <&gpio6 GPIO_A4 GPIO_ACTIVE_LOW>;
- };
-
- button@11 {
- label = "Key11";
- linux,code = <59>;
- gpios = <&gpio2 GPIO_A0 GPIO_ACTIVE_LOW>;
- };
-
- button@12 {
- label = "Key12";
- linux,code = <60>;
- gpios = <&gpio2 GPIO_A1 GPIO_ACTIVE_LOW>;
- };
- button@13 {
- label = "Key13";
- linux,code = <61>;
- gpios = <&gpio2 GPIO_A2 GPIO_ACTIVE_LOW>;
- };
- button@14 {
- label = "Key14";
- linux,code = <62>;
- gpios = <&gpio2 GPIO_A3 GPIO_ACTIVE_LOW>;
- };
- button@15 {
- label = "Key15";
- linux,code = <63>;
- gpios = <&gpio2 GPIO_A4 GPIO_ACTIVE_LOW>;
- };
- button@16 {
- label = "Key16";
- linux,code = <64>;
- gpios = <&gpio2 GPIO_A5 GPIO_ACTIVE_LOW>;
- };
- };
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|