利用红外线接收器触发中断信号
来源:互联网 发布:京东大数据平台架构 编辑:程序博客网 时间:2024/04/29 14:12
开发板:龙芯1B
PC:ubuntu13.10
本程序利用红外线接收器触发中断信号,然后打印信息,红外线接收器通过gpio控制
/*************************************************************************> File Name: redlight_irq.c> Author: kid> Mail: 280197326@qq.com > Created Time: 2014年03月04日 星期二 16时07分55秒 ************************************************************************/#include <linux/interrupt.h>#include <linux/module.h>#include <linux/init.h>#define SET_GPIO (*(volatile unsigned *)0xbfd010C4)#define SET_IN (*(volatile unsigned *)0xbfd010D4)#define SET_RED (*(volatile unsigned *)0xbfd010F4)int *j = (int*)125;int i = 0;static irqreturn_t redlight (int k, void *p){ printk(KERN_ALERT "%d.receive redlight!\n",i); i++; return (IRQ_HANDLED);}static int __init redlight_init(void){ int result; SET_GPIO = SET_GPIO | 0x20000000; SET_IN = SET_IN | 0x20000000; SET_RED = SET_RED | 0x20000000; result = request_irq(125, redlight, IRQF_SHARED|IRQ_TYPE_LEVEL_LOW, "redlight", j); //请求中断,IRQ_TYPE_LEVEL_LOW为低电平有效 if( result!=0 ){ printk(KERN_WARNING "result=%d\nrequest_irq is fail\n",result); } enable_irq(125); return 0;}static void __exit redlight_exit(void){ free_irq(125, j); //释放内存 printk(KERN_ALERT "quit!\n");}module_init(redlight_init);module_exit(redlight_exit);MODULE_LICENSE("GPL");
0 0
- 利用红外线接收器触发中断信号
- zigbee红外线接收器中断实验
- 接收器触发通知
- 智能控制系统中的信号---红外线
- ABB机器人RAPID编程—外部IO信号触发中断
- 红外线
- 利用系统外部中断做PS键盘信号接收
- Linux下利用信号的异步串口中断响应
- signal-利用中断信号来干别的事情
- 中断、软中断、信号
- 中断 中断信号 中断源
- 中断 中断信号 中断源
- 中断 中断信号 中断源
- 中断触发流程
- 中断触发流程二
- 中断触发流程
- 中断触发流程二
- plx9030触发pci中断
- 三、集合数据类型Collection Data Types
- java.sql.SQLException: ORA-00907: 缺失右括号
- XML解析:DOM、SAX、XMLParser
- Array和Arrays类应用
- hdu_2147_kiki's game
- 利用红外线接收器触发中断信号
- Service 'china' of type 'MapServer' does not exist or is inaccessible
- 旋转数组的最小数字
- 动态规划
- c++日历改进版
- OpenGL: 图形试验
- 链接矩阵快速幂(zoj3497)
- 用pl/sql导出、导入用户的表、存储
- const和static用法