BoneLib is an OpenSource C++ and PERL library abstracting the hardware operations of the BeagleBone. The functionality of each library is very similar but not garanteed to be identical. The primary purpose of this library is to make it easier to interact with the various peripherals. Performance, although a concern, may not be sufficient for real-time applications.
Examples illustrate how to use the various APIs. You will also find some (contrived) usage examples at the bottom of every source file in the "TEST" section.
|led.cpp||C++ program to control the LEDs using hotkeys|
|led.pl||PERL program to run a pre-determined LED sequence|
|cgi-bin/led.pl||Web-based API to control the LEDs|
This library is work-in-progress, a by-product of getting acquainted with the BeagleBone functionality. Contributions are welcomed.
The current version works on the original BeagleBone White, running a pre-3.8 kernel. Work is in progress to port it to the BegaleBone Black and the newer kernel versions.
Download the library code
$ git clone git://git.code.sf.net/p/bonelib/code bonelib
Select the branch corresponding to your kernel and BeagleBone
$ git checkout white-Angstrom $ git checkout black-dev
Create a link from /usr/bonelib to your installation
$ ln -s $pwd/bonelib /usr/bonelib
Compile the C++ library
$ cd bonelib $ make
$ opkg install perl
If you want to be able to write CGI scripts to control your BeableBoard via a web browser, you will need to have a HTTP server that runs as root. The following details how to install and configure thttp for that purpose.
$ opkg install thttpd
Edit the deamon management file to use a configuration file instead of command-line arguments: Replace all instances '-d /srv/www' with '-C /srv/config'.
$ vi /etc/init.d/thttpd
Create a configuration file for the HTTP server named "/srv/config" with the following content:
user=root dir=/srv/www logfile=/srv/log cgipat=**.pl nosymlinks
Start the HTTP server
$ /etc/init.d/thttpd start
Test your installation: create a link under "/srv/www" to "/usr/bonelib/examples/cgi-bin" and browse to "http://beaglebone.local/bbone/led.pl"
$ ln -s /usr/bonelib/examples/cgi-bin /srv/www/bbone