General-Purpose I/O Interface Function Documentation

 

Sys_GPIO_NMIConfig

void Sys_GPIO_NMIConfig(uint32_t config, uint32_t source, uint32_t polarity)

 

Configure a source for NMI input selection.

 

Location: gpio.h:80

 

Parameters

Direction Name Description

in

config

GPIO pin configuration if NMI is pad

in

source

NMI source; use NMI_SRC_*

in

polarity

NMI polarity; use NMI_ACTIVE_[LOW | HIGH]

 

 

Example Code for Sys_GPIO_NMIConfig

    // Configure NMI input using GPIO 13 as active-low source without low-pass filter

    Sys_GPIO_NMIConfig(GPIO_LPF_ENABLE, NMI_SRC_GPIO_13, NMI_ACTIVE_LOW);

 

Sys_GPIO_IntConfig

void Sys_GPIO_IntConfig(uint32_t index, uint32_t config, uint32_t dbnc_clk, uint32_t dbnc_cnt)

 

Configure a GPIO interrupt source.

 

Location: gpio.h:105

 

Parameters

Direction Name Description

in

index

GPIO interrupt source to configure; use a constant

in

config

GPIO interrupt configuration; use GPIO__INT_DEBOUNCE_[DISABLE | ENABLE], GPIO_INT_SRC_*, and GPIO_INT_EVENT_[NONE | HIGH_LEVEL | LOW_LEVEL | RISING_EDGE | FALLING_EDGE | TRANSITION]

in

dbnc_clk

Interrupt button debounce filter clock; use GPIO_DEBOUNCE_SLOWCLK_DIV[32 | 1024]

in

dbnc_cnt

Interrupt button debounce filter count

 

 

Example Code for Sys_GPIO_IntConfig

    // configure GPIO interrupt channel 7 to use GPIO 11 as interrupt source, with

    // 1 debounce filter count.

    Sys_GPIO_IntConfig(7, (GPIO_INT_DEBOUNCE_ENABLE | GPIO_INT_SRC_GPIO_11),

                      GPIO_DEBOUNCE_SLOWCLK_DIV1024, 1);

 

Sys_GPIO_CM33JTAGConfig

void Sys_GPIO_CM33JTAGConfig(uint32_t config, uint8_t mode)

 

Configure Arm Cortex-M3 SWJ-DP.

 

Location: gpio.h:130

 

Parameters

Direction Name Description

in

config

JTAG pad configuration; use JTMS_[NO_PULL | WEAK_PULL_UP | WEAK_PULL_DOWN | STRONG_PULL_UP], JTMS_[2X | 3X | 5X | 6X]_DRIVE, JTCK_[NO_PULL | WEAK_PULL_UP | WEAK_PULL_DOWN | STRONG_PULL_UP], JTMS_LPF_[DISABLED | ENABLED], and JTCK_LPF_[DISABLED | ENABLED]

in

mode

Enable one of the two JTAG modes or SW mode; use 0 for SW mode, 1 for JTAG with reset enabled, and 2 for JTAG with reset disabled

 

 

Example Code for Sys_GPIO_CM33JTAGConfig

    // Enable Arm Cortex-M3 SWJ-DP port and JTAG

    Sys_GPIO_CM33JTAGConfig(true, true);

 

Sys_GPIO_Set_High

void Sys_GPIO_Set_High(uint32_t pad)

 

Set the specified GPIO output value to high.

 

Location: gpio.h:160

 

Parameters

Direction Name Description

in

pad

GPIO pad to set high

 

 

Example Code for Sys_GPIO_Set_High

    // Set GPIO2 high

    Sys_GPIO_Set_High(GPIO2);

 

Sys_GPIO_Set_Low

void Sys_GPIO_Set_Low(uint32_t pad)

 

Set the specified GPIO output value to low.

 

Location: gpio.h:171

 

Parameters

Direction Name Description

in

pad

GPIO pad to set low

 

 

Example Code for Sys_GPIO_Set_Low

    // Set GPIO2 low

    Sys_GPIO_Set_Low(GPIO2);

 

Sys_GPIO_Toggle

void Sys_GPIO_Toggle(uint32_t pad)

 

Toggle the current value of the specified GPIO output.

 

Location: gpio.h:182

 

Parameters

Direction Name Description

in

pad

GPIO pad to toggle

 

 

Example Code for Sys_GPIO_Toggle

    // Toggle the state of the GPIO2 pin

    Sys_GPIO_Toggle(GPIO2);

 

Sys_GPIO_Read

uint32_t Sys_GPIO_Read(uint32_t pad)

 

Read the specified GPIO value.

 

Location: gpio.h:194

 

Parameters

Direction Name Description

in

pad

GPIO pad to set low

 


Return


uint32_t pin value; 0 or 1

 

 

Example Code for Sys_GPIO_Read

    // Read the current value of the GPIO2 pin

    Sys_GPIO_Read(GPIO2);

 

Sys_GPIO_Write

void Sys_GPIO_Write(uint32_t pad, bool value)

 

Write the specified GPIO value.

 

Location: gpio.h:206

 

Parameters

Direction Name Description

in

pad

GPIO pad to write value

in

value

1 or 0 written to GPIO

 

 

Example Code for Sys_GPIO_Write

    // Write a 1 to GPIO2

    Sys_GPIO_Write(GPIO2, 1);

 

Sys_GPIO_Set_SingleDirection

void Sys_GPIO_Set_SingleDirection(uint32_t pad, uint32_t dir)

 

Set the input/output direction for a particular GPIO.

 

Location: gpio.h:221

 

Parameters

Direction Name Description

in

pad

GPIO pad to write value

in

dir

Input/output configuration settings for any GPIOs from 0 to 15 that are configured as GPIO pads; use GPIO*_DIR_IN, and GPIO*_DIR_OUT

 

 

Example Code for Sys_GPIO_Set_SingleDirection

    // Set the direction of the GPIO2 pin

    Sys_GPIO_Set_SingleDirection(GPIO2, GPIO2_DIR_OUT);

 

Sys_GPIO_Set_Direction

void Sys_GPIO_Set_Direction(uint32_t dir)

 

Set the input/output direction for any GPIOs configured as GPIOs.

 

Location: gpio.h:244

 

Parameters

Direction Name Description

in

dir

Input/output configuration settings for any GPIOs from 0 to 15 that are configured as GPIO pads; use GPIO*_DIR_IN, and GPIO*_DIR_OUT

 

 

Example Code for Sys_GPIO_Set_Direction

    // Set GPIO2 as an output

    Sys_GPIO_Set_Direction(GPIO2_DIR_OUT);