summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/machine_signal.c
Commit message (Collapse)AuthorAge
* extmod/machine_signal: Rename "inverted" arg to "invert", it's shorter.Damien George2017-04-15
| | | | | | | A shorter name takes less code size, less room in scripts and is faster to type at the REPL. Tests and HW-API examples are updated to reflect the change.
* extmod/machine_signal: Support all Pin's arguments to the constructor.Paul Sokolovsky2017-04-11
| | | | | | | | | | | | | | | | | 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).
* extmod/machine_signal: Implement Signal .on() and .off() methods.Paul Sokolovsky2017-02-08
| | | | | | | Each method asserts and deasserts signal respectively. They are equivalent to .value(1) and .value(0) but conceptually simpler (and may help to avoid confusion with inverted signals, where "asserted" state means logical 0 output).
* extmod/machine_signal: Implement "signal" abstraction for machine module.Paul Sokolovsky2017-01-29
A signal is like a pin, but ca also be inverted (active low). As such, it abstracts properties of various physical devices, like LEDs, buttons, relays, buzzers, etc. To instantiate a Signal: pin = machine.Pin(...) signal = machine.Signal(pin, inverted=True) signal has the same .value() and __call__() methods as a pin.