v01d commented on pull request #1788:
URL: https://github.com/apache/incubator-nuttx/pull/1788#issuecomment-692829391


   Oh, so you mean because spi_init is generic? I think you could simply do 
something like:
   <pre>
   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 */
   </pre>
   
   If you had the g_spiNdev in an array this could be further simplified with a 
parametrized macro
   taking the instance number.


----------------------------------------------------------------
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]


Reply via email to