From 75b8ddf5ee93df5b85869f218078e74697c4c0b3 Mon Sep 17 00:00:00 2001 From: MrEditor97 Date: Mon, 19 Jun 2023 04:26:10 +0100 Subject: [PATCH] XL9535 I/O Expander (#2949) --- components/xl9535.rst | 67 +++++++++++++++++++++++++++++++++++++++++++ images/xl9535.svg | 1 + index.rst | 1 + 3 files changed, 69 insertions(+) create mode 100644 components/xl9535.rst create mode 100644 images/xl9535.svg diff --git a/components/xl9535.rst b/components/xl9535.rst new file mode 100644 index 000000000..6eeae6010 --- /dev/null +++ b/components/xl9535.rst @@ -0,0 +1,67 @@ +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 ` 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 `__ +- :apiref:`xl9535/xl9535.h` +- :ghedit:`Edit` diff --git a/images/xl9535.svg b/images/xl9535.svg new file mode 100644 index 000000000..1eb535273 --- /dev/null +++ b/images/xl9535.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.rst b/index.rst index c302d3520..671661810 100644 --- a/index.rst +++ b/index.rst @@ -801,6 +801,7 @@ Miscellaneous Components SX1509 I/O Expander, components/sx1509, sx1509.jpg SN74HC165 I/O Expander, components/sn74hc165, sn74hc595.jpg SN74HC595 I/O Expander, components/sn74hc595, sn74hc595.jpg + XL9535 I/O Expander, components/xl9535, xl9535.svg SIM800L, components/sim800l, sim800l.jpg DFPlayer, components/dfplayer, dfplayer.svg Captive Portal, components/captive_portal, wifi-strength-alert-outline.svg