⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testmatrixbutton.c

📁 矩阵button驱动
💻 C
字号:
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "btnIO.h"int main(){    int fd=-1;    unsigned char positon[2]={0};    unsigned char ch=0;    fd=open("/dev/matrix_button",O_RDWR);    if(fd<0)    {        printf("open matrix_button failure\n");        return fd;    }    else    {        printf("open matrix_button successfully\n");    }    while(1)    {        //read(fd,&ch,1);        ch = btnRead(fd);        /*        if( positon[0] && (positon[0] & ~0x80) )        {            printf("position(%x,%x)\n",positon[0],positon[1]);        }        */        printf("button :::%c\n",ch);        ch=0;        //sleep(1);    }    close(fd);    printf("close matrix_button successfully\n");        return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -