Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 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|PUPDR]]. * Input data is sampled every AHB clock. * Input data register holds I/O state. \\ {{gpio_input.svg}} \\ \\ ===== 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 ''0x00'' to the corresponding fields in ''GPIOx->MODE''. * Configure pull-up / -down in ''GPIOx->PUPDR''. \\ ===== Configuration Registers ===== ==== GPIOx_MODER - GPIO port mode register ==== \\ {{gpio_reg_common.svg}} \\ \\ |< 100% 5em 5em >| |Pin x|00|Input mode (reset state)| ==== GPIOx_PUPDR - GPIO port pull-up / pull-down register ==== \\ {{gpio_reg_common.svg}} \\ \\ |< 100% 5em 5em >| |Pin x|00|No pull-up, pull-down (reset state)| |:::|01|Pull-up| |:::|10|Pull-down| ===== Data Registers ===== ==== GPIOx_IDR - Port input data register ==== \\ {{gpio_reg_idr.svg}} \\ \\ * Register is read only \\ \\ stm32/peripherals/gpio_input.txt Last modified: 2022/12/28 08:15by ruan