libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
gpio.c File Reference
Include dependency graph for gpio.c:

Go to the source code of this file.

Functions

void gpio_set (uint32_t gpioport, uint32_t gpios)
 Atomic set output. More...
 
void gpio_clear (uint32_t gpioport, uint32_t gpios)
 Atomic clear output. More...
 
void gpio_toggle (uint32_t gpioport, uint32_t gpios)
 Atomic toggle output. More...
 
void gpio_enable (uint32_t gpioport, uint32_t gpios, enum gpio_mode mode)
 Enable output pins. More...
 
void gpio_disable (uint32_t gpioport, uint32_t gpios)
 Disable output pins. More...
 

Function Documentation

◆ gpio_clear()

void gpio_clear ( uint32_t  gpioport,
uint32_t  gpios 
)

Atomic clear output.

Parameters
[in]gpioportuint32_t: GPIO Port base address
[in]gpiosuint32_t

Definition at line 48 of file gpio.c.

References GPIO_OVRC.

◆ gpio_disable()

void gpio_disable ( uint32_t  gpioport,
uint32_t  gpios 
)

Disable output pins.

Onlyc the ones where bits are set to "1" are touched, everything else remains in the old state.

Parameters
[in]gpioportuint32_t: GPIO Port base address
[in]gpiosuint32_t

Definition at line 97 of file gpio.c.

References GPIO_GPERC.

◆ gpio_enable()

void gpio_enable ( uint32_t  gpioport,
uint32_t  gpios,
enum gpio_mode  mode 
)

Enable output pins.

Onlyc the ones where bits are set to "1" are touched, everything else remains in the old state.

Parameters
[in]gpioportuint32_t: GPIO Port base address
[in]gpiosuint32_t
[in]modeenum gpio_mode GPIO mode. IN, OUT or peripheral function.

Definition at line 72 of file gpio.c.

References GPIO_GPERC, GPIO_GPERS, GPIO_MODE_IN, GPIO_MODE_OUT, GPIO_ODERC, GPIO_ODERS, and GPIO_PMR_SETVAL.

◆ gpio_set()

void gpio_set ( uint32_t  gpioport,
uint32_t  gpios 
)

Atomic set output.

Parameters
[in]gpioportuint32_t: GPIO Port base address
[in]gpiosuint32_t

Definition at line 38 of file gpio.c.

References GPIO_OVRS.

◆ gpio_toggle()

void gpio_toggle ( uint32_t  gpioport,
uint32_t  gpios 
)

Atomic toggle output.

Parameters
[in]gpioportuint32_t: GPIO Port base address
[in]gpiosuint32_t

Definition at line 58 of file gpio.c.

References GPIO_OVRT.