examples: Isr.java now catches exception if invalid pin is specified
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
65dc2e7ea3
commit
a51f3a939f
@@ -50,8 +50,14 @@ public class Isr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
|
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
Gpio gpio = null;
|
||||||
|
try {
|
||||||
|
gpio = new Gpio(pin);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
System.out.println("Starting ISR for pin " + Integer.toString(pin) + ". Press ENTER to stop");
|
System.out.println("Starting ISR for pin " + Integer.toString(pin) + ". Press ENTER to stop");
|
||||||
Gpio gpio = new Gpio(pin);
|
|
||||||
Runnable callback = new JavaCallback(gpio);
|
Runnable callback = new JavaCallback(gpio);
|
||||||
gpio.isr(Edge.EDGE_RISING, callback);
|
gpio.isr(Edge.EDGE_RISING, callback);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user