Skip to content
  • Paul Sokolovsky's avatar
    extmod/machine_signal: Support all Pin's arguments to the constructor. · 605ff91e
    Paul Sokolovsky authored
    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).
    605ff91e