From 9156c8b460a4b013312466744b47bc4bb5506269 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 11 Apr 2017 13:12:54 +1000 Subject: [PATCH] stmhal: Enable parsing of all Pin constructor args by machine.Signal. --- stmhal/mpconfigport.h | 1 + stmhal/pin.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 3f36831997..2186e2ed64 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -123,6 +123,7 @@ #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE_PULSE (1) +#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_I2C_MAKE_NEW machine_hard_i2c_make_new #define MICROPY_PY_MACHINE_SPI (1) diff --git a/stmhal/pin.c b/stmhal/pin.c index 29370e6a2c..845126e28e 100644 --- a/stmhal/pin.c +++ b/stmhal/pin.c @@ -245,7 +245,7 @@ STATIC mp_obj_t pin_obj_init_helper(const pin_obj_t *pin, mp_uint_t n_args, cons /// \classmethod \constructor(id, ...) /// Create a new Pin object associated with the id. If additional arguments are given, /// they are used to initialise the pin. See `init`. -STATIC mp_obj_t pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { +mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true); // Run an argument through the mapper and return the result. @@ -567,7 +567,7 @@ const mp_obj_type_t pin_type = { { &mp_type_type }, .name = MP_QSTR_Pin, .print = pin_print, - .make_new = pin_make_new, + .make_new = mp_pin_make_new, .call = pin_call, .protocol = &pin_pin_p, .locals_dict = (mp_obj_t)&pin_locals_dict,