easyBlack C++ Library

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

Posted by Angel on 2014-11-04T15:30:39-05:00

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 = 10const int DELAY = 250000int 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.LOWconst unsigned char high = myExample.HIGH// Set pin mode.
  myExample.pinMode (usr0, output);

  for (int x = 0// 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 ()

Comments are not currently available for this post.