UPB-CS-OpenSourceUpstream / tock

A secure embedded operating system for microcontrollers
https://www.tockos.org
Other
2 stars 6 forks source link

Implement I2C using generics instead of trait objects #6

Closed alexandruradovici closed 10 months ago

alexandruradovici commented 1 year ago

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.

A good start is the virtual SPI implementation.

https://github.com/UPB-CS-OpenSourceUpstream/tock/blob/de221b2a1748b61f03d59ebf6c053514e2a8dba3/capsules/src/virtual_i2c.rs#L44

JADarius commented 1 year ago

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?