From 350cb6bf20caf22c7a2a5e9267f00d50d11acbdf Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 21 Apr 2014 20:18:06 +0100 Subject: [PATCH] stmhal: Fix bug with pin GPIO reading. --- stmhal/pin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stmhal/pin.c b/stmhal/pin.c index 3a1a0a2dee..f6c79d5d28 100644 --- a/stmhal/pin.c +++ b/stmhal/pin.c @@ -246,7 +246,7 @@ STATIC mp_obj_t pin_value(uint n_args, mp_obj_t *args) { pin_obj_t *self = args[0]; if (n_args == 1) { // get pin - return MP_OBJ_NEW_SMALL_INT((self->gpio->IDR >> self->port) & 1); + return MP_OBJ_NEW_SMALL_INT((self->gpio->IDR >> self->pin) & 1); } else { // set pin if (mp_obj_is_true(args[1])) {