esphome-docs/components/xl9535.rst
2023-06-19 15:26:10 +12:00

68 lines
1.8 KiB
ReStructuredText

XL9535 I/O Expander
====================
.. seo::
:description: Instructions for setting up XL9535 digital port expanders in ESPHome.
:image: xl9535.svg
The XL9535 component allows you to use **XL9535** I/O expander in ESPHome.
It uses :ref:`I²C Bus <i2c>` for communication.
Once configured, you can use any of the **16** available pins for your projects.
Within ESPHome they emulate a real internal GPIO pin
and can therefore be used with many of ESPHome's components such as the GPIO
Binary Sensor or GPIO Switch.
.. note::
This I/O Expander chip is used in the *Lilygo T-RGB 2.1" Round Display*
.. code-block:: yaml
# Example configuration entry
xl9535:
- id: xl9535_hub
address: 0x20
# Individual outputs
switch:
- platform: gpio
name: XL9535 Pin 0
pin:
xl9535: xl9535_hub
number: 0
mode:
output: true
inverted: false
Configuration variables:
************************
- **id** (**Required**, :ref:`config-id`): The id to use for this ``xl9535`` component.
- **address** (*Optional*, int): The I²C address of the driver.
Defaults to ``0x20``.
Pin configuration variables:
****************************
- **xl9535** (**Required**, :ref:`config-id`): The id of the ``xl9535`` component of the pin.
- **number** (**Required**, int): 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. One of ``INPUT`` or ``OUTPUT``.
See Also
--------
- :ref:`i2c`
- :doc:`switch/gpio`
- :doc:`binary_sensor/gpio`
- `XL9535 datasheet <https://datasheet.lcsc.com/lcsc/2211110930_XINLUDA-XL9535_C561273.pdf>`__
- :apiref:`xl9535/xl9535.h`
- :ghedit:`Edit`