• Home
  • Raw
  • Download

Lines Matching +full:device +full:- +full:select

1 .. _module-pw_spi:
10 --------
12 --------
17 - ``pw::spi::Initiator`` - Interface for configuring a SPI bus, and using it
19 - ``pw::spi::ChipSelector`` - Interface for enabling/disabling a SPI
21 - ``pw::spi::Device`` - primary HAL interface used to interact with a SPI
23 - ``pw::spi::Responder`` - Interface for implementing a SPI responder.
25 ``pw_spi`` relies on a target-specific implementations of
27 injected into ``pw::spi::Device`` objects which are used to communicate with a
30 Example - Constructing a SPI Device:
32 .. code-block:: cpp
45 auto device = pw::spi::Device(
48 This example demonstrates the construction of a ``pw::spi::Device`` from its
54 mutual-exclusion wrapper for the the injected ``pw::spi::Initiator``, ensuring
58 Once constructed, the ``device`` object can then be passed to functions used to
61 Example - Performing a Transfer:
63 .. code-block:: cpp
65 pw::Result<SensorData> ReadSensorData(pw::spi::Device& device) {
70 // This device supports full-duplex transfers
71 PW_TRY(device.WriteRead(kAccelReportCommand, raw_sensor_data));
76 SPI accelerometer. The function performs a full-duplex transfer with the
77 device to read its current data.
79 As this function relies on the ``device`` object that abstracts the details
80 of bus-access and chip-selection, the function is portable to any target
83 Example - Performing a Multi-part Transaction:
85 .. code-block:: cpp
87 pw::Result<SensorData> ReadSensorData(pw::spi::Device& device) {
93 pw::spi::Device::Transaction transaction =
94 device.StartTransaction(pw::spi::ChipSelectBehavior::kPerTransaction);
96 // This device only supports half-duplex transfers
106 ``Transaction`` API in ``pw::spi::Device`` to perform separate, half-duplex
112 (``pw::spi::Initiator``) until it goes out-of-scope.
114 ------------------
116 ------------------
119 - The ``pw::spi::Initiator`` interface, and its associated configuration data
121 - The ``pw::spi::ChipSelector`` interface.
122 - The ``pw::spi::Device`` class.
123 - The ``pw::spi::Responder`` interface.
126 ------------------
127 .. inclusive-language: disable
138 - clock polarity/phase
139 - bits-per-word (between 3-32 bits)
140 - bit ordering (LSB or MSB first)
153 .. inclusive-language: enable
160 including the clock polarity, clock phase, bit-order, and bits-per-word.
162 Returns OkStatus() on success, and implementation-specific values on
170 all requested data is written-to and read-from the bus. In the event the
171 read buffer is smaller than the write buffer (or zero-size), any
174 0-bits for the remainder of the transfer.
176 Returns OkStatus() on success, and implementation-specific values on
180 ---------------------
185 -------------------------------
189 pw::spi::Device
190 ---------------
191 This is primary object used by a client to interact with a target SPI device.
195 de-actviate the device on-demand from within the data transfer methods.
199 half-duplex operations, where ``WriteRead()`` provides support for
200 full-duplex transfers.
202 The ``StartTransaction()`` method provides support for performing multi-part
210 Mutual-exclusion to the ``pw::spi::Initiator`` object is provided by the use of
214 .. cpp:class:: pw::spi::Device
220 This call will configure the bus and activate/deactivate chip select
226 Returns OkStatus() on success, and implementation-specific values on
232 This call will configure the bus and activate/deactivate chip select
238 Returns OkStatus() on success, and implementation-specific values on
246 the read buffer is smaller than the write buffer (or zero-size), any
249 0-bits for the remainder of the transfer.
250 This call will configure the bus and activate/deactivate chip select
256 Returns OkStatus() on success, and implementation-specific values on
261 Begin a transaction with the SPI device. This creates an RAII
264 parameter provides a means for a client to select how the chip-select
267 chip-select on each operation, while `kPerTransaction` will hold the
268 chip-select active for the duration of the Transaction object.
270 .. cpp:class:: pw::spi::Device::Transaction
277 Returns OkStatus() on success, and implementation-specific values on
284 Returns OkStatus() on success, and implementation-specific values on
292 all requested data is written-to and read-from the bus. In the event the
293 read buffer is smaller than the write buffer (or zero-size), any
296 0-bits for the remainder of the transfer.
298 Returns OkStatus() on success, and implementation-specific values on
302 ----------------------
310 .. code-block:: cpp
340 ------------------
342 respond to SPI transactions coming from a SPI initiator in a non-target specific
347 .. code-block:: cpp