Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| stm32:peripherals:gpio_input [2016/02/25 07:11] – feur | stm32:peripherals:gpio_input [2022/12/28 08:15] (current) – ruan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | |||
| - | |||
| ====== General Purpose Input ====== | ====== General Purpose Input ====== | ||
| * The output buffer is disabled. | * The output buffer is disabled. | ||
| * The Schmitt trigger input is active. | * The Schmitt trigger input is active. | ||
| - | * The pull-up and -down resistors are active, according to [[gpio#registers|PUPDR]]. | + | * The pull-up and -down resistors are active, according to [[#PUPDR|PUPDR]]. |
| * Input data is sampled every AHB clock. | * Input data is sampled every AHB clock. | ||
| * Input data register holds I/O state. | * Input data register holds I/O state. | ||
| Line 11: | Line 9: | ||
| \\ {{gpio_input.svg}} \\ \\ | \\ {{gpio_input.svg}} \\ \\ | ||
| - | ==== Configuration Registers ==== | + | ===== Programming Instructions ===== |
| + | |||
| + | ==== Enable Peripheral ==== | ||
| + | |||
| + | Make sure the peripheral is enabled: | ||
| + | * Enable GPIOx in '' | ||
| + | |||
| + | ==== Setup input mode ==== | ||
| + | |||
| + | Configure the MODE and PUPDR register, for every pin that should act as digital input: | ||
| + | * Write '' | ||
| + | * Configure pull-up / -down in '' | ||
| + | \\ | ||
| + | |||
| + | ===== 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)| | ||
| + | |::: | ||
| + | |::: | ||
| - | |< 100% 10em >| | + | ===== Data Registers ===== |
| - | |[[gpio# | + | |
| - | |[[gpio# | + | |
| - | ==== Data Registers | + | ==== GPIOx_IDR - Port input data register |
| - | |< 100% 10em >| | + | \\ {{gpio_reg_idr.svg}} \\ \\ |
| - | |[[gpio# | + | |
| - | ===== Legend ===== | + | * Register is read only \\ \\ |
| - | \\ {{legende.svg}} \\ \\ | ||