主题 : QQ2440在linux下怎么设置GPIO的中断触发方式? 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 2164
精华: 0
发帖: 18
金钱: 125 两
威望: 71 点
贡献值: 0 点
综合积分: 36 分
注册时间: 2008-10-29
最后登录: 2012-03-16
楼主  发表于: 2009-09-03 22:00

 QQ2440在linux下怎么设置GPIO的中断触发方式?

请问一下版主,我准备以中断的方式,使用GPIO作为外部脉冲计数。设置GPXCON后,默认低电平触发,可是想设置成上升沿触发或下降沿触发,怎么设置修改中断触发方式啊?谢谢!
[ 此帖被bluewarrior在2009-09-03 22:27重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-09-04 11:23
可以用set_irq_type(), 这是2.6.29里的实现

/**
*    set_irq_type - set the irq trigger type for an irq
*    @irq:    irq number
*    @type:    IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
*/
int set_irq_type(unsigned int irq, unsigned int type)
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."