The MCUXpresso SDK provides a peripheral driver for the General-Purpose Input/Output (GPIO) module of MCUXpresso SDK devices.
Typical use case
Output Operation
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/gpio
Input Operation
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/gpio
|
static void | GPIO_PinWrite (GPIO_Type *base, uint32_t pin, uint8_t output) |
| Sets the output level of the multiple GPIO pins to the 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_PortClear (GPIO_Type *base, uint32_t mask) |
| Sets the output level of the multiple GPIO pins to the logic 0. More...
|
|
static void | GPIO_PortToggle (GPIO_Type *base, uint32_t mask) |
| Reverses the current output logic of the multiple GPIO pins. More...
|
|
|
static uint32_t | GPIO_PinRead (GPIO_Type *base, uint32_t pin) |
| Reads the current input value of the GPIO port. More...
|
|
void GPIO_PinInit |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
const gpio_pin_config_t * |
config |
|
) |
| |
To initialize the GPIO, define a pin configuration, as either input or output, in the user file. Then, call the GPIO_PinInit() function.
This is an example to define an input pin or an output pin configuration.
* Define a digital input pin configuration,
* {
* 0,
* }
* Define a digital output pin configuration,
* {
* 0,
* }
*
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.) |
pin | GPIO port pin number |
config | GPIO pin configuration pointer |
static void GPIO_PinWrite |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin, |
|
|
uint8_t |
output |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.) |
pin | GPIO pin number |
output | GPIO pin output logic level.
- 0: corresponding pin output low-logic level.
- 1: corresponding pin output high-logic level.
|
static void GPIO_PortSet |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.) |
mask | GPIO pin number macro |
static void GPIO_PortClear |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.) |
mask | GPIO pin number macro |
static void GPIO_PortToggle |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.) |
mask | GPIO pin number macro |
static uint32_t GPIO_PinRead |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.) |
pin | GPIO pin number |
- Return values
-
GPIO | port input value
- 0: corresponding pin input low-logic level.
- 1: corresponding pin input high-logic level.
|
- Parameters
-
base | GPIO peripheral base pointer. |
pin | GPIO pin number. |
config | GPIO pin interrupt configuration.
|
uint32_t GPIO_GpioGetInterruptFlags |
( |
GPIO_Type * |
base | ) |
|
- Parameters
-
base | GPIO peripheral base pointer. (GPIOA, GPIOB, GPIOC, and so on.) |
- Returns
- The current GPIO's interrupt status flag. '1' means the related pin's flag is set, '0' means the related pin's flag not set. For example, the return value 0x00010001 means the pin 0 and 17 have the interrupt pending.
uint8_t GPIO_PinGetInterruptFlag |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
- Parameters
-
base | GPIO peripheral base pointer. (GPIOA, GPIOB, GPIOC, and so on) |
pin | GPIO specific pin number. |
- Returns
- The current selected pin's interrupt status flag.
void GPIO_GpioClearInterruptFlags |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on.) |
mask | GPIO pin number macro |
void GPIO_PinClearInterruptFlag |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
pin |
|
) |
| |
- Parameters
-
base | GPIO peripheral base pointer (GPIOA, GPIOB, GPIOC, and so on). |
pin | GPIO specific pin number. |
static uint32_t GPIO_GetPinsDMARequestFlags |
( |
GPIO_Type * |
base | ) |
|
|
inlinestatic |
The corresponding flag will be cleared automatically at the completion of the requested DMA transfer
static void GPIO_SetMultipleInterruptPinsConfig |
( |
GPIO_Type * |
base, |
|
|
uint32_t |
mask, |
|
|
gpio_interrupt_config_t |
config |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPIO peripheral base pointer. |
mask | GPIO pin number macro. |
config | GPIO pin interrupt configuration.
|