-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Serial multiplexed display #4880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Rendman
wants to merge
6
commits into
esphome:next
Choose a base branch
from
Rendman:serial_multiplexed_display
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4c4f3cc
Add serial multiplexed display documentation.
Rendman 68474d0
Added index entry
Rendman f7848a2
fixed automatically detected issues.
Rendman c8cbff8
added missing image
Rendman dfe2c27
fixed lint errors
Rendman 5e8838d
fixed index.rst order issue.
Rendman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Serial Shift Register Multiplexed Displays | ||
========================================== | ||
|
||
.. seo:: | ||
:description: Instructions for setting up a serial shift register based display. | ||
:image: serial_multiplexed_display.jpg | ||
|
||
The ``serial_multiplexed_display`` display platform allows you to use (for now) two different kinds of serial shift registers to drive segment displays with ESPHome. | ||
|
||
.. figure:: images/serial_multiplexed_display.jpg | ||
:align: center | ||
:width: 75.0% | ||
|
||
SN74HC595 Serial Shift Register. | ||
|
||
These devices normally require three GPIO inputs, clock, data, and latch. These pins can be configured for the component like below. | ||
|
||
|
||
.. code-block:: yaml | ||
|
||
# Example configuration entry | ||
display: | ||
- platform: serial_multiplexed_display | ||
model: sn74hc595 | ||
latch_pin: GPIO35 | ||
clk_pin: GPIO34 | ||
data_pin: GPIO33 | ||
common_cathode: True | ||
reversed: True | ||
lambda: |- | ||
it.printf("%s", "1234"); | ||
|
||
Configuration variables: | ||
------------------------ | ||
|
||
- **model** (**Required**, string): The model of the shift register, one of ``sn74hc595``, or ``ct1642``. | ||
- **data_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin for serial data. | ||
- **clk_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin for the serial clock. | ||
- **latch_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin for the latch signal. | ||
- **length** (*Optional*, int): The number of segment displays connected to the shift registers. (defaults to 4, must be between 1 and 8) | ||
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use for rendering the content on the TM1621. | ||
See :ref:`display-serial_multiplexed_display_lambda` for more information. | ||
- **common_cathode** (*Optional*, boolean): True if the displays are configured as common cathode. | ||
- **reversed** (*Optional*, boolean): True to reverse the display order of the segment displays. | ||
- **update_interval** (*Optional*, :ref:`config-time`): The interval to re-draw the screen. Defaults to ``1s``. | ||
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. | ||
|
||
.. _display-serial_multiplexed_display_lambda: | ||
|
||
Rendering Lambda | ||
---------------- | ||
|
||
This component has a similar API to the fully fledged :ref:`display-engine`, but it's only a subset as it's intended to | ||
be used with segment displays (such as 7 segments) and does not have a concept of individual pixels. | ||
In the lambda you're passed a variable called ``it`` as with all other displays. In this case however, ``it`` is a SerialMultiplexedDisplay | ||
instance (see API Reference). | ||
|
||
The most basic operation is writing a simple number to the screen as in the configuration example | ||
at the top of this page. But even though you're passing in a string (here ``"1234"``), ESPHome converts it | ||
into a representation that the connected segments can understand. | ||
|
||
This component does not support the decimal point on displays, yet. | ||
|
||
.. code-block:: yaml | ||
|
||
display: | ||
- platform: serial_multiplexed_display | ||
# ... | ||
lambda: |- | ||
it.printf("%d", id(my_sensor1).state); | ||
|
||
|
||
Please see :ref:`display-printf` for a quick introduction into the ``printf`` formatting rules. | ||
|
||
See Also | ||
-------- | ||
|
||
- :doc:`index` | ||
- :ghedit:`Edit` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.