From 262e01aa1f5944544df040105e764e62a7864883 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 25 Feb 2011 13:15:07 -0500 Subject: Trivial wirish_digital.c sanity check + bugfix. --- wirish/wirish_digital.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'wirish') 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; -- cgit v1.2.3