[feature-nrf528xx] NRF52 SPI and I2C re-implementation #6296
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.
This PR re-implements SPI and I2C in a way that lets both drivers share the underlying hardware. From the new README.md file:
SPI and I2C
The TWI/TWIM (I2C) and SPI/SPIM module shares the same underlying hardware and each instance can only provide one functionality at a time. Both the NRF52832 and NRF52840 have 2 TWI/TWIM modules and 3 SPI/SPIM:
When instantiating a new Mbed SPI object or I2C object, the object will be assigned a hardware instance. By default, the HAL implementation will automatically pick a hardware instance based on the assigned pins in the following order:
Instance 0
for I2C andInstance 2
for SPI.Customization
A custom configuration table can be provided by overriding the weakly defined default empty table. In the example below, I2C objects using pins
p1
andp2
forSDA
andSCL
will always be assigned toInstance 1
and SPI objects using pinsp3
,p4
,p5
forMOSI
,MISO
, andCLOCK
will be assigned toInstance 2
and SPI objects using pinsp6
,p7
, andp8
will be assigned toInstance 0
. The custom configuration table must always be terminated with a row ofNC
.The tables must be placed in a C compilation file.
Concurrency