BSPACM  20150113
Board Support Package for ARM Cortex-M Microcontrollers
Data Structures | Typedefs | Functions
gpio.h File Reference

Support for peripheral pin multiplexing configuration. More...

#include <bspacm/core.h>

Go to the source code of this file.

Data Structures

struct  sBSPACMdeviceEFM32pinmux
 

Typedefs

typedef struct sBSPACMdeviceEFM32pinmux sBSPACMdeviceEFM32pinmux
 

Functions

void vBSPACMdeviceEFM32pinmuxConfigure (const sBSPACMdeviceEFM32pinmux *cfgp, int enablep, int initial_high)
 

Detailed Description

Support for peripheral pin multiplexing configuration.

EFM32 peripherals are mapped to specific GPIO pins; the specific peripheral function supported by a GPIO pin is determined by the value written to the corresponding ROUTE register within the peripheral device register block.

The mapping between pin and peripheral function is constrained by the specific device. In some cases the same function can be mapped to multiple pins; in that situation, the desired mapping may be specific to the board or even to the application.

This file declares arrays that provide pin mapping definitions for all peripherals that are used by the application. These mappings are used by the generic EFM32 peripheral configuration routines. The application, board, or device should provide definitions for the structure corresponding to each required peripheral in a source file named periph_config.c with an absolute path set in the make variable PERIPH_CONFIG_SRC. By default the board-specific periph_config.c is used.

Homepage
http://github.com/pabigot/bspacm

Typedef Documentation

Core structure associating a GPIO port, pin, and port control function.

Note
An all-zero pinmux denotes an unconfigured GPIO due to #port being null.

Example to configure PD0 as output (push/pull):

.tx_pinmux = {
.port = GPIO->P + gpioPortD,
.pin = 0,
.mode = gpioModePushPull,
},

Function Documentation

void vBSPACMdeviceEFM32pinmuxConfigure ( const sBSPACMdeviceEFM32pinmux cfgp,
int  enablep,
int  initial_high 
)

Function to configure a GPIO according to *cfgp and provide an initial value.

Parameters
cfgppointer to the configuration structure. If cfgp->port is null, no configuration will be performed.
enablepnonzero if the pin is to be configured based on cfgp->mode; zero if the pin is to be disabled.
initial_highzero to clear the pin, positive to set the pin, negative to leave the pin setting unchanged.
Note
This differs from EMLIB's GPIO_PinModeSet() by allowing representation of a pin that should not be configured, and separating the configuration data from the initial value (which may depend on how the peripheral intends to use the pin).