Expand description
Asynchronous I²C API adaptation for Tokio
This module contains utility methods and adapter types for the operating system’s I²C API, for use within (and only within) a Tokio runtime. Currently, only the Linux I²C API is supported.
Tasks run by worker threads should not block, as this could delay
servicing reactor events. Most operating system’s I²C APIs are blocking,
however. This module offers adapters which use a blocking
annotation to
inform the runtime that a blocking operation is required. When necessary,
this allows the runtime to convert the current thread from a worker to a
backup thread, where blocking is acceptable. This is the same approach as
for the tokio-fs
module.
When the overhead of this asynchronization approach for many small I²C
messages is a concern, consider to pack multiple I²C messages into a single
I²C transfer or even to pack multiple I²C transfers into a single Future
when appropriate, see i2c_transfer
and i2c_transfers
.
Modules§
- prelude
- A “prelude” for users of the
tokio-i2c
crate.