A simple library for reading input and writing output to GPIO pins on Linux platforms using Sysfs.
SimpleGPIO is split into three components
- simplegpio-core - Core components including a fallback input poller based on a naive pure Java implementation
- simplegpio-module-libbulldog - An enhanced input poller using JNI and libbulldog; this version offers most stability and performance but least portability - the libbulldog library should be downloaded and named 'libbulldog-linux.so'
- simplegpio-module-epoll - A performant and slightly more portable input poller based on calls to epoll using JNA
InputPollerFactory inputPollerFactory = InputPollerFactoryLocator.locate();
PinFactory pinFactory = new PinFactory(inputPollerFactory);
Pin pin = pinFactory.getPin(71); // P8_48 on a Beaglebone Black
DigitalInput in = pin.as(DigitalInput.class);
in.addInterruptListener(new InterruptListener() {
@Override
public void interruptRequest(InterruptEventArgs args) {
System.out.println("Input! " + args.getEdge());
}
});
SimpleGPIO uses maven.
mvn clean install
SimpleGPIO is based on a fork of silverspoon.io's libbulldog with JNA epoll support from jcommon-process.
SimpleGPIO is licensed under Apache License, Version 2.0.