Implement defaults for missing I2C methods based on writeThenRead - #744
Conversation
…what else is available and fits, so actual implementations only need to implement writeThenRead. Will look into ffm simplifications in a followup
| * @return the value returned by the action | ||
| */ | ||
| <T> T execute(Callable<T> action); | ||
|
|
There was a problem hiding this comment.
I agree on the plan to reduce what is implemented in providers. We need to force any i2c provider to implement
default void writeThenRead(byte[] writeBuffer, int writeOffset, int writeSize, int readDelayNanos, byte[] readBuffer, int readOffset, int readSize) {The default implementation is not correct. This is meant to be a start- write-restart-read-stop, a single atomic operation. When I tested FFM it was doing a single operation, we need to force the next implementation too do the same.
Can this single method be marked abstract to force its implementation ?
There was a problem hiding this comment.
Yes, let's do this in a followup where we switch over ffm to only implement this method and make it abstract in an atomic small change
EDIT: Expanding defaults and fixing implementations can be seen as two two different steps, that's why I'd prefer to keep them separated. And cleaning up implementations is probably easier when we have all the defaults in place.
taartspi
left a comment
There was a problem hiding this comment.
Agree we do make my SUG item next round
-- or what else is available and fits, so actual implementations only need to implement writeThenRead.
(addressing a todo in the mcp2221 bridge, which can be simplified (together with ffm)) accordingly.