diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-02-25 13:15:07 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-02-25 13:15:07 -0500 |
commit | 262e01aa1f5944544df040105e764e62a7864883 (patch) | |
tree | badbdddf69b274ae03d908e2fe6e6ef3f47e6c55 | |
parent | 4e493c670aaabd8179976621d4b0bf3997fdc814 (diff) | |
download | librambutan-262e01aa1f5944544df040105e764e62a7864883.tar.gz librambutan-262e01aa1f5944544df040105e764e62a7864883.zip |
Trivial wirish_digital.c sanity check + bugfix.
-rw-r--r-- | wirish/wirish_digital.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/wirish/wirish_digital.c b/wirish/wirish_digital.c index 6f9906d..bb28f0a 100644 --- a/wirish/wirish_digital.c +++ b/wirish/wirish_digital.c @@ -105,11 +105,16 @@ void digitalWrite(uint8 pin, uint8 val) { } void togglePin(uint8 pin) { + if (pin >= NR_GPIO_PINS) { + return; + } + gpio_toggle_pin(PIN_MAP[pin].port, PIN_MAP[pin].pin); } uint8 isButtonPressed() { if (digitalRead(BOARD_BUTTON_PIN)) { + delay(1); while (digitalRead(BOARD_BUTTON_PIN)) ; return true; |