Skip to content
Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
C C++ Python CMake Other
Branch: master
Clone or download
Mani-Sadhasivam gpio: Introduce mraa_gpio_init_by_name API
This commit introduces mraa_gpio_init_by_name API for initializing
a GPIO by its line name provided by the kernel. This feature depends
on the GPIO chardev support and also the line names present in devicetree
or board files. Accessing GPIO using its line name, removes the dependency
from MRAA specific pin mapping and provides a cleaner way to access GPIOs.
This will solve the issue created by an external gpiochip probing before
the SoC's internal gpio controller and thereby making the MRAA pin mapping
wrong.

Currently, this API only supports initializing a single GPIO at a time.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1
Latest commit 0a12c5a May 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
api gpio: Introduce mraa_gpio_init_by_name API May 10, 2019
cmake oe-sdk_cross: remove in favour of devtool May 8, 2019
docs up2: update docs to point to new wiki link Sep 20, 2018
doxygen2jsdoc @ 67cad69 Travis CI and Documentation Generation improvements Aug 10, 2017
doxyport @ db3e1a6 Travis CI and Documentation Generation improvements Aug 10, 2017
examples examples/c++/uart.cpp: Add fix for potential memory leak Mar 6, 2019
imraa imraa: match version number in imraa.c with imraa.conf Apr 19, 2017
include gpio: Introduce mraa_gpio_init_by_name API May 10, 2019
jsstub jsstub: add MIT header to source Mar 28, 2019
scripts cmake: Remove all cpack options including IPK generation Mar 5, 2018
src gpio: Introduce mraa_gpio_init_by_name API May 10, 2019
tests ioinit: Update to build/test C++ ioinit Jul 30, 2018
tools tools: remove INSTALLGPIOTOOL flag Nov 2, 2017
.clang-format clang-format: run clang-format on C/C++ code Mar 23, 2015
.gitignore docs: improve android things docs Oct 11, 2017
.gitmodules Travis CI and Documentation Generation improvements Aug 10, 2017
.travis.yml travis-ci: Added minimal travis job Mar 13, 2018
CMakeLists.txt TargetArch: remove cmake module May 8, 2019
CONTRIBUTING.md CONTRIBUTING.md: Add author rules and suggestion on filing issues for… Oct 24, 2016
COPYING docs: Update various references and texts Sep 21, 2017
Doxyfile.in examples: cleanup examples directory Jan 18, 2018
Doxyfile.java.in Travis CI and Documentation Generation improvements Aug 10, 2017
DoxygenLayout.xml DoxygenLayout.xml: move akward dep graph to the bottom Sep 7, 2014
README.md readme: update project status to reflect Eclipse transition May 7, 2019
docker-compose.yaml gtest: Organized Gtest unit tests Jul 24, 2018

README.md

libmraa - Low Level Skeleton Library for Communication on GNU/Linux platforms

Libmraa is a C/C++ library with bindings to Java, Python and JavaScript to interface with the IO on Galileo, Edison & other platforms, with a structured and sane API where port names/numbering matches the board that you are on. Use of libmraa does not tie you to specific hardware with board detection done at runtime you can create portable code that will work across the supported platforms.

The intent is to make it easier for developers and sensor manufacturers to map their sensors & actuators on top of supported hardware and to allow control of low level communication protocol by high level languages & constructs.

The MRAA project is joining the Eclipse Foundation as an Eclipse IoT project. You can read more about this here.

Build Status Quality Gate

Supported Boards

X86

ARM

MIPS

FPGA

USB

I2C

Mock

JSON platform

Installing on your board

Installing on Ubuntu

Here is a PPA for installing on Ubuntu Xenial or Bionic: https://launchpad.net/~mraa/+archive/ubuntu/mraa

sudo add-apt-repository ppa:mraa/mraa
sudo apt-get update
sudo apt-get install libmraa2 libmraa-dev libmraa-java python-mraa python3-mraa node-mraa mraa-tools

Running MRAA tools or applications on Ubuntu systems requires elevated permissions (e.g. run with sudo).

Install on Arch Linux

There is an AUR package for mraa here: https://aur.archlinux.org/packages/mraa

Install on openSUSE

REPO="openSUSE_Tumbleweed"
if test "$(arch)" == "aarch64"; then
  REPO="openSUSE_Factory_ARM"
fi
sudo zypper ar http://download.opensuse.org/repositories/hardware/$REPO/hardware.repo
sudo zypper in mraa

Install on Fedora Linux

There is an mraa package in the main Fedora repository so it can be dnf installed in all recent Fedora releases. The Node.js and Python 3 bindings are packaged as separate packages.

sudo dnf install mraa nodejs-mraa python3-mraa

Installing for Node.js only

Note: Node.js 7.0.0+ is not currently supported unless compiling with a patched vesion of SWIG. See the corresponding section and document below.

You can also install just the node.js mraa module by using npm. You will need a C++ compiler and the node development headers, however it's not required to have SWIG installed. This works for node versions 6.x.x and prior.

npm install mraa

Note that installing mraa in this way builds mraa without json-c so you cannot use mraa_init_json_platform(). Also building this way means the mraa.node includes a static version of libmraa rather than relying on a dynamic library in /usr/lib.

Subplatforms (i.e. Firmata) have to be added manually with this kind of install from your application, as shown in this example.

Compiling

See documentation on building

Examples

See the examples available for various languages

Debugging

Sometimes it just doesn't want to work, let us try and help you, you can file issues in github or join us in #mraa on freenode IRC, hang around for a little while because we're not necessarily on 24/7, but we'll get back to you! Have a glance at our debugging page too.

API Documentation

Contact Us

To ask questions either file issues in github or send emails on our mailing list. You might also catch us on the mraa channel on freenode IRC.

See the Contribution documentation for more details.

Changelog

Version changelog here.

You can’t perform that action at this time.