Skip to content
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

Update i2c.rst #4356

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/i2c.rst
jesserockz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ Configuration variables:
address: 0x76
# ...

For I2C multiplexing see :doc:`/components/tca9548a`.
For I²C multiplexing see :doc:`/components/tca9548a`.

See Also
--------

- :doc:`/components/tca9548a`
- :doc:`/components/i2c_device`
- :apiref:`i2c/i2c.h`
- :ghedit:`Edit`
37 changes: 37 additions & 0 deletions components/i2c_device.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Generic I²C device component:
-----------------------------
.. _i2c_device:

General-purpose I²C device component that can be used to communicate with hardware not supported by a specific component. It allows selection of the I²C address. Reads and writes on the device can be performed with lambdas. For example:

.. code-block:: yaml

i2c:
sda: 4
scl: 5
scan: True

i2c_device:
id: i2cdev
address: 0x2C

on...:
then:
- lambda: !lambda |-
id(i2cdev).write_byte(0x00, 0x12);
if (auto b = id(i2cdev).read_byte(0x01)) {
// TODO
}


Configuration variables:
------------------------

- **address** (*Required*, int): I²C address of the device.

See Also
--------

- :doc:`/components/i2c`
- :apiref:`i2c_device/i2c_device.h`
- :ghedit:`Edit`
Loading