Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

adds/app/keys

Explain how to use keys driver.

 #include <dev/keys.h>

 NUTDEVICE* devKeys;
 
 //register device driver in system
 if (NutRegisterDevice(&devKeys0, D, 0)) {
 NutPrintFormat(0, "Registering keys device failed\r\n");
 } else {
 NutPrintFormat(0, "Registering keys device sucess.\r\n");
 }

 //init device driver
 devKeys = NutDeviceOpen("keys0");
 
 //blocking operation
        NutPrintFormat(0, "\r\nKey status: %02X", getK());
 
 //wait 10s for press key
 for(i=0;i<10;i++) {
 //Nonblocking operation
 c = getKey();
 NutSleep(1000);
 }


Generated on Thu Jan 30 22:30:43 2003 for EduNet by doxygen1.2.18