Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
gpio_arch.h File Reference

GPIO helper functions for STM32F1 and STM32F4. More...

#include <libopencm3/stm32/gpio.h>
+ Include dependency graph for gpio_arch.h:

Go to the source code of this file.

Typedefs

typedef uint32_t gpio_port_t
 Abstract gpio port type for hardware independent part. More...
 

Functions

void gpio_setup_output (uint32_t port, uint16_t gpios)
 Setup one or more pins of the given GPIO port as outputs. More...
 
void gpio_setup_input (uint32_t port, uint16_t gpios)
 Setup one or more pins of the given GPIO port as inputs. More...
 
void gpio_setup_input_pullup (uint32_t port, uint16_t gpios)
 Setup one or more pins of the given GPIO port as inputs with pull up resistor enabled. More...
 
void gpio_setup_input_pulldown (uint32_t port, uint16_t gpios)
 Setup one or more pins of the given GPIO port as inputs with pull down resistors enabled. More...
 
void gpio_setup_pin_af (uint32_t port, uint16_t pin, uint8_t af, bool is_output)
 Setup a gpio for input or output with alternate function. More...
 
void gpio_setup_pin_analog (uint32_t port, uint16_t pin)
 Setup a gpio for analog use. More...
 
void gpio_enable_clock (uint32_t port)
 Enable the relevant clock. More...
 

Detailed Description

GPIO helper functions for STM32F1 and STM32F4.

The gpio_set and gpio_clear functions are already available from libopencm3.

Definition in file gpio_arch.h.

Typedef Documentation

◆ gpio_port_t

Abstract gpio port type for hardware independent part.

Definition at line 39 of file gpio_arch.h.

Function Documentation

◆ gpio_enable_clock()

void gpio_enable_clock ( uint32_t  port)

Enable the relevant clock.

This is an STM32 specific helper funtion and should only be used in stm32 arch code.

Definition at line 34 of file gpio_arch.c.

References GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, and GPIOH.

Referenced by softi2c_setup_gpio().

+ Here is the caller graph for this function:

◆ gpio_setup_input()

void gpio_setup_input ( uint32_t  port,
uint16_t  gpios 
)

Setup one or more pins of the given GPIO port as inputs.

Parameters
[in]port
[in]gpiosIf multiple pins are to be changed, use logical OR '|' to separate them.

Definition at line 33 of file gpio_arch.c.

References dir, GPIO_DIRECTION, GPIO_INPUT, gpiofp, and gpio_direction::pin.

◆ gpio_setup_input_pulldown()

void gpio_setup_input_pulldown ( uint32_t  port,
uint16_t  gpios 
)

Setup one or more pins of the given GPIO port as inputs with pull down resistors enabled.

Parameters
[in]port
[in]gpiosIf multiple pins are to be changed, use logical OR '|' to separate them.

◆ gpio_setup_input_pullup()

void gpio_setup_input_pullup ( uint32_t  port,
uint16_t  gpios 
)

Setup one or more pins of the given GPIO port as inputs with pull up resistor enabled.

Parameters
[in]port
[in]gpiosIf multiple pins are to be changed, use logical OR '|' to separate them.

◆ gpio_setup_output()

void gpio_setup_output ( uint32_t  port,
uint16_t  gpios 
)

Setup one or more pins of the given GPIO port as outputs.

Parameters
[in]port
[in]gpiosIf multiple pins are to be changed, use logical OR '|' to separate them.

Definition at line 31 of file gpio_arch.c.

◆ gpio_setup_pin_af()

void gpio_setup_pin_af ( uint32_t  port,
uint16_t  pin,
uint8_t  af,
bool  is_output 
)

Setup a gpio for input or output with alternate function.

This is an STM32 specific helper funtion and should only be used in stm32 arch code.

◆ gpio_setup_pin_analog()

void gpio_setup_pin_analog ( uint32_t  port,
uint16_t  pin 
)

Setup a gpio for analog use.

This is an STM32 specific helper funtion and should only be used in stm32 arch code.