mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-01-12 20:10:50 +01:00
[sn74hc595 ] SPI config (#3341)
This commit is contained in:
parent
980ca127eb
commit
4821e6b71f
@ -6,9 +6,10 @@ SN74HC595 I/O Expander (shift register)
|
||||
|
||||
The SN74HC595 component allows you to use SN74HC595 shift registers as I/O expanders
|
||||
(`datasheet <http://www.ti.com/lit/ds/symlink/sn74hc595.pdf>`__,
|
||||
`SparkFun`_) in ESPHome. It uses 3 wires (optionally 4) for communication.
|
||||
`SparkFun`_) in ESPHome. It uses 3 wires (optionally 4) for communication. Optionally, it can be added
|
||||
to a SPI bus to allow sharing pins with other components.
|
||||
|
||||
Once configured, you can use any of the 8 pins for your projects. Up-to 256 shift registers can be daisy-chained
|
||||
Once configured, you can use any of the 8 pins for your projects. Up to 256 shift registers can be daisy-chained
|
||||
to provide more pins, without using more GPIO pins on the controller.
|
||||
|
||||
Use of the OE pin is optional. If used, the pin should be pulled up externally.
|
||||
@ -21,6 +22,11 @@ Use of the OE pin is optional. If used, the pin should be pulled up externally.
|
||||
|
||||
.. _SparkFun: https://www.sparkfun.com/products/13699
|
||||
|
||||
The component can be configured using :ref:`GPIO pins <config-pin_schema>` or the :ref:`SPI Bus <spi>`.
|
||||
|
||||
Over GPIO
|
||||
---------
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# Example configuration entry
|
||||
@ -53,6 +59,46 @@ Configuration variables:
|
||||
- **sr_count** (*Optional*, int): Number of daisy-chained shift registers, up-to 256. Defaults to ``1``.
|
||||
|
||||
|
||||
Pin configuration variables:
|
||||
****************************
|
||||
|
||||
- **sn74hc595** (**Required**, :ref:`config-id`): The id of the SN74HC595 component the pin belongs to.
|
||||
- **number** (**Required**, int): The pin number.
|
||||
- **inverted** (*Optional*, boolean): If all written values should be treated as inverted.
|
||||
Defaults to ``false``.
|
||||
|
||||
Over SPI
|
||||
--------
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# Example configuration entry
|
||||
spi:
|
||||
sn74hc595:
|
||||
- id: 'sn74hc595_hub'
|
||||
latch_pin: D7
|
||||
oe_pin: D6
|
||||
sr_count: 2
|
||||
|
||||
# Individual outputs
|
||||
switch:
|
||||
- platform: gpio
|
||||
name: "SN74HC595 Pin #0"
|
||||
pin:
|
||||
sn74hc595: sn74hc595_hub
|
||||
# Use pin number 0
|
||||
number: 0
|
||||
inverted: false
|
||||
|
||||
Configuration variables:
|
||||
************************
|
||||
|
||||
- **id** (**Required**, :ref:`config-id`): The id to use for this SN74HC595 component.
|
||||
- **latch_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 RCLK (ST_CP) pin
|
||||
- **oe_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 OE pin
|
||||
- **sr_count** (*Optional*, int): Number of daisy-chained shift registers, up to 256. Defaults to ``1``.
|
||||
|
||||
|
||||
Pin configuration variables:
|
||||
****************************
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user