Description
At the moment we aren't super explicit about management of the chip select pin for SPI transactions, which means drivers have to either manage these themselves or make big assumptions about the underlying SPI implementation.
With #178 we have the ability to execute multiple operations in a single transaction which brings this to the forefront. (@jonas-schievink this is why I didn't call them Transaction
because the whole thing is a bus transaction, whoops.)
To mitigate this, I'm proposing the addition of a ChipSelect
marker trait for SPI devices that manage SPI themselves, As well as a wrapper object that takes an SPI object GPIO output and implements ChipSelect
to simplify the use of devices with manual CS management.
A downside of this is that we now need to return distinct types where ChipSelect
or !ChipSelect
in cases where either is possible, for example, the linux embedded hal driver may have CS managed automatically or be used with manual CS management. This could be mitigated by splitting the constructors for no_cs
and with_cs
versions, however, will be required for many SPI devices.