XL9535 I/O Expander (#2949)

This commit is contained in:
MrEditor97 2023-06-19 04:26:10 +01:00 committed by GitHub
parent 6088b03b2f
commit 75b8ddf5ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 0 deletions

67
components/xl9535.rst Normal file
View File

@ -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 <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`

1
images/xl9535.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="375.31" height="94.488" viewBox="0 0 99.301 25"><path d="M5 0h89.3c2.77 0 5 2.23 5 5v15c0 2.77-2.23 5-5 5H5c-2.77 0-5-2.23-5-5V5c0-2.77 2.23-5 5-5Z" style="fill:#000;fill-opacity:1;stroke-width:.133497;stroke-miterlimit:4;stroke-dasharray:none"/><g aria-label="XL9535" style="font-size:10.5833px;line-height:1.25;letter-spacing:1.08479px;fill:#fffffc;stroke-width:.264583"><path d="m14.766 12.493 5.893 8.173h-4.222l-3.815-5.487-3.748 5.487h-4.2l5.848-8.038-5.554-7.767h4.154l3.635 5.125 3.567-5.125h3.951zM34.772 20.666H23.189V4.86h3.658v12.824h7.925zM42.246 4.59q3.319 0 5.193 2.032 1.874 2.01 1.874 5.803 0 2.687-1.016 4.606-.994 1.919-2.823 2.912-1.828.994-4.222.994-1.264 0-2.415-.271-1.152-.294-1.965-.813l1.355-2.687q1.151.79 2.958.79 2.01 0 3.183-1.174 1.174-1.196 1.264-3.432-1.422 1.423-3.928 1.423-1.513 0-2.755-.61-1.241-.61-1.964-1.716-.722-1.129-.722-2.596 0-1.58.79-2.777t2.145-1.829q1.377-.655 3.048-.655zm.27 7.451q1.197 0 1.942-.655.768-.677.768-1.716 0-1.038-.745-1.693-.722-.655-2.01-.655-1.173 0-1.919.632-.722.633-.722 1.716 0 1.084.722 1.739.746.632 1.965.632zM57.577 10.8q3.342 0 4.922 1.331 1.603 1.332 1.603 3.568 0 1.445-.722 2.641-.723 1.174-2.213 1.897-1.468.7-3.635.7-1.67 0-3.296-.43-1.603-.45-2.732-1.264l1.445-2.8q.903.678 2.077 1.062 1.174.361 2.416.361 1.377 0 2.167-.542.79-.542.79-1.513 0-1.016-.835-1.535-.813-.52-2.845-.52h-4.041l.813-8.895h9.64v2.935H56.54L56.29 10.8ZM73.947 11.296q2.077.339 3.184 1.558 1.106 1.196 1.106 2.98 0 1.377-.723 2.551-.722 1.152-2.212 1.852-1.468.7-3.613.7-1.67 0-3.296-.43-1.603-.45-2.732-1.264l1.422-2.8q.904.678 2.078 1.062 1.196.361 2.438.361 1.377 0 2.168-.52.79-.541.79-1.512 0-1.942-2.958-1.942h-1.67v-2.415l3.25-3.68h-6.728V4.86h11.063v2.37zM86.208 10.8q3.341 0 4.922 1.331 1.603 1.332 1.603 3.568 0 1.445-.723 2.641-.722 1.174-2.212 1.897-1.468.7-3.635.7-1.67 0-3.297-.43-1.603-.45-2.731-1.264l1.445-2.8q.903.678 2.077 1.062 1.174.361 2.415.361 1.378 0 2.168-.542.79-.542.79-1.513 0-1.016-.835-1.535-.813-.52-2.845-.52h-4.041l.812-8.895h9.641v2.935H85.17l-.248 3.003z" style="font-weight:700;font-size:22.5778px;font-family:Montserrat;-inkscape-font-specification:&quot;Montserrat, Bold&quot;"/></g></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -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