MCP23S08-Docs (#613)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: David F. Bakker <dbakker@arrayasolutions.com>
This commit is contained in:
SenexCrenshaw 2020-12-06 12:44:06 -05:00 committed by GitHub
parent 5b91810122
commit 648a640f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 130 additions and 1 deletions

128
components/mcp23Sxx.rst Normal file
View File

@ -0,0 +1,128 @@
MCP23Sxx I/O Expander
=====================
.. seo::
:description: Instructions for setting up MCP23S08, MCP23S16 or MCP23S17 digital port expander in ESPHome. This is exactly the same API as the MCP23SXX I/O Expander except talks on the SPI bus
:image: mcp23Sxx.png
The Microchip MCP23Sxx series of general purpose, parallel I/O expansion for SPI bus applications.
This is exactly the same API as the MCP23SXX I/O Expander except talks on the SPI bus
**Supported Variants :**
- :ref:`mcp23S08-label`
- :ref:`mcp23S17-label`
.. _mcp23S08-label:
MCP23S08
--------
The MCP23S08 component (`datasheet <http://ww1.microchip.com/downloads/en/DeviceDoc/MCP23008-MCP23S08-Data-Sheet-20001919F.pdf>`__,
`Digi-Key <https://www.digikey.com/product-detail/en/microchip-technology/MCP23S08-E-P/MCP23S08-E-P-ND/735954>`__) has 8 GPIOs that can be configured independently.
.. code-block:: yaml
# Example configuration entry
mcp23s08:
- id: 'mcp23s08_hub'
cs_pin: D8
deviceaddress: 0
# Individual outputs
switch:
- platform: gpio
name: "MCP23S08 Pin #0"
pin:
mcp23s08_id: mcp23s08_hub
# Use pin number 0
number: 0
# One of INPUT, INPUT_PULLUP or OUTPUT
mode: OUTPUT
inverted: False
# Individual inputs
binary_sensor:
- platform: gpio
name: "MCP23S08 Pin #1"
pin:
mcp23s08_id: mcp23s08_hub
# Use pin number 1
number: 1
# One of INPUT or INPUT_PULLUP
mode: INPUT
inverted: False
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **id** (**Required**, :ref:`config-id`): The id to use for this MCP23S08 component.
- **cs_pin** (*Required*, int): The SPI chip select pin to use
- **deviceaddress** (*Optional*, int): The address of the chip.
Defaults to ``0``.
.. _mcp23S17-label:
MCP23S17
--------
The MCP23S17 component allows you to use MCP23S17 I/O expanders
(`datasheet <http://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf>`__,
`Digi-Key <https://www.digikey.com/product-detail/en/microchip-technology/MCP23S17-E-SP/MCP23S17-E-SP-ND/894276>`__) in ESPHome.
It uses the :ref:`SPI Bus <spi>` for communication.
Once configured, you can use any of the 16 pins as
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.
.. code-block:: yaml
# Example configuration entry
mcp23s17:
- id: 'mcp23s17_hub'
cs_pin: D8
deviceaddress: 0
# Individual outputs
switch:
- platform: gpio
name: "MCP23S17 Pin #0"
pin:
mcp23s17_id: mcp23s17_hub
# Use pin number 0
number: 0
mode: OUTPUT
inverted: False
# Individual inputs
binary_sensor:
- platform: gpio
name: "MCP23S17 Pin #1"
pin:
mcp23s17_id: mcp23s17_hub
# Use pin number 1
number: 1
# One of INPUT or INPUT_PULLUP
mode: INPUT_PULLUP
inverted: False
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **id** (**Required**, :ref:`config-id`): The id to use for this MCP23S17 component.
- **cs_pin** (*Required*, int): The SPI chip select pin to use.
- **deviceaddress** (*Optional*, int): The address of the chip.
Defaults to ``0``.
See Also
--------
- :ref:`spi`
- :doc:`switch/gpio`
- :doc:`binary_sensor/gpio`
- :apiref:`API Reference (MCP23S08) <mcp23S08/mcp23S08.h>`
- :apiref:`API Reference (MCP23S17) <mcp23S17/mcp23S17.h>`
- :ghedit:`Edit`

View File

@ -349,7 +349,8 @@ Misc Components
Servo, components/servo, servo.svg
PCF8574 I/O Expander, components/pcf8574, pcf8574.jpg
MCP230XX I/O Expander, components/mcp230xx, mcp230xx.svg
MCP230XX I/O Expander - I²C Bus, components/mcp230xx, mcp230xx.svg
MCP23SXX I/O Expander - SPI Bus, components/mcp23Sxx, mcp230xx.svg
MCP3008 8-Channel 10-Bit A/D Converter, components/mcp3008, mcp3008.png
SX1509 I/O Expander, components/sx1509, sx1509.jpg
SN74HC595 I/O Expander, components/sn74hc595, sn74hc595.jpg