Expand description

This module provides functionality for General Purpose Input and Output (GPIO) pins, including all GPIOx register functions. It also configures GPIO interrupts using SYSCFG and EXTI registers as appropriate.

Structs

Represents a single GPIO pin. Allows configuration, and reading/setting state.

Enums

Values for GPIOx_LCKR.

The pulse edge used to trigger interrupts.

Values for GPIOx_OSPEEDR. This configures I/O output speed. See the user manual for your MCU for what speeds these are. Note that Fast speed (0b10) is not available on all STM32 families.

Values for GPIOx_OTYPER

Values for GPIOx_MODER

Values for GPIOx_IDR and GPIOx_ODR.

GPIO port letter

Values for GPIOx_PUPDR

Values for GPIOx_BRR.

Functions

Clear an EXTI interrupt, lines 0 - 15. Note that this function currently doesn’t support higher extis, but will work for all GPIO interrupts.

Check if a pin’s input voltage is high. Reads from the IDR register. Does not require a Pin struct.

Check if a pin’s input voltage is low. Reads from the IDR register. Does not require a Pin struct.

Set a pin’s output voltage to high. Sets the BSRR register. Atomic. Does not require a Pin struct.

Set a pin’s output voltage to low. Sets the BSRR register. Atomic. Does not require a Pin struct.

Write a series of words to the BSRR (atomic output) register. Note that these are direct writes to the full, 2-sided register - not a series of low/high values.