xref: /aosp_15_r20/external/pigweed/pw_i2c/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_i2c:
2
3======
4pw_i2c
5======
6.. pigweed-module::
7   :name: pw_i2c
8
9.. tab-set::
10
11   .. tab-item:: app.cpp
12
13      .. include:: ../pw_i2c_rp2040/docs.rst
14         :start-after: .. pw_i2c_rp2040-example-start
15         :end-before: .. pw_i2c_rp2040-example-end
16
17   .. tab-item:: BUILD.bazel
18
19      .. code-block:: py
20
21         cc_library(
22           # ...
23           deps = [
24             # ...
25             "@pigweed//pw_i2c:address",
26             "@pigweed//pw_i2c:device",
27             # ...
28           ] + select({
29             "@platforms//os:freertos": [
30               "@pigweed//pw_i2c_rp2040:initiator",
31             ],
32             "//conditions:default": [
33               # Fake example of a custom implementation.
34               "//lib/pw_i2c_my_device:initiator",
35             ],
36           }),
37         )
38
39``pw_i2c`` provides C++ libraries and helpers for interacting with I2C
40devices.
41
42.. grid:: 2
43
44   .. grid-item-card:: :octicon:`rocket` Quickstart
45      :link: module-pw_i2c-quickstart
46      :link-type: ref
47      :class-item: sales-pitch-cta-primary
48
49      How to set up ``pw_i2c`` in your build system
50      and interact with an I2C device via the C++ API.
51
52   .. grid-item-card:: :octicon:`list-unordered` Guides
53      :link: module-pw_i2c-guides
54      :link-type: ref
55      :class-item: sales-pitch-cta-secondary
56
57      How to mock up I2C transactions, configure and read from a device's
58      register, communicate with an I2C device over RPC, and more.
59
60.. grid:: 2
61
62   .. grid-item-card:: :octicon:`code-square` Reference
63      :link: module-pw_i2c-reference
64      :link-type: ref
65      :class-item: sales-pitch-cta-secondary
66
67      API references for ``pw::i2c::Initiator``, ``pw::i2c::Address``,
68      ``pw::i2c::Device``, and more.
69
70   .. grid-item-card:: :octicon:`stack` Implementations
71      :link: module-pw_i2c-impl
72      :link-type: ref
73      :class-item: sales-pitch-cta-secondary
74
75      A summary of the existing ``pw_i2c`` implementations and a guide
76      on how to create your own.
77
78.. toctree::
79   :hidden:
80   :maxdepth: 1
81
82   guides
83   reference
84   backends
85