KurtE
Senior Member+
@joepasquariello Perhaps you are right, I should have stopped at the first line. Let me rephrase.
My sincere feeling is that in an embedded environment, the default API should be close to the hardware and something like shared access, that inevitably costs extra cycles and serves a subset of the possible use cases, should be a convenience layer.
Everything is a tradeoff... There used to be code in place, that would remember if the last output was 8 bit or 16 bit and if the next one is different it changes the setting. Which in isolation worked great.
However, then you run into issues. like someone comes along who believe they can do it better and writes their own spi transfer function and change the registers out from under you. And that flag is out of sync and your code starts to show some subtle errors. These issues often take a long time to isolate and track down. Several cases of this happened. Also, a lot of the code out there just assumed that transfers were 8 bits and again ran into libraries and sketches that no longer worked correctly.
So it often comes down to, what is more important, compatibility or the fastest possible some metric for some specific usage case? And with standard libraries like SPI, Wire, ... compatibility is usually considered reasonably important.