The virtual I2C and I2C Master are implemented using &dyn I2C which does add some overhead and prevents some compiler optimizations. A possible optimization is the implementation using generics where I: I2C.
I started working on this issue but I have a question: Do I have to modify the source files for every board and component that uses I2C or is there a more elegant solution?
The virtual I2C and I2C Master are implemented using
&dyn I2C
which does add some overhead and prevents some compiler optimizations. A possible optimization is the implementation using genericswhere I: I2C
.A good start is the virtual SPI implementation.
https://github.com/UPB-CS-OpenSourceUpstream/tock/blob/de221b2a1748b61f03d59ebf6c053514e2a8dba3/capsules/src/virtual_i2c.rs#L44