GPIO Refactor docs (#1543)

This commit is contained in:
Otto Winter 2021-10-19 21:53:24 +02:00 committed by Jesse Hills
parent 1ea83ad76c
commit ffcd66ebe3
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -75,39 +75,41 @@ In some places, ESPHome also supports a more advanced “pin schema”.
pin:
number: D0
inverted: true
mode: INPUT_PULLUP
mode:
input: true
pullup: true
Configuration variables:
- **number** (**Required**, pin): The pin number.
- **inverted** (*Optional*, boolean): If all read and written values
should be treated as inverted. Defaults to ``false``.
- **mode** (*Optional*, string): A pin mode to set for the pin at
startup, corresponds to Arduinos ``pinMode`` call.
- **mode** (*Optional*, string or mapping): Configures the pin to behave in different
modes like input or output. The default value depends on the context.
Accepts either a shorthand string or a mapping where each feature can be individually
enabled/disabled:
Available Pin Modes:
- **input** (*Optional*, boolean): If true, configure the pin as an input.
- **output** (*Optional*, boolean): If true, configure the pin as an output.
- **pullup** (*Optional*, boolean): Activate internal pullup resistors on the pin.
- **pulldown** (*Optional*, boolean): Activate internal pulldown resistors on the pin.
- **open_drain** (*Optional*, boolean): Set the pin to open-drain (as opposed to push-pull).
The active pin state will then result in a high-impedance state.
- ``INPUT``
- ``OUTPUT``
- ``OUTPUT_OPEN_DRAIN``
- ``ANALOG`` (only on ESP32)
- ``INPUT_PULLUP``
- ``INPUT_PULLDOWN`` (only on ESP32)
- ``INPUT_PULLDOWN_16`` (only on ESP8266 and only on GPIO16)
For compatibility some shorthand modes can also be used.
More exotic Pin Modes are also supported, but rarely used:
- ``INPUT``
- ``OUTPUT``
- ``OUTPUT_OPEN_DRAIN``
- ``ANALOG``
- ``INPUT_PULLUP``
- ``INPUT_PULLDOWN``
- ``WAKEUP_PULLUP`` (only on ESP8266)
- ``WAKEUP_PULLDOWN`` (only on ESP8266)
- ``SPECIAL``
- ``FUNCTION_0`` (only on ESP8266)
- ``FUNCTION_1``
- ``FUNCTION_2``
- ``FUNCTION_3``
- ``FUNCTION_4``
- ``FUNCTION_5`` (only on ESP32)
- ``FUNCTION_6`` (only on ESP32)
Advanced options:
- **drive_strength** (*Optional*, string): On ESP32s with esp-idf framework the pad drive strength,
i.e. the maximum amount of current can additionally be set. Defaults to ``20mA``.
Options are ``5mA``, ``10mA``, ``20mA``, ``40mA``.
.. _config-time: