-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
This serves as an issue that can be referenced summarizing that the as-designed API simply cannot be implemented on all platforms.
This feels wrong. I know we've had issues w/the i2c api and burst_write, do we have any way of this not being NRFX specific?
ie can we some how detect that i2c_burst_write isn't supported and fall back?
Yes, we can add a common prefix to the device data structure with capability flags, similar to what's done in the new GPIO driver with active-low flags. To my knowledge only Nordic TWIM is unable to implement the API, so that driver would have to set a flag that all other drivers keep cleared. However, that would involve a runtime rather than compile-time check. (Also nobody's done a rigorous survey to confirm that only Nordic TWIM fails to support this; the closest we've come is #11612 (comment) which may be out of date, and suggests that NXP MCUX may also be incorrect.)
Is the non-burst write code NRFX specific or would it work on any controller that didn't support burst write?
The non-burst code is generic, though it's slightly fragile in that it assumes a maximum transfer size. Changes to the driver could require changes to the generic write function.
Even if we do this, we should probably reference an issue related to needing to fix the API.
We've tried to fix the API. The conclusion of #11612 is that we can't implement the designed functionality--I2C single-transaction gather writes--on all platforms. However, gather writes are extremely useful: #19972 is a specific example where we will not be able to use a workaround based on a constant-sized stack-allocated buffer, but we certainly don't want to penalize the platforms that are capable of doing such a write.
What I've proposed is the minimum change necessary to make the code work on the platform on which I need it to work. A more complete fix would be nice, but it's not easy to provide. Do we leave it broken, or do we make it slightly better?