pyb.Pin ======= .. This document was autogenerated by Sphinx-autoapi from a .pyi stub or a source code file. .. Do not edit this file, instead edit the source file and run Sphinx to update. .. Source: docs/stubs/pyb/Pin.pyi .. py:module:: pyb.Pin Classes ------- .. autoapisummary:: pyb.Pin.Pin pyb.Pin.pinaf Module Contents --------------- .. py:class:: Pin(id, *args, **kwargs) Create a new Pin object associated with the id. If additional arguments are given, they are used to initialise the pin. See :meth:`pin.init`. .. py:method:: __str__() -> str Return a string describing the pin object. .. py:method:: af() -> _typeshed.Incomplete Returns the currently configured alternate-function of the pin. The integer returned will match one of the allowed constants for the af argument to the init function. .. py:method:: af_list() -> List Returns an array of alternate functions available for this pin. .. py:method:: debug(state: Optional[Any] = None) -> bool :classmethod: Get or set the debugging state (``True`` or ``False`` for on or off). .. py:method:: dict(dict: Optional[Any] = None) -> _typeshed.Incomplete :classmethod: Get or set the pin mapper dictionary. .. py:method:: gpio() -> int Returns the base address of the GPIO block associated with this pin. .. py:method:: init(mode, pull=PULL_NONE, *, value=None, alt=-1) -> None Initialise the pin: - *mode* can be one of: - ``Pin.IN`` - configure the pin for input; - ``Pin.OUT_PP`` - configure the pin for output, with push-pull control; - ``Pin.OUT_OD`` - configure the pin for output, with open-drain control; - ``Pin.ALT`` - configure the pin for alternate function, input or output; - ``Pin.AF_PP`` - configure the pin for alternate function, push-pull; - ``Pin.AF_OD`` - configure the pin for alternate function, open-drain; - ``Pin.ANALOG`` - configure the pin for analog. - *pull* can be one of: - ``Pin.PULL_NONE`` - no pull up or down resistors; - ``Pin.PULL_UP`` - enable the pull-up resistor; - ``Pin.PULL_DOWN`` - enable the pull-down resistor. When a pin has the ``Pin.PULL_UP`` or ``Pin.PULL_DOWN`` pull-mode enabled, that pin has an effective 40k Ohm resistor pulling it to 3V3 or GND respectively (except pin Y5 which has 11k Ohm resistors). - *value* if not None will set the port output value before enabling the pin. - *alt* can be used when mode is ``Pin.ALT`` , ``Pin.AF_PP`` or ``Pin.AF_OD`` to set the index or name of one of the alternate functions associated with a pin. This arg was previously called *af* which can still be used if needed. Returns: ``None``. .. py:method:: mapper(fun: Optional[Any] = None) -> _typeshed.Incomplete :classmethod: Get or set the pin mapper function. .. py:method:: mode() -> _typeshed.Incomplete Returns the currently configured mode of the pin. The integer returned will match one of the allowed constants for the mode argument to the init function. .. py:method:: name() -> str Get the pin name. .. py:method:: names() -> str Returns the cpu and board names for this pin. .. py:method:: pin() -> int Get the pin number. .. py:method:: port() -> _typeshed.Incomplete Get the pin port. .. py:method:: pull() -> _typeshed.Incomplete Returns the currently configured pull of the pin. The integer returned will match one of the allowed constants for the pull argument to the init function. .. py:method:: value(value: Optional[Any] = None) -> int Get or set the digital logic level of the pin: - With no argument, return 0 or 1 depending on the logic level of the pin. - With ``value`` given, set the logic level of the pin. ``value`` can be anything that converts to a boolean. If it converts to ``True``, the pin is set high, otherwise it is set low. .. py:attribute:: AF_OD :type: _typeshed.Incomplete initialise the pin to alternate-function mode with an open-drain drive .. py:attribute:: AF_PP :type: _typeshed.Incomplete initialise the pin to alternate-function mode with a push-pull drive .. py:attribute:: ALT :type: _typeshed.Incomplete initialise the pin to alternate-function mode for input or output .. py:attribute:: ANALOG :type: _typeshed.Incomplete initialise the pin to analog mode .. py:attribute:: IN :type: _typeshed.Incomplete initialise the pin to input mode .. py:attribute:: OUT_OD :type: _typeshed.Incomplete initialise the pin to output mode with an open-drain drive .. py:attribute:: OUT_PP :type: _typeshed.Incomplete initialise the pin to output mode with a push-pull drive .. py:attribute:: PULL_DOWN :type: _typeshed.Incomplete enable the pull-down resistor on the pin .. py:attribute:: PULL_NONE :type: _typeshed.Incomplete don't enable any pull up or down resistors on the pin .. py:attribute:: PULL_UP :type: _typeshed.Incomplete enable the pull-up resistor on the pin .. py:class:: pinaf .. py:method:: __str__() -> str Return a string describing the alternate function. .. py:method:: index() -> int Return the alternate function index. .. py:method:: name() -> str Return the name of the alternate function. .. py:method:: reg() -> _typeshed.Incomplete Return the base register associated with the peripheral assigned to this alternate function. For example, if the alternate function were TIM2_CH3 this would return stm.TIM2