Expand description
The bus half of CMD_I2C_TRANSFER and CMD_I2C_SCAN, over any
embedded-hal-async bus.
transfer_with and scan_with are the part that is the same on
every board: turning the staged operation list into HAL operations
that read straight into the result buffer, walking a scan range, and
naming what went wrong in the protocol’s terms. guarded_transfer
and guarded_scan add what a board with a shared bus needs around
them—a bounded wait for the bus mutex, a deadline on the transaction,
and a Reservation through which the board’s own multi-transaction
procedures keep a host out of a peripheral mid-procedure. A board with
an exclusively owned bus can call the bare functions instead.
Structs§
- Held
- A
Reservationin force; dropping it releases the peripheral. - Reservation
- The peripheral one of the board’s own multi-transaction procedures currently holds, if any.
Traits§
- Reservations
- Independent board procedures may reserve different devices concurrently.
Functions§
- deadline_
for - How long a transaction moving
octetson a bus clocked atspeed_khzmay take before it is declared stuck. - guarded_
scan - The scan counterpart of
guarded_transfer: a range that covers a held address is refused whole rather than silently skipping it, so the host learns to try again instead of drawing a wrong inventory. - guarded_
transfer - Acquire
buswithinlock_timeout, refuse the transfer ifreservedholds its address, and perform it withindeadline. - scan_
deadline - The deadline for a whole scan: an address and a probe octet per address in the range.
- scan_
with - Probe every address in
request’s range with a one-octet read, writing the addresses that acknowledged intooutin ascending order and returning how many. - status_
for - The status a HAL error kind answers with.
- transfer_
deadline - The deadline for a transfer of
shape: its data plus one address octet per operation. - transfer_
with - Perform
requestonbus, writing the concatenated read data intooutand returning its length.