Skip to content

docs: Pin.toggle() method is not documented #9652

Description

@millosolomillo

Pin.toggle() method works (at least for RP2040 platform) but it is not documented here:

https://docs.micropython.org/en/latest/library/machine.Pin.html#methods

Activity

  1. changed the title [-]docs: Pin.off() method is not documented[/-] [+]docs: Pin.toggle() method is not documented[/+] on Oct 17, 2022
  2. robert-hh commented on Oct 17, 2022

    @robert-hh
    Contributor

    It's available only at the rp2 and samd port, as you know. It is more frequently found as part of the machine.LED class, which b.t.w. is not documented at all. The pyb.LED class is.

  3. millosolomillo commented on Oct 17, 2022

    @millosolomillo
    Author

    Already opened a PR at #9653, sorry 😅

  4. uPesy commented on Oct 17, 2022

    @uPesy

    I really think board ports should be more harmonized for basic fonctions, otherwise we lost the theorical advantage of uPython : one code that works on different hardware ...

  5. robert-hh commented on Oct 17, 2022

    @robert-hh
    Contributor

    You're right. But then the discussion starts again about what is a basic function. The Pin class has quite a few methods which could for instance be considered as not basic, like pin.toggle(), pin.on(), pin.off(). The latter two are actually misleading, because a pin cannot be on or off. And toggle can always be written e.g. as pin(not pin()).
    Ports and boards have different resources, like flash and RAM. Devices with a small flash will always provide only a subset of both the language features and hardware support.

  6. jonnor commented on Sep 2, 2024

    @jonnor
    Contributor

    I do not consider toggle to be core. It is trivial to use pin.value(not pin.value()). Proposing to close.

  7. projectgus commented on Sep 10, 2024

    @projectgus
    Contributor

    I do not consider toggle to be core. It is trivial to use pin.value(not pin.value()). Proposing to close.

    I agree, but I think we at least should document it on the ports where it's already implemented.

  8. added and removed
    proposed-closeSuggest this issue should be closed
    on Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions