67 lines
2.2 KiB
ReStructuredText
67 lines
2.2 KiB
ReStructuredText
CH422G I/O Expander
|
|
====================
|
|
|
|
.. seo::
|
|
:description: Instructions for setting up CH422G digital port expanders in ESPHome.
|
|
:image: ch422g.svg
|
|
|
|
|
|
The CH422G component allows you to use the **CH422G** I/O expander in ESPHome.
|
|
It uses an :ref:`I²C Bus <i2c>` for communication. The I²C address is not configurable as the CH422G has a separate address for each internal register.
|
|
|
|
Once configured, you can use any of the 12 available GPIO pins in many places a GPIO pin is required.
|
|
Within ESPHome they can be used in place of internal GPIO pins in many of ESPHome's components such as the GPIO Binary Sensor or GPIO Switch. They are not usable for PWM or other situations requiring an internal GPIO pin.
|
|
|
|
Pins 0-7 correspond to the bidirectional I/O (segment) pins on the CH422G. Pins 8-11 correspond to the OC (digit) output pins 0-3.
|
|
|
|
.. note::
|
|
|
|
This I/O Expander chip is used in several Waveshare ESP32-S3 display boards.
|
|
|
|
.. code-block:: yaml
|
|
|
|
# Example configuration entry
|
|
ch422g:
|
|
- id: ch422g_hub
|
|
|
|
# Individual outputs
|
|
switch:
|
|
- platform: gpio
|
|
name: CH422G Pin 0
|
|
pin:
|
|
ch422g: ch422g_hub
|
|
number: 0
|
|
mode:
|
|
output: true
|
|
inverted: false
|
|
|
|
|
|
Configuration variables:
|
|
************************
|
|
|
|
- **id** (**Required**, :ref:`config-id`): The id to use for this ``ch422g`` component.
|
|
|
|
|
|
|
|
Pin configuration variables:
|
|
****************************
|
|
|
|
- **ch422g** (**Required**, :ref:`config-id`): The id of the ``ch422g`` component of the pin.
|
|
- **number** (**Required**, int): The pin number. Valid numbers are 0-11.
|
|
- **inverted** (*Optional*, boolean): If the pin state should be inverted. Defaults to ``false``.
|
|
- **mode** (*Optional*, string): A pin mode to set the pin at. One of ``INPUT`` or ``OUTPUT``, or ``OUTPUT_OPEN_DRAIN``.
|
|
|
|
|
|
Open drain mode is supported only on pins 8-11. Input is supported only on pins 0-7.
|
|
|
|
|
|
See Also
|
|
--------
|
|
|
|
- :ref:`i2c`
|
|
- :doc:`switch/gpio`
|
|
- :doc:`binary_sensor/gpio`
|
|
- `CH422G datasheet <https://www.wch-ic.com/downloads/file/315.html?time=2024-07-29%2002:02:32&code=Fxex1sTRHysGLS6ALgh7PTOOZnAACY6KTQx05vzD>`__
|
|
- :apiref:`ch422g/ch422g.h`
|
|
- :ghedit:`Edit`
|