You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/09/14 22:45:42 UTC

[GitHub] [incubator-nuttx] v01d commented on a change in pull request #1788: nRF: Allow configuration of non connected GPIO

v01d commented on a change in pull request #1788:
URL: https://github.com/apache/incubator-nuttx/pull/1788#discussion_r488279394



##########
File path: arch/arm/src/nrf52/nrf52_spi.c
##########
@@ -445,9 +456,13 @@ static int nrf52_spi_init(FAR struct nrf52_spidev_s *priv)
 
   pin   = GPIO_PIN_DECODE(priv->miso_pin);
   port  = GPIO_PORT_DECODE(priv->miso_pin);
+  regval = SPIM_PSELMISO_CONNECTED;  /* Disconnect */
+  if ((priv->miso_pin & GPIO_FUNC_MASK) != GPIO_DISABLED)
+    {
+      regval = (pin << SPIM_PSELMISO_PIN_SHIFT);
+      regval |= (port << SPIM_PSELMISO_PORT_SHIFT);
+    }

Review comment:
       ```suggestion
   #ifdef BOARD_SPI1_MISO_PIN
     pin   = GPIO_PIN_DECODE(BOARD_SPI1_MISO_PIN);
     port  = GPIO_PORT_DECODE(BOARD_SPI1_MISO_PIN);
     regval = (pin << SPIM_PSELMISO_PIN_SHIFT);
     regval |= (port << SPIM_PSELMISO_PORT_SHIFT);
   #else 
     regval = SPIM_PSELMISO_CONNECTED;  /* Disconnect */
   #endif
   ```
   
   something like this?




----------------------------------------------------------------
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:
users@infra.apache.org