stmhal: Fix bug with pin GPIO reading.

This commit is contained in:
Damien George 2014-04-21 20:18:06 +01:00
parent ef255e47c1
commit 350cb6bf20

View File

@ -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])) {