Coder Social home page Coder Social logo

alex0freeman / armbianio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitbank2/armbianio

0.0 1.0 0.0 223 KB

A C (+ Python and Java) library for simplifying access to I2C, SPI and GPIO on boards supported by Armbian

License: GNU General Public License v3.0

Makefile 0.45% C 45.05% Java 11.34% Shell 8.45% Python 34.70%

armbianio's Introduction

Logo

ArmbianIO is a C library for accessing I2C, SPI and GPIO ports in a consistent way across all of the SBCs that Armbian supports. Since Armbian supports SBCs from multiple OEMs using a variety of SoCs, the GPIO pin numbering is different on each board. Linux provides kernel drivers for communicating with the I2C and SPI bus in a consistent way, but the GPIO numbering can vary widely. This library aims to create simple wrapper functions for accessing I2C, SPI and creates a consistent numbering scheme for accessing GPIO ports based on the physical pin number. Other I/O libraries have tried to copy the BCM (Broadcom) I/O numbering to be compatible with Raspberry Pi hardware, but this creates a new layer of confusion and incompatibility since different boards expose different numbers and arrangements of GPIO ports. By using a numbering scheme based on the physical pin numbers of the boards, it becomes much easier to correctly connect devices on every board supported by Armbian. This also allows for boards with additional GPIOs such as the Orange Pi Zero which has two more usable pins on its TTY header.

NB: ArmbianIO requires Armbian with a mainline (4.x) kernel. Older versions don't have the unique board identifier (/run/machine.id)

Features

  • Now supports any Linux distribution for ARM SBCs (e.g. RPI, OrangePi, NanoPi, etc)
  • Will support all SBCs supported by Armbian (soon)
  • Includes simple functions for communicating with GPIO, I2C and SPI buses
  • References GPIO pins by physical pin number
  • Includes functions for detecting presence of and reading status of on-board key/button (not all boards have one)
  • Python bindings are generated with ctypesgen
  • Cross platform RPi.GPIO clone is in the works
  • Java bindings use a simple interface file and JNA

To build the C library, simply type 'make' in the terminal. To build the sample app, type 'make -f make_demo'. This will build the 'demo' executable to show that the library is working.

To build Python bindings cd ArmbianIO/python then ./wrapper.sh. You can run as many times as you like since the script cleans up and regenerates the wrapper from the C headers. sudo python ledtest.py to run LED test after wiring up project.

To build Java bindings cd ArmbianIO/java then ./wrapper.sh. You can run as many times as you like since the script cleans up and compiles the wrapper. The Java bindings depend on Oracle JDK 8 which wrapper.sh installs. If you wish to use another JDK then you will need to modify wrapper.sh. Use sudo java -Djava.library.path=/usr/local/lib -cp jna-4.5.0.jar:armbianio.jar:. LedTest to run LED test after wiring up project.

Copyright (c) 2017 by Larry Bank
Project started 11/13/2017
[email protected]

If you find this code useful, please consider buying me a cup of coffee
paypal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.