-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPI CS Traits / Implementations #180
Comments
How would it work with multiple chip selects? Would you have multiple wrappers sharing the same SPI driver object (in some kind of Cell wrapper) each with a unique GPIO? |
Yeah good question, depends on the implementation (Linux you could just create multiple devices This is not quite as trivial as using a shared-bus object in the proposed wrapper as you really need to take ownership of the bus before asserting CS, so shared-bus or similar would need to be extended with support for all the CS stuff. There's also a related issue in shared-bus Rahix/shared-bus#8 discussing this exact problem. |
Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
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 implementsChipSelect
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 forno_cs
andwith_cs
versions, however, will be required for many SPI devices.The text was updated successfully, but these errors were encountered: