The MCUXpresso SDK provides a peripheral driver for the General-Purpose Input/Output (GPIO) module of MCUXpresso SDK devices.
Typical use case
Input Operation
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/gpio
|
void | GPIO_PinWrite (GPIO_Type *base, uint32_t pin, uint8_t output) |
| Sets the output level of the individual GPIO pin to logic 1 or 0. More...
|
|
static void | GPIO_WritePinOutput (GPIO_Type *base, uint32_t pin, uint8_t output) |
| Sets the output level of the individual GPIO pin to logic 1 or 0. More...
|
|
static void | GPIO_PortSet (GPIO_Type *base, uint32_t mask) |
| Sets the output level of the multiple GPIO pins to the logic 1. More...
|
|
static void | GPIO_SetPinsOutput (GPIO_Type *base, uint32_t mask) |
| Sets the output level of the multiple GPIO pins to the logic 1. More...
|
|
static void | GPIO_PortClear (GPIO_Type *base, uint32_t mask) |
| Sets the output level of the multiple GPIO pins to the logic 0. More...
|
|
static void | GPIO_ClearPinsOutput (GPIO_Type *base, uint32_t mask) |
| Sets the output level of the multiple GPIO pins to the logic 0. More...
|
|
static uint32_t | GPIO_PinRead (GPIO_Type *base, uint32_t pin) |
| Reads the current input value of the GPIO port. More...
|
|
static uint32_t | GPIO_ReadPinInput (GPIO_Type *base, uint32_t pin) |
| Reads the current input value of the GPIO port. More...
|
|
|
void | GPIO_PinSetInterruptConfig (GPIO_Type *base, uint32_t pin, gpio_interrupt_mode_t pinInterruptMode) |
| Sets the current pin interrupt mode. More...
|
|
static void | GPIO_SetPinInterruptConfig (GPIO_Type *base, uint32_t pin, gpio_interrupt_mode_t pinInterruptMode) |
| Sets the current pin interrupt mode. More...
|
|
static void | GPIO_PortEnableInterrupts (GPIO_Type *base, uint32_t mask) |
| Enables the specific pin interrupt. More...
|
|
static void | GPIO_EnableInterrupts (GPIO_Type *base, uint32_t mask) |
| Enables the specific pin interrupt. More...
|
|
static void | GPIO_PortDisableInterrupts (GPIO_Type *base, uint32_t mask) |
| Disables the specific pin interrupt. More...
|
|
static void | GPIO_DisableInterrupts (GPIO_Type *base, uint32_t mask) |
| Disables the specific pin interrupt. More...
|
|
static uint32_t | GPIO_PortGetInterruptFlags (GPIO_Type *base) |
| Reads individual pin interrupt status. More...
|
|
static uint32_t | GPIO_GetPinsInterruptFlags (GPIO_Type *base) |
| Reads individual pin interrupt status. More...
|
|
static void | GPIO_PortClearInterruptFlags (GPIO_Type *base, uint32_t mask) |
| Clears pin interrupt flag. More...
|
|
static void | GPIO_ClearPinsInterruptFlags (GPIO_Type *base, uint32_t mask) |
| Clears pin interrupt flag. More...
|
|
#define FSL_GPIO_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
Enumerator |
---|
kGPIO_DigitalInput |
Set current pin as digital input.
|
kGPIO_DigitalOutput |
Set current pin as digital output.
|
Enumerator |
---|
kGPIO_NoIntmode |
Set current pin general IO functionality.
|
kGPIO_IntLowLevel |
Set current pin interrupt is low-level sensitive.
|
kGPIO_IntHighLevel |
Set current pin interrupt is high-level sensitive.
|
kGPIO_IntRisingEdge |
Set current pin interrupt is rising-edge sensitive.
|
kGPIO_IntFallingEdge |
Set current pin interrupt is falling-edge sensitive.
|
kGPIO_IntRisingOrFallingEdge |
Enable the edge select bit to override the ICR register's configuration.
|
void GPIO_PinInit |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
const gpio_pin_config_t * |
Config |
|
) |
| |
- Parameters
-
base | GPIO base pointer. |
pin | Specifies the pin number |
initConfig | pointer to a gpio_pin_config_t structure that contains the configuration information. |
void GPIO_PinWrite |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
uint8_t |
output |
|
) |
| |
- Parameters
-
base | GPIO base pointer. |
pin | GPIO port pin number. |
output | GPIOpin output logic level.
- 0: corresponding pin output low-logic level.
- 1: corresponding pin output high-logic level.
|
static void GPIO_WritePinOutput |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
uint8_t |
output |
|
) |
| |
|
inlinestatic |
static void GPIO_PortSet |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer (GPIO1, GPIO2, GPIO3, and so on.) |
mask | GPIO pin number macro |
static void GPIO_SetPinsOutput |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
static void GPIO_PortClear |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer (GPIO1, GPIO2, GPIO3, and so on.) |
mask | GPIO pin number macro |
static void GPIO_ClearPinsOutput |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
static uint32_t GPIO_PinRead |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO base pointer. |
pin | GPIO port pin number. |
- Return values
-
static uint32_t GPIO_ReadPinInput |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
|
inlinestatic |
static uint8_t GPIO_PinReadPadStatus |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO base pointer. |
pin | GPIO port pin number. |
- Return values
-
GPIO | pin pad status value. |
static uint8_t GPIO_ReadPadStatus |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
|
inlinestatic |
void GPIO_PinSetInterruptConfig |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
gpio_interrupt_mode_t |
pinInterruptMode |
|
) |
| |
- Parameters
-
base | GPIO base pointer. |
pin | GPIO port pin number. |
pininterruptMode | pointer to a gpio_interrupt_mode_t structure that contains the interrupt mode information. |
static void GPIO_SetPinInterruptConfig |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
gpio_interrupt_mode_t |
pinInterruptMode |
|
) |
| |
|
inlinestatic |
static void GPIO_PortEnableInterrupts |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO base pointer. |
mask | GPIO pin number macro. |
static void GPIO_EnableInterrupts |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO base pointer. |
mask | GPIO pin number macro. |
static void GPIO_PortDisableInterrupts |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO base pointer. |
mask | GPIO pin number macro. |
static void GPIO_DisableInterrupts |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
static uint32_t GPIO_PortGetInterruptFlags |
( |
GPIO_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
- Return values
-
current | pin interrupt status flag. |
static uint32_t GPIO_GetPinsInterruptFlags |
( |
GPIO_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
- Return values
-
current | pin interrupt status flag. |
static void GPIO_PortClearInterruptFlags |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
Status flags are cleared by writing a 1 to the corresponding bit position.
- Parameters
-
base | GPIO base pointer. |
mask | GPIO pin number macro. |
static void GPIO_ClearPinsInterruptFlags |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
Status flags are cleared by writing a 1 to the corresponding bit position.
- Parameters
-
base | GPIO base pointer. |
mask | GPIO pin number macro. |