Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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:
+ This graph shows which files directly or indirectly include this file:

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

Abstract gpio port type for hardware independent part.

Definition at line 39 of file gpio_arch.h.

Function Documentation

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 SpektrumUartInit().

+ Here is the caller graph for this function:

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 GPIO_DIRECTION, GPIO_INPUT, gpiofp, gpio_direction::mode, and gpio_direction::pin.

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.
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.
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.

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.

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.