RP2 SPI: Instantiating with spi=None does not behave sensibly.
The constructor accepts None as an arg to miso, but still instantiates the default pin.
The clear intent is to create an output-only interface. Either it should reject the arg or (preferably) it should not instantiate a pin. Current behaviour can lead to unexpected pin conflicts.
This should also apply to mosi.
esp32: Hardware SPI class initialiser doesn't support None for unused signals
I'm using hardware SPI on ESP32 without the sck or miso signals (both interfaces). When initialising the peripheral, this is an error:
spi = SPI(1, baudrate=1000000, sck=None, mosi=Pin(12), miso=None)
because you're not allowed to specify None for the sck and miso parameters.
However this is A-OK:
spi = SPI(1)
spi.init(baudrate=1000000, sck=None, mosi=Pin(12), miso=None)
and does exactly what I want: internally the None is translated to a -1 signal specification for the spi_bus_config_t structure to indicate that the signal is not used.
The problem with the latter is that it grabs and initialises the default pins first before reconfiguring. I would prefer that SPI left these pins alone as I need them for other purposes and this forces me into a careful initialisation order dance to make sure my pins are all correct at the end.
It doesn't look like a big fix, so I'm happy to put in my own PR if there's agreement on aligning these APIs.