diff --git a/components/ch422g.rst b/components/ch422g.rst new file mode 100644 index 000000000..6e01234d1 --- /dev/null +++ b/components/ch422g.rst @@ -0,0 +1,67 @@ +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 ` for communication. + +Once configured, you can use any of the 8 available GPIO pins for your projects. +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. + +.. note:: + + This I/O Expander chip is used in the *Waveshare ESP32-S3-Touch-LCD-4.3* + +.. code-block:: yaml + + # Example configuration entry + ch422g: + - id: ch422g_hub + address: 0x24 + + # 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. +- **address** (*Optional*, int): The I²C address of the driver. + Defaults to ``0x24``. +- **restore_value** (*Optional*, boolean): Writes default flags on setup, overriding values from chips cache. + Defaults to ``false``. + + + +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-7. +- **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 the pin at. One of ``INPUT`` or ``OUTPUT``. + + +See Also +-------- + +- :ref:`i2c` +- :doc:`switch/gpio` +- :doc:`binary_sensor/gpio` +- `CH422G datasheet `__ +- :apiref:`ch422g/ch422g.h` +- :ghedit:`Edit` diff --git a/images/ch422g.svg b/images/ch422g.svg new file mode 100644 index 000000000..f94fa6770 --- /dev/null +++ b/images/ch422g.svg @@ -0,0 +1 @@ + diff --git a/index.rst b/index.rst index 0370be6c7..ee5de2264 100644 --- a/index.rst +++ b/index.rst @@ -267,6 +267,7 @@ I/O Expanders/Multiplexers .. imgtable:: + CH422G, components/ch422g, ch422g.svg MAX6956 - I²C Bus, components/max6956, max6956.jpg MCP230XX - I²C Bus, components/mcp230xx, mcp230xx.svg MCP23SXX - SPI Bus, components/mcp23Sxx, mcp230xx.svg