Skip to content

[Proposal] Add System.Device.Gpio.Toggle() #107

@josesimoes

Description

@josesimoes

Toggling a Gpio pin is a very, very common operation. To accomplish that, with what's available today, one has to either:

  1. Keep a variable to hold the pin state and then update the pin and the variable.
  2. Perform a read pin, toggle state and perform a write pin.

Most of modern MCUs provide a low level way of doing this with one or maybe a couple of instructions. Even if it requires implementing 2. in native code it would still be far more efficient that using 1. or 2. in managed code.

Considering the above, I'm proposing that a System.Device.Gpio.Toggle(int pinNumber) method should exist.

PS: We already have this on nanoFramework Windows.Devices.Gpio API, see here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-System.Device.GpioContains types for using general-purpose I/O (GPIO) pins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions