Re: joypad interrupt question

From: Phil Blundell <pb_at_reciva.com>
Date: Tue, 29 Mar 2005 22:07:03 +0100

On Tue, 2005-03-29 at 11:57 -0800, Erik Hovland wrote:
> - The GPIO joypad interrupts are set up to interrupt on rising and
> falling edge and for 'maximum' filtering.
> 1. What is 'maximum' filtering or what is filtering in this context?

I think the "filtering" in this context is glitch suppression, or
debouncing. You should be able to find some details in the SAMCOP
and/or s3c2410 datasheets.

> In the case of say the center press of the joypad the code attempts to
> register a 'action' key.
> 2. If someone pressed the center of the joypad I would expect there to
> to be a interrupt generated for the rising edge and for the isr to
> read a 1 from the proper bit for the center press. Then another
> interrupt generated for the falling edge and for the isr to read a
> 1 again from the proper bit. The isr would use make_keypress for
> 'action' and 1 for the rising edge and a make_keypress for 'action'
> and 0 for the falling edge. Is this sequence of events correct?

Yes, except that it's the other way around. The bit is 1 when the key
is not pressed, and goes to 0 when the key is pressed.

> - The function gpio_to_keys flips the bits of the value read from the
> GPA data register, why? That register shouldn't have anything
> different then for application buttons which don't do this to the
> value read.

For the same reason as above: these are active low signals. Actually,
the code does do this for the application buttons too, just not in quite
the same way. This line:

        down = (h5400_asic_read_register (H5400_ASIC_GPIO_GPA_DAT) &
b->bitmask) ? 0 : 1;

will yield 0 if the bit in the register is set, and 1 if the bit is
clear.

> - The map of buttons is written such that if the joypad NW press is done
> there is the possibility for both a 'up' and a 'left' key press. Is
> this done for a reason?

Older iPAQs were able to detect "diagonal" button presses and generate
the appropriate pair of key events. There are a few applications for
which this is handy. You might be right that trying to do the same on
the h5400 is causing more trouble than it's worth.

p.
Received on Tue Mar 29 2005 - 16:09:51 EST

This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:20:11 EDT