tests: convert tests/extmod/machine_spi_rate.py to use target wiring, and add support for more ports
#18726
+99
−55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR converts
tests/extmod/machine_spi_rate.pyto use the target wiring mechanism, moving the port-specefic definition of the SPI instances that are being tested out of thetests/extmod/machine_spi_rate.pyfile and into the target wiring code. As part of this, the test is changed to always use the default pins for the given SPI instance.This simplifies the test, makes it easier to add support for new ports/boards, and allows reusing the
spi_standalone_instancesdefinition in other tests (if needed one day).It also adds SPI test support for the mimxrt, nrf, renesas-ra and samd ports.
Testing
Tested by running
tests/extmod/machine_spi_rate.pyon (thanks to octoprobe hardware!):The test passes.
Trade-offs and Alternatives
There are few decisions made here:
Noneto use the default SPI instance).spi_standalone_instancesvariable in the target wiring is a little different in name to existing variables used there, but I think it's acceptable.