Beagle Board - beagleboard.org

easyBlack C++ Library

(Arduino Style) Beaglebone Black C++ Library for GPIO using high performance of mmap.

PreRequisites

Debian and Ubuntu:

sudo apt-get install -y build-essential g++
wget -c https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
chmod +x dtc.sh
sudo ./dtc.sh

Example

See more examples en examples directory.

#include "memGPIO.hpp"

const int REPEATS = 10;
const int DELAY = 250000;

int main () {
  // Make a instance.
  easyBlack::memGPIO myExample;

  // Get PINs data for better performance.
  easyBlack::memGPIO::gpioPin usr0 = myExample.getPin ("USR0");

  // Get PIN direction for better performance.
  const unsigned char output = myExample.OUTPUT;

  // Get PIN values for better performance.
  const unsigned char low = myExample.LOW;
  const unsigned char high = myExample.HIGH;

  // Set pin mode.
  myExample.pinMode (usr0, output);

  for (int x = 0; x < REPEATS; x++) {
    // Turn USR0 LED on.
    myExample.digitalWrite (usr0, high);

    usleep (DELAY);

    // Turn USR0 LED off.
    myExample.digitalWrite (usr0, low);

    usleep (DELAY);
  }

  // Reset USR0 LED trigger to default.
  myExample.resetLEDPin0ToDefault ();

  // Call the destructor.
  myExample.~memGPIO ();

  exit (EXIT_SUCCESS);
}

Digital and Analog I/O

  • getPin (pinNumber)
  • pinMode (pin, direction, [mux], [pullup], [slew])
  • digitalRead (pin)
  • digitalWrite (pin, value)
  • resetLEDPin0ToDefault ()
  • resetLEDPin1ToDefault ()
  • resetLEDPin2ToDefault ()
  • resetLEDPin3ToDefault ()
  • resetLEDPinsToDefault ()



Homepage: https://github.com/facine/easyBlack
Registrar: manu


Tags: library;bbblack;
Projected created on: Tue Nov 04 2014 15:30:39 GMT-0000 (UTC)
Submitted by: manu
Last updated on: Tue Nov 04 2014 16:46:43 GMT-0000 (UTC)

19127
19127