Beagle Board - beagleboard.org

C++ and PERL Hardware Abstraction Library

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

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/


Homepage: https://sourceforge.net/projects/bonelib/
Registrar: janick-bergeron.myopenid.com



Tags:
Projected created on: Mon Oct 01 2012 16:55:34 GMT-0000 (UTC)
Submitted by: janick-bergeron.myopenid.com
Last updated on: Wed Oct 03 2012 15:01:43 GMT-0000 (UTC)

10327
10327