General Purpose Input




Programming Instructions

Enable Peripheral

Make sure the peripheral is enabled:

Setup input mode

Configure the MODE and PUPDR register, for every pin that should act as digital input:


Configuration Registers

GPIOx_MODER - GPIO port mode register




Pin x00Input mode (reset state)

GPIOx_PUPDR - GPIO port pull-up / pull-down register




Pin x00No pull-up, pull-down (reset state)
01Pull-up
10Pull-down

Data Registers

GPIOx_IDR - Port input data register




* Register is read only