You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am fairly new to embedded rust, and I have been struggling to get more than 1 I2C device working on a bus.
The problem is that any sensor owns the I2cDriver so that it can only be used once. The RefCellDevice from embedded_hal_bus is supposed to be the solution for this, but I can`t get it to compile without trait constraint errors.
Can somebody provide an example as to how to get multiple I2C devices to work on a single bus?
Here is what I tried (abbreviated from my original code):
The problem is your mlx9061x driver crate you are using. You are currently using the embedded-hal-bus version that is using embedded-hal v1.0.0. The bme280 crate is also using embedded-hal v1.0 but the mix9061 crate still uses embedded-hal 0.2 and thats why you got that conflict. While in esp-idf-hal we supports both e-hal 0.2 and e-hal 1.0, on any instance you need to use either one or the othere in your drivers that share a bus. You cant mix them on one embedded-hal-bus implementation.
Closing as advice was given. For deeper information the embedded-hal repository also offers some information. We fully support embedded-hal but its concrete usage is not specific to esp-idf-hal
I am fairly new to embedded rust, and I have been struggling to get more than 1 I2C device working on a bus.
The problem is that any sensor owns the
I2cDriver
so that it can only be used once. TheRefCellDevice
fromembedded_hal_bus
is supposed to be the solution for this, but I can`t get it to compile without trait constraint errors.Can somebody provide an example as to how to get multiple I2C devices to work on a single bus?
Here is what I tried (abbreviated from my original code):
This fails to compile with
at
Mlx9061x::new_mlx90614(....)
My dependecies are:
The text was updated successfully, but these errors were encountered: