Interrupts on GPIO (on RPI, specifically, but also in general)

Jason Thorpe <[email protected]> Wed, 18 Apr 2018 22:28:34 -0700
Newsgroups gmane.os.netbsd.devel.embedded
Message-ID <[email protected]>
There seems to be support for interrupts on GPIO, but no in-tree =
examples of how it=E2=80=99s used, programming patterns, etc.

Anyone have any solid examples?

Context: I have a device I=E2=80=99m building that is going to have some =
buttons, a switch or two, and a rotary encoder for input.  Path of least =
resistance is to use an AVR and an existing software library for said =
AVR to emulate a USB keyboard (the =E2=80=9Cthrow more hardware at the =
problem=E2=80=9D approach).  But I have enough GPIO pins on the =
Raspberry Pi for the task and I loathe to make the PCB more complicated =
than it has to be, so I=E2=80=99m considering writing an =
interrupt-driven =E2=80=9Cgpiokbd=E2=80=9D driver that would allow me to =
map GPIO input pin interrupts to a configurable set of =E2=80=9Cwskbd=E2=80=
=9D input events.  I could poll, but I *really* don=E2=80=99t want too, =
and if I=E2=80=99m forced down that path, then I=E2=80=99d almost rather =
use the AVR solution.

I found Manuel Bouyer=E2=80=99s chart plotter driver that uses this on =
Github, but it seems to have some FDT conditionals, as well=E2=80=A6

Just looking for guidance here=E2=80=A6 don=E2=80=99t want to go down =
the rabbit hole only to have it be a fruitless exercise.

Thx.

-- thorpej