For example, to use pin P8 as an input with a pull-down, you normally have to:
- Look up the BeagleBone System Reference Manual and determine that pin 3 on connector P8 corresponds to GPIO1
- Set the pin muxing to mode 7 + input + pull-down by writing 007 to /sys/kernel/debug/omap_mux/gpmac_ad6
- Export the GPIO system files by writing 38 to /sys/class/gpio (btw, “38” does not come from P8, but from 1*32+6).
- Set the GPIO to input by writing “in” to /sys/class/gpio/gpio38/direction
- Sample the input by reading /sys/class/gpio/gpio38/value
Still with me? Bonelib makes it as simple as:
BeagleBone::gpio* inp = BeagleBone::gpio::P8(3); inp->configure(BeagleBone::pin::IN, BeagleBone::pin::PD); unsigned char val = inp->get();
Find the full user documentation at http://sourceforge.net/p/bonelib/wiki/Home/
Comments are not currently available for this post.