This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.

If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

class PinCtrl – configure pin functions at runtime

Uses Zephyr Dynamic PinCtrl API.

This class allows configuring pin functions at runtime, either via the Dynamic PinCtrl API when device deinit is supported, or by abusing the pinctrl API to force reconfiguration via an ‘illegal’ mode.

Constructors

class zephyr.PinCtrl(func, mode=0, pull=None, drive=0, schmitt=False, slew=0)

Gets an object defining a specific pin configuration.

  • func may be a zephyr.PinMux instance, or, depending on the PinMux capabilities a string or an integer corresponding to a PinMux.

  • mode is the same as machine.Pin’s mode, but supports only Pin.IN and Pin.OUT.

  • pull is the same as machine.Pin’s pull.

  • drive is the pin’s drive strength in microAmperes (uA), if supported.

  • schmitt set whether the schmitt trigger device on the pin is enabled.

  • slew is an integer that defines the pin’s slew rate. It is platform-specific.

Methods

PinCtrl.pinmux()

Returns the zephyr.PinMux instance used by this PinCtrl.

Attributes

PinCtrl.MUXES

If the platform supports it, this contains a list of all possible zephyr.PinMux instances.