io.mapsmessaging.devices.gpio.PiInterruptFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deviceLibrary Show documentation
Show all versions of deviceLibrary Show documentation
Provides a plugable Device integration and access
The newest version!
package io.mapsmessaging.devices.gpio;
import com.pi4j.context.Context;
import java.io.IOException;
import java.util.Map;
public class PiInterruptFactory implements InterruptFactory {
private final Pi4JPinManagement pinManagement;
public PiInterruptFactory(Context context){
pinManagement= new Pi4JPinManagement(context);
}
@Override
public InterruptPin allocateInterruptPin(Map config) {
return new InterruptPin(pinManagement.allocateInPin(config));
}
@Override
public void deallocateInterruptPin(InterruptPin pin) throws IOException{
pin.close();
}
}