欢迎来到天天文库
浏览记录
ID:8273851
大小:179.00 KB
页数:38页
时间:2018-03-15
《驱动开发-6x6矩阵键盘驱动》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、AT91SAM9263WINCE6.0R2驱动开发-6X6矩阵键盘驱动1.原理图2.代码viewplaincopytoclipboardprint?01.#include02.#include03.#include04.#include05.#include06.#include07.#include08.#include09.#incl
2、ude"matrixkey.h"10.#include"Oal_timer.h"11.#include"at91_pio.h"12.//Controllerincludes13.#include"at91sam9263_gpio.h"14.#include"AT91SAM9263_oal_intr.h"15.#include"atmel_oal_ioctl.h"16.staticHANDLEm_hMute;17.18.staticBYTEVirtualkey0=VK_NUMPAD0;19.stat
3、icHANDLEm_hevInterrupt0;20.staticHANDLEgintThread0;21.staticDWORDg_dwSysIntrToIrq0=SYSINTR_UNDEFINED;22.23.staticBYTEVirtualkey1=VK_NUMPAD0;24.staticHANDLEm_hevInterrupt1;25.staticHANDLEgintThread1;26.staticDWORDg_dwSysIntrToIrq1=SYSINTR_UNDEFINED;27.
4、28.staticBYTEVirtualkey2=VK_NUMPAD0;29.staticHANDLEm_hevInterrupt2;30.staticHANDLEgintThread2;31.staticDWORDg_dwSysIntrToIrq2=SYSINTR_UNDEFINED;32.33.staticBYTEVirtualkey3=VK_NUMPAD0;34.staticHANDLEm_hevInterrupt3;35.staticHANDLEgintThread3;36.staticD
5、WORDg_dwSysIntrToIrq3=SYSINTR_UNDEFINED;37.38.staticBYTEVirtualkey4=VK_NUMPAD0;39.staticHANDLEm_hevInterrupt4;40.staticHANDLEgintThread4;41.staticDWORDg_dwSysIntrToIrq4=SYSINTR_UNDEFINED;42.43.staticBYTEVirtualkey5=VK_NUMPAD0;44.staticHANDLEm_hevInter
6、rupt5;45.staticHANDLEgintThread5;46.staticDWORDg_dwSysIntrToIrq5=SYSINTR_UNDEFINED;47.////////////////////////////////////////48.49.staticBYTEint9keyup=0;50.51.staticvoidloopn(UINT32wCount)52.{53.volatileunsignedinti,k,j=0;54.for(k=0;k7、or(i=0;i<100;i++){j++;}//400n56.}57.58.staticDWORDKeyPadLock()59.{60.DWORDdwStatus;61.62.dwStatus=WaitForSingleObject(m_hMute,INFINITE);63.if(dwStatus==WAIT_OBJECT_0){64.dwStatus=ERROR_SUCCESS;65.}else{66.dwStatus=GetLastError();67.}68.69.returndwStat8、us;70.}71.72.staticDWORDKeyPadUnLock()73.{74.DWORDdwStatus=ERROR_SUCCESS;75.BOOLfOk;76.77.fOk=ReleaseMutex(m_hMute);78.if(!fOk){79.dwStatus=GetLastError();80.}81.82.returndwStatus;83.}84.85.//中断脚输入为低则返回TRUE,否则返回FALSE86.staticBOOLIsIntPortLow(u
7、or(i=0;i<100;i++){j++;}//400n56.}57.58.staticDWORDKeyPadLock()59.{60.DWORDdwStatus;61.62.dwStatus=WaitForSingleObject(m_hMute,INFINITE);63.if(dwStatus==WAIT_OBJECT_0){64.dwStatus=ERROR_SUCCESS;65.}else{66.dwStatus=GetLastError();67.}68.69.returndwStat
8、us;70.}71.72.staticDWORDKeyPadUnLock()73.{74.DWORDdwStatus=ERROR_SUCCESS;75.BOOLfOk;76.77.fOk=ReleaseMutex(m_hMute);78.if(!fOk){79.dwStatus=GetLastError();80.}81.82.returndwStatus;83.}84.85.//中断脚输入为低则返回TRUE,否则返回FALSE86.staticBOOLIsIntPortLow(u
此文档下载收益归作者所有