aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wirish/wirish_digital.c5
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;