2
\$\begingroup\$

Why is the GPIO enabled and then immediately disabled in the following piece of program code?

void GPIO_DeInit(GPIO_TypeDef* GPIOx)
    {
      /* Check the parameters */
      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    
      if (GPIOx == GPIOA)
      {
        RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOA, ENABLE);
        RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOA, DISABLE);
      }
\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

Those two lines reset the GPIOx peripheral. Firstly it sets the reset bit in the register to initialize the reset. Then it has to reset the reset bit to take the peripheral back to power reset state.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.