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.

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 untested.

How to use it

First unpack the tarball as usual, for example: tar xzvf twiddle_gpio_and_dio-0.1.tar.gz.

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 opkg install perl or so first.

The Makefile tries to build a test program called dio_test_program when you type 'make -rR' in the distribution directory. The dio_test_program expects to find the twiddle_gpio script in the current directory when it runs.

The 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 ./twiddle_gpio --show-pins 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...

Download

Questions, Comments, Bug Reports

Send them to britton DOT kerin AT gmail DOT com, and put [twiddle_gpio_and_dio] in the subject.

Enjoy.