diff options
Diffstat (limited to 'esp8266/modpybpin.c')
-rw-r--r-- | esp8266/modpybpin.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/esp8266/modpybpin.c b/esp8266/modpybpin.c index 166d6f566f..8916da64f6 100644 --- a/esp8266/modpybpin.c +++ b/esp8266/modpybpin.c @@ -244,7 +244,11 @@ STATIC mp_obj_t pyb_pin_obj_init_helper(pyb_pin_obj_t *self, mp_uint_t n_args, c // configure the GPIO as requested if (self->phys_port == 16) { - // TODO: Set pull up/pull down + // only pull-down seems to be supported by the hardware, and + // we only expose pull-up behaviour in software + if (pull != GPIO_PULL_NONE) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Pin(16) doesn't support pull")); + } } else { PIN_FUNC_SELECT(self->periph, self->func); #if 0 @@ -301,7 +305,7 @@ STATIC mp_obj_t pyb_pin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, pyb_pin_obj_t *self = self_in; if (n_args == 0) { // get pin - return MP_OBJ_NEW_SMALL_INT(GPIO_INPUT_GET(self->phys_port)); + return MP_OBJ_NEW_SMALL_INT(pin_get(self->phys_port)); } else { // set pin pin_set(self->phys_port, mp_obj_is_true(args[0])); |