← index #11082PR #16428
Likely Duplicate · high · value 1.072
QUERY · ISSUE

RP2 SPI: Instantiating with spi=None does not behave sensibly.

openby peterhinchopened 2023-03-20updated 2024-09-02
bugport-rp2

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.

CANDIDATE · PULL REQUEST

rp2/spi: Allow omitting of unused pins

closedby msalauopened 2024-12-16updated 2025-03-27
port-rp2

Summary

The change makes it possible to omit unused SPI pins.
This can be achieved by setting a pin as None.

Testing

The change as been tested on a custom RP2040 board with only SCK and MOSI used to drive a SPI IC.

Trade-offs and Alternatives

The commit changes behavior if the constructor method.
Previously if a pin was set as None the default pin number for this interface has been used.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied