Closed jfpoilpret closed 1 year ago
As expected initially, FastArduino SPIDevice
can work out of the box without the need of a CS
pin.
You just pass DigitalPin::NONE
for CS
and that's it!
You should then be able to handle a single SPI device, provided its CS pin is forced to GND.
However, do perform some experiments to ensure your SPI device does support this way of working, with an always-0 CS pin. It seems some devices do not work properly with such wiring!
I will close this issue as there is nothing to do, besides updating SPIDevice
API doc a little bit.
No need for a fix. Doc updated on master in commit #f3a571d
In many boards, one may use a single SPI device for which there is no need for a specific CS "Chip Select" pin, as this could be directly forced on the device to the proper level (generally GND).
Currently, FastArduino
SPIDevice
class, the base of all SPI devices, requires the following template arguments:board::DigitalPin CS
ChipSelect CS_MODE
FastArduino
SPIDevice
class should make these arguments optional and perform CS pin management only when one CS pin is provided.One easy way to handle this improvement, without a deep redesign of
SPIDevice
class and all current subclasses implemented in FastArduino or outside, would be to:NONE
inenum DigitalPin
: using that pin would mean "no pin"SPIDevice
, perform CS management only when CS pin is a real digital pinIn the best case, SPI would not need to be changed as
gpio
namespace already handles NONE pins by providing empty methods for everything.