This is an old revision of the document!
General Purpose Input
- The output buffer is disabled.
- The Schmitt trigger input is active.
- The pull-up and -down resistors are active, according to PUPDR.
- Input data is sampled every AHB clock.
- Input data register holds I/O state.
Programming example
The code snippet bellow shows how to configure a GPIO pin as input.
#include "reg_stm32f4xx.h" GPIOA->MODER &= ~(0x3 << 20u); /* Clear existing mode bits 20 and 21. */ GPIOA->PUPDR &= ~(0x3 << 20u); /* Clear existing pull-up/-down bit 20 and 21. */ GPIOA->PUPDR |= (0x1 << 20u); /* Set pin 10 to pull-up mode. */ uint32_t data = GPIOA->IDR; /* Read the input data register. */