| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -456,15 +456,18 @@ public static void waitFor(int pin, int mode) { | |||
| 456 | 456 | ||
| 457 | 457 | /** | |
| 458 | 458 | * Waits for the value of an input pin to change | |
| 459 | + * | ||
| 460 | + * This function will throw a RuntimeException in case of a timeout. | ||
| 459 | 461 | * @param pin GPIO pin | |
| 460 | 462 | * @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING | |
| 461 | 463 | * @param timeout don't wait more than timeout milliseconds | |
| 462 | - * @return true if the interrupt occured, false if the timeout occured | ||
| 463 | 464 | * @webref | |
| 464 | 465 | */ | |
| 465 | - public static boolean waitFor(int pin, int mode, int timeout) { | ||
| 466 | + public static void waitFor(int pin, int mode, int timeout) { | ||
| 466 | 467 | enableInterrupt(pin, mode); | |
| 467 | - return waitForInterrupt(pin, timeout); | ||
| 468 | + if (waitForInterrupt(pin, timeout) == false) { | ||
| 469 | + throw new RuntimeException("Timeout occurred"); | ||
| 470 | + } | ||
| 468 | 471 | } | |
| 469 | 472 | ||
| 470 | 473 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments