This project is a dedicated library for access GPIO on the BeagleBone Black. The library provide each pin as a stream, and it can use as input or output.
Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.
#include <thread>
#include <chrono>
#include "bbbgpio/stream.hpp"
int main()
{
bbb::gpio::ostream ogpio{66}; // Open GPIO 66 as output
ogpio << bbb::gpio::pin_level::high; // Set GPIO 66 to high level
{
// Do something
std::this_thread::sleep_for(std::chrono::seconds(1));
}
ogpio << bbb::gpio::pin_level::low; // Set GPIO 66 to low level
bbb::gpio::istream igpio{67}; // Open GPIO 67 as input
bbb::gpio::pin_level gpio_lvl;
igpio >> gpio_lvl; // Read current level on GPIO 67
// bbb::gpio uses RAII
return 0;
}
There are others libraries for GPIO on BBB, however, none of them give access as a file stream.
This project carries some scripts to help these steps, however, you will need some packages:
The build process is very simple, just run:
The app build/test/test_gpio will be created. It runs all unit tests. You could run under valgrind:
All tests are executed in Travis CI
If you want run in some machine, will need Boost Test
Uilian Ries [email protected]
The underlying source code is licensed under the MIT license.