-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
embedded_hal::i2c::I2c
no longer implemented for async I2c in esp-hal 0.21
#2342
Comments
FYI we published a patch release today which restores this trait implementation. |
I'm reopening this, just because we are pretty inconsistent with ehal traits in I2C. We implement ehal1::I2c for any mode, but ehal02 traits only for Blocking. We should probably be a bit more consistent, or at least decide whether we want to be intentionally inconsistent. |
I think there are three questions here, that we should answer and extend that answer to all our peripherals:
If the answer is "yes" to the third, we'd end up with the following, which has some interesting implications to generic code (user code couldn't be generic over impl I2c<Blocking> {
fn transfer();
}
impl I2c<Async> {
async fn transfer();
fn transfer_blocking();
} The internal implementations would need to be decoupled from the actual API, but that is a relatively small task. Then we could delegate public API as well as trait impls to these internal implementations. |
I seem to be in the minority, as I have shared this opinion before, but I think there is little value in continuing to implement these. Many of the traits are not even useful, and the |
Closing in favour of #2590 |
Bug description
In commit
00ad9b5eed876bb34a9a4daee8ee587a60425e6d
, theembedded_hal::i2c::I2c
trait was removed from async I2c and is now only implemented for blocking I2c.To Reproduce
Try using something requiring the
embedded_hal::i2c::I2c
trait with an async I2c bus.Expected behavior
embedded_hal::i2c::I2c
should be implemented for blocking and async I2c, as it was in 0.20.1.Environment
ESP32-S3 with esp-hal 0.21
The text was updated successfully, but these errors were encountered: