3 ms·
In esp-hal, they offer both sync and async I2C implementations, depending on what works best for an application. Since the async implementation is gated by a fe
by coder543 3y ago
In esp-hal, they offer both sync and async I2C implementations, depending on what works best for an application. Since the async implementation is gated by a feature, it may not show up in the docs you linked.
Async implementation: https://github.com/esp-rs/esp-hal/blob/main/esp-hal-common/src/i2c.rs#L317 https://github.com/esp-rs/esp-hal/blob/main/esp-hal-common/s...
You can also see the async feature mentioned here: https://docs.rs/crate/esp32s2-hal/latest/features https://docs.rs/crate/esp32s2-hal/latest/features
There is a very brief example of using async i2c here: https://github.com/esp-rs/esp-hal/blob/main/esp32s3-hal/examples/embassy_i2c.rs https://github.com/esp-rs/esp-hal/blob/main/esp32s3-hal/exam... (you can see that it is using `lis3dh_async`, which requires async i2c)
Not specific to the ESP platforms, but Embassy offers a more useful example of async i2c here: https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/i2c_async.rs#L79 https://github.com/embassy-rs/embassy/blob/main/examples/rp/... (and it would work the same on ESP)