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 Instructions
Enable Peripheral
Make sure the peripheral is enabled:
- Enable GPIOx in
RCC→AHBENR[0].
Setup input mode
Configure the MODE and PUPDR register, for every pin that should act as digital input:
- Write
0x00to the corresponding fields inGPIOx→MODE. - Configure pull-up / -down in
GPIOx→PUPDR.