summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266/machine_pin.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-04-11 00:12:20 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-04-11 00:12:20 +0300
commit605ff91efdeb3cd7e4948c0398c839a9ae06044a (patch)
tree1772f83cc46dff962ad5d3be7e1777db2e5c8e0f /esp8266/machine_pin.c
parent79ce6649524b08732e15d86c4ff61266c3ec14ed (diff)
downloadmicropython-605ff91efdeb3cd7e4948c0398c839a9ae06044a.tar.gz
micropython-605ff91efdeb3cd7e4948c0398c839a9ae06044a.zip
extmod/machine_signal: Support all Pin's arguments to the constructor.
This implements the orginal idea is that Signal is a subclass of Pin, and thus can accept all the same argument as Pin, and additionally, "inverted" param. On the practical side, it allows to avoid many enclosed parenses for a typical declararion, e.g. for Zephyr: Signal(Pin(("GPIO_0", 1))). Of course, passing a Pin to Signal constructor is still supported and is the most generic form (e.g. Unix port will only support such form, as it doesn't have "builtin" Pins), what's introduces here is just practical readability optimization. "value" kwarg is treated as applying to a Signal (i.e. accounts for possible inversion).
Diffstat (limited to 'esp8266/machine_pin.c')
-rw-r--r--esp8266/machine_pin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/esp8266/machine_pin.c b/esp8266/machine_pin.c
index d4c6d3dea7..1a263601b4 100644
--- a/esp8266/machine_pin.c
+++ b/esp8266/machine_pin.c
@@ -287,7 +287,7 @@ STATIC mp_obj_t pyb_pin_obj_init_helper(pyb_pin_obj_t *self, mp_uint_t n_args, c
}
// constructor(id, ...)
-STATIC mp_obj_t pyb_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);
// get the wanted pin object
@@ -436,7 +436,7 @@ const mp_obj_type_t pyb_pin_type = {
{ &mp_type_type },
.name = MP_QSTR_Pin,
.print = pyb_pin_print,
- .make_new = pyb_pin_make_new,
+ .make_new = mp_pin_make_new,
.call = pyb_pin_call,
.protocol = &pin_pin_p,
.locals_dict = (mp_obj_t)&pyb_pin_locals_dict,