日期:2014-05-16 浏览次数:20807 次
//--------------------------------------------------------
// 作者:longtian635241(longtian_huang@urbetter.com)
// 论坛ID:idea6410
// 版权:idea6410
// 平台:友坚idea6410开发板
// 发布日期:2012-11-22
// 最后修改:2012-11-22
//http://www.urbetter.com/main.asp
//----------------------------------------------------------
/* gpio buttons */
static struct gpio_keys_button gpio_buttons[] = {
{
.gpio = S3C64XX_GPN(0),
//.code = 25,
.code = KEY_UP,
.desc = "BUTTON1",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(1),
//.code = 42,
.code = KEY_LEFT,
.desc = "BUTTON2",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(2),
//.code = 50,
.code = KEY_RIGHT,
.desc = "BUTTON3",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(3),
//.code = 10,
.code = KEY_DOWN,
.desc = "BUTTON4",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(4),
//.code = 24,
.code = KEY_ESC,
.desc = "BUTTON5",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(5),
//.code = 38,
.code = KEY_ENTER,
.desc = "BUTTON6",
.active_low = 1,
.wakeup = 0,
}
};
static struct gpio_keys_platform_data gpio_button_data = {
.buttons = gpio_buttons,
.nbuttons = ARRAY_SIZE(gpio_buttons),
};
static struct platform_device gpio_button_device = {
.name = "gpio-keys",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &gpio_button_data,
}
};
idea6410的GIPO-KEYS,也就是单板上面的6个按键功能的实现:
需要添加头文件:
#include <linux/gpio_keys.h>,(默认已有)
#include <linux/input.h>