Added documentation for SN74HC165 (#2504)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
alsig 2022-12-07 00:10:29 +01:00 committed by GitHub
parent 9a8aa667ee
commit 84b78f8007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 0 deletions

66
components/sn74hc165.rst Normal file
View File

@ -0,0 +1,66 @@
SN74HC165 I/O Expander (shift register)
=======================================
.. seo::
:description: Instructions for setting up SN74HC165 shift registers as digital port expanders in ESPHome.
The SN74HC165 component allows you to use SN74HC165 shift registers as I/O expanders (Input only, use SN74HC595 for outputs)
(`datasheet <https://www.ti.com/lit/ds/symlink/sn74hc165.pdf>`__) in ESPHome. It uses 3 wires (optionally 4) for communication.
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. They are linked by connecting pin Q of the closer
shift register to the pin QH of the next shift register.
.. code-block:: yaml
# Example configuration entry
sn74hc165:
- id: sn74hc165_hub
clock_pin: GPIO16
data_pin: GPIO17
load_pin: GPIO4
clock_inhibit_pin: GPIO18
sr_count: 2
# Individual inputs
binary_sensor:
- platform: gpio
name: "SN74HC165 Pin #0"
pin:
sn74hc595: sn74hc165_hub
# Use pin number 0
number: 0
inverted: false
Configuration variables:
************************
- **id** (**Required**, :ref:`config-id`): The id to use for this SN74HC165 component.
- **data_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC165 Serial Output (QH) input.
- **clock_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC165 Clock (CLK) pin
- **load_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC165 Load input (SH/LD) pin
- **clock_inhibit_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC165 Clock Inhibit (CLK INH) pin
- **sr_count** (*Optional*, int): Number of daisy-chained shift registers, up-to 256. Defaults to ``1``.
Pin configuration variables:
****************************
- **SN74HC165** (**Required**, :ref:`config-id`): The id of the SN74HC165 component of the pin.
- **number** (**Required**, int): The pin number.
- **inverted** (*Optional*, boolean): If received value should be treated as inverted.
Defaults to ``false``.
.. note::
Pin number 0 is Pin A on the SN74HC165 that is furthest away from the microcontroller.
See Also
--------
- :doc:`binary_sensor/gpio`
- :apiref:`SN74HC165/SN74HC165.h`
- :ghedit:`Edit`

View File

@ -680,6 +680,7 @@ Misc Components
TCA9548A I²C Multiplexer, components/tca9548a, tca9548a.jpg
MCP23SXX I/O Expander - SPI Bus, components/mcp23Sxx, mcp230xx.svg
SX1509 I/O Expander, components/sx1509, sx1509.jpg
SN74HC165 I/O Expander, components/sn74hc165, sn74hc595.jpg
SN74HC595 I/O Expander, components/sn74hc595, sn74hc595.jpg
SIM800L, components/sim800l, sim800l.jpg
DFPlayer, components/dfplayer, dfplayer.svg