mx53 linux gpio 模拟matrix keypad
来源:互联网 发布:专业心理学书籍知乎 编辑:程序博客网 时间:2024/05/19 03:22
mx53 linux 用gpio模拟matrix keypad需要做的工作
1、在配置内核驱动的时候添加 gpiomatrix keypad
DeviceDrivers --->
Inputdevice support --->
Keyboards --->
<*> GPIO driven matrix keypad support
2、在mx53_loco.c文件中添加代码
static const uint32_t mx53_keymap[] = {
KEY(0,0, KEY_0),
// KEY(0,1, KEY_A),
// KEY(0,2, KEY_3),
// KEY(0,3, KEY_5),
// KEY(0,4, KEY_6),
// KEY(0,5, KEY_7),
// KEY(0,6, KEY_9),
// KEY(1,0, KEY_9),
// KEY(1,1, KEY_E),
// KEY(1,2, KEY_4),
// KEY(1,3, KEY_R),
// KEY(1,4, KEY_Y),
// KEY(1,5, KEY_8),
// KEY(1,6, KEY_I),
// KEY(2,0, KEY_TAB),
// KEY(2,1, KEY_Q),
// KEY(2,2, KEY_E),
// KEY(2,3, KEY_T),
// KEY(2,4, KEY_G),
// KEY(2,5, KEY_U),
// KEY(2,6, KEY_J),
};
static struct matrix_keymap_data mx53_keymap_data= {
.keymap = mx53_keymap,
.keymap_size = ARRAY_SIZE(mx53_keymap),
};
static const int mx53_row_gpios[] =
{GPIO_4_0};
static const int mx53_col_gpios[] =
{GPIO_4_1};
static struct matrix_keypad_platform_datamx53_pdata = {
.keymap_data = &mx53_keymap_data,
.row_gpios = mx53_row_gpios,
.col_gpios = mx53_col_gpios,
.num_row_gpios = ARRAY_SIZE(mx53_row_gpios),
.num_col_gpios = ARRAY_SIZE(mx53_col_gpios),
.col_scan_delay_us = 10,
.debounce_ms = 80,
// .wakeup = 1,
.active_low = 1,
};
static struct platform_device mx53_device ={
.name = "matrix-keypad",
.id = -1,
.dev = {
.platform_data= &mx53_pdata,
},
};
static void __initmx53_add__matrix_keypad(void)
{
platform_device_register(&mx53_device);
}
在static void __init mxc_board_init(void)函数中添加代码
mx53_add__matrix_keypad();
系统启动后,运行qt程序时,按下按键有如下打印消息
keycode is 48 unicode is 48 modifiers is 0 isPress is 1,autoRepeat is 0
keycode is 48 unicode is 48 modifiers is 0 isPress is 0,autoRepeat is 0
- mx53 linux gpio 模拟matrix keypad
- gpio matrix keypad linux driver
- mx53 linux gpio控制led
- 49 使用linux内核源码里的矩阵键盘驱动<GPIO driven matrix keypad support>
- imx6 添加matrix keypad
- i.mx53 GPIO中断配置
- i.MX53 GPIO 按键驱动
- linux gpio模拟i2c
- linux gpio模拟i2c
- Linux GPIO 模拟I2C
- I.MX53的gpio.c分析
- i.mx53 gpio 中断号的确定
- i.mx53 gpio 中断号的确定
- Freescale i.MX53 GPIO 按键驱动
- Linux 内核gpio模拟I2C
- linux 内核GPIO 模拟 I2C
- linux SPI驱动 - 模拟gpio
- linux keypad driver
- 详解Linux内存使用信息
- Hadoop实战-初级部分-第二部分 Hadoop介绍
- 策略路由
- BeeFramework
- Unity3D学习系列教程
- mx53 linux gpio 模拟matrix keypad
- rt-thread的IPC机制之邮箱源码分析
- android ui 开发
- BOOST mutex 线程锁封装
- linux 文件描述符和库函数FILE文件指针关系
- android中media的datasource
- (转)Android SQLite解析
- Java命令参数说明大全
- Oracle数组,集合