On 11/04/2008, Andy Green <[EMAIL PROTECTED]> wrote: > Somebody in the thread at some point said: > | If there are no spurious changes on the pin, only bouncing after a > | legal change, then it's fine to report the event on the first change > | and wait only if a previous state change was less than 100ms ago. (Not > | that it matter so much for jack detection) > > The issue there is that the interrupt action from seeing an edge is > disconnected from the level sampling action that occured in the ISR. So > we can see an initial edge that is correct as you say, but by the time > the interrupt is serviced and we sample the interrupt as GPIO level, it > may be bouncing and be the wrong level. Waiting it out until the > bouncing is finished does not have this window for error.
Ah, now I see. I wonder if it's ok to assume that an edge detected more than 100ms after a previous interrupt is always the edge opposite to that previous one, so as to avoid sampling the GPIO. I should try it out. Regards
