Commit Graph

10 Commits

Author SHA1 Message Date
Paul Sokolovsky bcf31a3908 esp8266, stmhal, zephyr: Rename machine.Pin high/low methods to on/off.
For consistent Pin/Signal class hierarchy. With it, Signal is a proper
(while still ducktyped) subclass of a Pin, and any (direct) usage of Pin
can be replace with Signal.

As stmhal's class is reused both as machine.Pin and legacy pyb.Pin,
high/low methods actually retained there.
2017-05-21 17:44:58 +03:00
Paul Sokolovsky 605ff91efd 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).
2017-04-11 00:12:20 +03:00
Damien George 5d05ff1406 esp8266/machine_pin: Fix pin.irq() to work when all args are keywords. 2017-03-21 15:28:31 +11:00
Damien George b16c35486f esp8266/machine_pin: Fix memset size for zeroing of pin_irq_is_hard.
Thanks to @robert-hh.
2017-03-21 15:13:15 +11:00
Damien George 9ee4641850 esp8266/machine_pin: Make pin.irq arguments positional.
All arguments to pin.irq are converted from keyword-only to positional, and
can still be specified by keyword so it's a backwards compatible change.

The default value for the "trigger" arg is changed from 0 (no trigger)
to rising+falling edge.
2017-03-20 15:20:26 +11:00
Damien George 2507c83b0e esp8266/machine_pin: Add "hard" parameter to pin.irq, soft by default. 2017-03-20 15:20:26 +11:00
Damien George 1b7d67266d esp8266: Enable micropython.schedule() with locking in pin callback. 2017-03-20 15:20:26 +11:00
Paul Sokolovsky 18b6835a92 esp8266/machine_pin: Implement pin ioctl protocol.
For polymorphic interfacing on C level.
2017-01-29 18:47:27 +03:00
Paul Sokolovsky eac22e29a5 all: Consistently update signatures of .make_new and .call methods.
Otherwise, they serve reoccurring source of copy-paste mistakes and
breaking nanbox build.
2017-01-04 16:10:42 +03:00
Paul Sokolovsky 8bc3fc20fe esp8266: Rename "machine" module implementation to use contemporary naming.
Previously they used historical "pyb" affix causing confusion and
inconsistency (there's no "pyb" module in modern ports; but people
took esp8266 port as an example, and "pyb" naming kept proliferating,
while other people complained that source structure is not clear).
2016-11-06 01:30:19 +03:00