twiddle_gpio/dio.h -- perl/C interface to Beaglebone White IO Pins
What it is
Basically I got annoyed with the half dozen web tutorials that repeat how to
do Beaglebone output on only eight pins, without mentioning which other pins
are available or how to use them as inputs. This little package just tries
to answer this common question in script/program form.
A perl script that can initialize/read/set most of the general purpose IO
bins that are available on the Beaglebone Rev. A6 (AKA Beaglebone White
or BBW) with the Angstrom OS that ships with it. The Beaglebone Black
(AKA BBB) is not supported at the moment because it ships with linux 3.8
(which has a different userspace interface to the IO pins).
A C interface (test program, header, and source file) that can initialize
the pins for reading and efficiently read their values. This also only
works with the Beaglebone White (see previous item).
Unfinished things about this package
The perl script can initialize pins as outputs, or as inputs with the
internal pull-up or pull-down resistors enabled, but not as inputs with both
the internal pull-up and pull-downs disabled. This might be as easy to fix
as the FIXME in the code suggests, but I don't have a need for it and won't
release it untested.
The perl script supports using pins as inputs or outputs, but the C interface
only supports only using pins as inputs. It would be trivial to extend it to
support output as well, but I don't have a need myself and won't release it
How to use it
First unpack the tarball as usual, for example:
For the perl script just run the script as described in the script man page. I forget if perl is
on the shipping Angstrom distribution or if you must do
perl or so first.
Makefile tries to build a test program called
dio_test_program when you type 'make -rR' in the distribution
dio_test_program expects to find the
twiddle_gpio script in the current directory when it runs.
dio_test_program first initialized all pins as inputs with
pull-ups enabled (this takes some seconds). It then spends some time polling
the pins, and prints a message if any of them read low. It then
reinitializes all pins as outputs with pull-downs enable and polls them,
printing messages for any of them that read high. You can patch ground or
3.3V lines into the inputs after it tells you the pins are initialized with
pull-up or pull-down resistors. Try
to get a handy ASCII drawing of the header layout :)
There is currently no test program for using the pins as outputs. I've
checked that it works at one point, and it should still...
Questions, Comments, Bug Reports
Send them to britton DOT kerin AT gmail DOT com, and put
[twiddle_gpio_and_dio] in the subject.