C++ and PERL Hardware Abstraction Library

Library of C++/PERL objects providing a high-level abstraction of the BeagleBone peripherals

Posted by Angel on 2012-10-01T16:55:34-04:00

For example, to use pin P8[3] 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[6]
  • 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[3], 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();

voila!

Find the full user documentation at http://sourceforge.net/p/bonelib/wiki/Home/

Comments are not currently available for this post.