Why to Enable and then why to immediately Disable at the following piece of program?

void GPIO_DeInit(GPIO_TypeDef* GPIOx)
      /* Check the parameters */

      if (GPIOx == GPIOA)
        RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOA, ENABLE);
        RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOA, DISABLE);

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.


Your Answer

