btashton commented on pull request #1788:
URL: https://github.com/apache/incubator-nuttx/pull/1788#issuecomment-692838141
> Oh, so you mean because spi_init is generic? I think you could simply do
something like:
>
> if (priv == g_spi0dev)
> {
> #ifdef BOARD_SPI0_MISO_PIN
> /* use pin for SPI, configure it */
> #else
> /* set SPI to not use it */
> #endif
> }
> else if (priv == g_spi1dev)
> {
> #ifdef BOARD_SPI1_MISO_PIN
> /* use pin for SPI, configure it */
> #else
> /* set SPI to not use it */
> #endif
> }
> /* ... and so on */
>
> If you had the g_spiNdev in an array this could be further simplified with
a parametrized macro
> taking the instance number.
At that point we might as well just make `nrf52_spi_init` into unique
functions for each controller it will be the same amount of copied code?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]