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


   > But that's not really documented is it? Sounds more like a side-effect. 
   
   Yes, this is just side-effect, that sets up the first GPIO to reset state. 
   
   I think now there is a more proper way to disconnect peripheral from pin - 
you just define pin as in the reset state, eg
   `#define GPIO_SPI1_SCK  (GPIO_INPUT|GPIO_PORTA|GPIO_PIN5) // no alternate 
function configured`
   But this can't be done this way for NRF52, there must be a special flag in 
pincfg to avoid PSEL configuration.
   So maybe in other arch there is no GPIO_DISABLED flag because it is not 
required there to achieve the given functionality.
   
   > But besides the pinmux (which would be simply predefined _1, _2 values for 
a given pin), pins are always mapped at buid-time with macros. It is not 
necessary to define all possible values for nRF52, the macros allow a 
peripheral to know what pin to use, not the other way around. So you don't need 
all possible peripheral cases for a pin.
   
   All supported NRF52 peripherals that use GPIO require logic like this to 
configure PSEL
   
   ```
     /* Setect TX pins for UART */
   
     pin  = GPIO_PIN_DECODE(config->txpin);
     port = GPIO_PORT_DECODE(config->txpin);
   
     regval = (pin << UART_PSELTXD_PIN_SHIFT);
     regval |= (port << UART_PSELTXD_PORT_SHIFT);
     putreg32(regval, base + NRF52_UART_PSELTXD_OFFSET);
   ```
   so this is done at runtime.
   I don't quite understand where this PR introduce more runtime GPIO 
configuration than it is already done in 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]


Reply via email to