Private
Public Access
2
0

examples: Java GPIO ISR example now takes pin as command line argument

Signed-off-by: Henry Bruce <henry.bruce@intel.com>
This commit is contained in:
Henry Bruce
2016-02-04 12:30:22 -08:00
committed by Brendan Le Foll
parent 6bf706befb
commit 43ae362be8

View File

@@ -38,7 +38,15 @@ public class Isr {
}
}
public static void main(String argv[]) throws InterruptedException {
Gpio gpio = new Gpio(6);
int pin = 6;
if (argv.length == 1) {
try {
pin = Integer.parseInt(argv[0]);
} catch (Exception e) {
}
}
System.out.println("Starting ISR for pin " + Integer.toString(pin));
Gpio gpio = new Gpio(pin);
Runnable callback = new JavaCallback();
@@ -46,8 +54,12 @@ public class Isr {
while (true)
Thread.sleep(999999);
};
}
class JavaCallback extends Runnable {
public void run() { System.out.println("JavaCallback.run()"); }
class JavaCallback implements Runnable {
@Override
public void run() {
System.out.println("Gpio level changed");
}
}