Open Sycrosity opened 2 months ago
Fwiw you can use the I2C interface directly by doing e.g. I2CInterface::new(i2c, 03xc, 0x40)
rathe then going though the I2CDisplayInterface
helper, avoiding the need to fork.
Creating a Async version with maybe_async_cfg should be trivial; The other option is to just drop the trait bound, though that would push the error down to later in the code if it doesn't do i2c (or async i2c)
::: /Users/louis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/display-interface-i2c-0.5.0/src/lib.rs:11:1
|
11 | pub struct I2CInterface<I2C> {
| ---------------------------- doesn't satisfy `_: WriteOnlyDataCommand`
unfortunately, using I2CInterface doesn't seem to work either (unless I'm missing something) as this does not satisfy the other trait bound. maybe_async_cfg
seems like a decent way of going about this.
ssd1306
in use (if applicable): v0.9.0Description of the problem/feature request/other
When using an asynchronous I2C instance to initialise
I2CDisplayInterface
, (such asesp_hal::i2c::I2C<'static, esp_hal::peripherals::I2C0, Async>,
), which implementsembedded_hal_async::i2c::I2c
rather thanembedded_hal::i2c::I2c
, an error occurs.I wrote an implimentation in embedevices-rs/ssd1306 which creates the trait bounds for this, except it doesn't account for people using the library without async. Maybe an async version of
I2CDisplayInterface
(e.g.I2CDisplayInterfaceAsync
) or additional trait bounds which are enabled when theasync
feature is enabled would fix this issue?While this error isn't particularly readable, it shows the problem: