libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
GPIO Peripheral API

GPIO Application Programming Interface. More...

Collaboration diagram for GPIO Peripheral API:

Functions

void gpio_mode_setup (uint32_t gpioport, gpio_mode_t mode, ccs_pull_updown_t pull_up_down, uint16_t gpios)
 Set the IO mode and pull-up/down configuration for the pins. More...
 
void gpio_set_outmask (uint32_t gpioport, bool enable, uint16_t gpios)
 Set the output mask (disable changes) to the output pins specified. More...
 
void gpio_set (uint32_t gpioport, uint16_t gpios)
 Set the port pins specified to the true state. More...
 
void gpio_clear (uint32_t gpioport, uint16_t gpios)
 Clear the port pins specified to the false state. More...
 
uint16_t gpio_get (uint32_t gpioport, uint16_t gpios)
 Return a masked bitfield of the port specified. More...
 
void gpio_set_af (uint32_t gpioport, ccs_muxsel_func_t muxsel, uint16_t gpios)
 Set the function of the pin for this port. More...
 
void gpio_set_output_options (uint32_t gpioport, ccs_drive_strength_t strength, uint16_t gpios)
 Set special output options for the gpio pin. More...
 
void gpio_set_schmidt_trigger (uint32_t gpioport, bool enable, uint16_t gpios)
 Set input schmidt trigger for glitch rejection on the input pin. More...
 

Detailed Description

GPIO Application Programming Interface.

Function Documentation

◆ gpio_clear()

void gpio_clear ( uint32_t  gpioport,
uint16_t  gpios 
)

Clear the port pins specified to the false state.

Parameters
[in]gpioportPort to clear bits on.
[in]gpiosbitfield of pins to clear.

Definition at line 97 of file gpio.c.

References GPIO_DOCLEARR.

◆ gpio_get()

uint16_t gpio_get ( uint32_t  gpioport,
uint16_t  gpios 
)

Return a masked bitfield of the port specified.

Parameters
[in]gpioportPort to read the bits from.
[in]gpiosbitfield mask to apply to the port read.
Returns
masked bitfield of the port.

Definition at line 101 of file gpio.c.

References GPIO_INR.

◆ gpio_mode_setup()

void gpio_mode_setup ( uint32_t  gpioport,
gpio_mode_t  mode,
ccs_pull_updown_t  pull_up_down,
uint16_t  gpios 
)

Set the IO mode and pull-up/down configuration for the pins.

Parameters
[in]gpioportPort to configure the alternate function on.
[in]modeIO Mode to configure (analog, input, output).
[in]pull_up_downPull configuration (up/down/none) to set for the pins..
[in]gpiosPins to set with the mode and pull config specified.

Definition at line 50 of file gpio.c.

References CCS_IO_PULL_DOWN, CCS_IO_PULL_UP, CCS_PDENR, CCS_PUENR, get_ccs_port_base(), GPIO_MODER, and GPIO_MODER_MODE.

Here is the call graph for this function:

◆ gpio_set()

void gpio_set ( uint32_t  gpioport,
uint16_t  gpios 
)

Set the port pins specified to the true state.

Parameters
[in]gpioportPort to set bits on.
[in]gpiosbitfield of pins to set.

Definition at line 93 of file gpio.c.

References GPIO_DOSETR.

◆ gpio_set_af()

void gpio_set_af ( uint32_t  gpioport,
ccs_muxsel_func_t  muxsel,
uint16_t  gpios 
)

Set the function of the pin for this port.

This will modify the pinmux,

Parameters
[in]gpioportPort to configure the alternate function on.
[in]muxselMux select mode to configure on the port and pins.
[in]gpiosPins to set with the function specified.

Definition at line 105 of file gpio.c.

References CCS_MUXSELR, CCS_MUXSELR_VAL, and get_ccs_port_base().

Here is the call graph for this function:

◆ gpio_set_outmask()

void gpio_set_outmask ( uint32_t  gpioport,
bool  enable,
uint16_t  gpios 
)

Set the output mask (disable changes) to the output pins specified.

Parameters
[in]gpioportPort to set output mask on.
[in]enableWhether to enable or disable output masking.
[in]gpiosbitfield of pins to set.

Definition at line 83 of file gpio.c.

References GPIO_OUTMASKR.

◆ gpio_set_output_options()

void gpio_set_output_options ( uint32_t  gpioport,
ccs_drive_strength_t  strength,
uint16_t  gpios 
)

Set special output options for the gpio pin.

For this MCU, this is only the drive strength.

Parameters
[in]gpioportPort to configure the alternate function on.
[in]strengthDrive strength (DS_XXMA from ccs.h).
[in]gpiosPins to set with the drive strength specified.

Definition at line 124 of file gpio.c.

References CCS_DSR, CCS_DSR_DS_VAL, and get_ccs_port_base().

Here is the call graph for this function:

◆ gpio_set_schmidt_trigger()

void gpio_set_schmidt_trigger ( uint32_t  gpioport,
bool  enable,
uint16_t  gpios 
)

Set input schmidt trigger for glitch rejection on the input pin.

Parameters
[in]gpioportPort to configure the alternate function on.
[in]enableTrue to enable, false to disable the schmidt trigger.
[in]gpiosPins to set with the schmidt trigger setting specified.

Definition at line 144 of file gpio.c.

References CCS_DSR, CCS_DSR_SCHMIDT_PIN, and get_ccs_port_base().

Here is the call graph for this function: