mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-02-14 01:21:33 +01:00
GPIO Refactor docs (#1543)
This commit is contained in:
parent
1ea83ad76c
commit
ffcd66ebe3
@ -75,39 +75,41 @@ In some places, ESPHome also supports a more advanced “pin schema”.
|
|||||||
pin:
|
pin:
|
||||||
number: D0
|
number: D0
|
||||||
inverted: true
|
inverted: true
|
||||||
mode: INPUT_PULLUP
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
|
||||||
Configuration variables:
|
Configuration variables:
|
||||||
|
|
||||||
- **number** (**Required**, pin): The pin number.
|
- **number** (**Required**, pin): The pin number.
|
||||||
- **inverted** (*Optional*, boolean): If all read and written values
|
- **inverted** (*Optional*, boolean): If all read and written values
|
||||||
should be treated as inverted. Defaults to ``false``.
|
should be treated as inverted. Defaults to ``false``.
|
||||||
- **mode** (*Optional*, string): A pin mode to set for the pin at
|
- **mode** (*Optional*, string or mapping): Configures the pin to behave in different
|
||||||
startup, corresponds to Arduino’s ``pinMode`` call.
|
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``
|
For compatibility some shorthand modes can also be used.
|
||||||
- ``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)
|
|
||||||
|
|
||||||
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)
|
Advanced options:
|
||||||
- ``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)
|
|
||||||
|
|
||||||
|
- **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:
|
.. _config-time:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user