nanogui: Button interaction over GPIO


Previous by date: 9 Nov 2006 03:53:46 +0000 Re: Problem With GrGetNextEventTimeout()?, Gil Glass
Next by date: 9 Nov 2006 03:53:46 +0000 Transparent bound for polygon window draw, celeber2.gmail.com
Previous in thread: 9 Nov 2006 03:53:46 +0000 Re: Button interaction over GPIO, tj
Next in thread:

Subject: RE: [nanogui] Button interaction over GPIO
From: Prafulla WADASKAR ####@####.####
Date: 9 Nov 2006 03:53:46 +0000
Message-Id: <006501c703b2$903ac0a0$872cc70a@dlh.st.com>

Hi raph

You need to develop kernel space keyboard driver which will generate
keypress/release events to the linux input subsystem, you can find
references in ./drivers/input/keyboard 
Then using standard event interface of linux input subsystem you can get
events in userspace using device node /dev/input/event# (evdev.ko need to be
installed for this)
If you are configuring console=tty0 then your STDIN will become installed
keypad and nano-X should work with appropreate configuration
If you are using any other console (generally serial port in most of cases)
then, for nano x you need to add keypad driver which polls events from
/dev/input/event0 and generates events for nano-X

Regards..
Prafulla . .


-----Original Message-----
From: Raph HP ####@####.#### 
Sent: Monday, November 06, 2006 3:08 PM
To: ####@####.####
Subject: [nanogui] Button interaction over GPIO

Hello,

I am looking for a way to have some interaction with Nano-X through buttons
connected via general purpose I/O (GPIO) to an ARM9 board running Linux
2.6.15.

By now, I am launching a thread that simply reads all GPIO ports all 30ms
(the code is below). But it does not work well, it lasts a long time until
Nano-X reacts to the pressing of a key.

I guess it would be the best to use Nano-X's event handling. But in order to
achieve that, I suppose that I need a driver, don't I?

Any help would be very appreciated

Thanks

raph


/* read ports */
while (1) {
     port = 2;
     result = read(handle[port], &b[port], 1);

     if (b[port] == 0x07) { /* button connected to 2 pressed */
         if (red_button_state == 0) {
             red_button_state = 1;
                 printf("DEBUG: red button switched on\n");
             }
         }
         else {
             if (red_button_state == 1) {
                 printf("DEBUG: red button switched off\n");
                 red_button_state = 0;
             }
         }
         if (result != 1) {
             perror("Can't read byte from port");
             return;
         }
     usleep(READ_CONST * 1000);
}

---------------------------------------------------------------------
To unsubscribe, e-mail: ####@####.####
For additional commands, e-mail: ####@####.####



Previous by date: 9 Nov 2006 03:53:46 +0000 Re: Problem With GrGetNextEventTimeout()?, Gil Glass
Next by date: 9 Nov 2006 03:53:46 +0000 Transparent bound for polygon window draw, celeber2.gmail.com
Previous in thread: 9 Nov 2006 03:53:46 +0000 Re: Button interaction over GPIO, tj
Next in thread:


Powered by ezmlm-browse 0.20.