Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
The GPIO driver uses the virtual GPIO name rather than an actual port and a pin number. More...
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include "fsl_port_hal.h"
#include "fsl_gpio_hal.h"
Data Structures | |
struct | gpio_input_pin_t |
The GPIO input pin configuration structure. More... | |
struct | gpio_output_pin_t |
The GPIO output pin configuration structure. More... | |
struct | gpio_input_pin_user_config_t |
The GPIO input pin structure. More... | |
struct | gpio_output_pin_user_config_t |
The GPIO output pin structure. More... | |
Macros | |
GPIO Pin Macros | |
#define | GPIO_PINS_OUT_OF_RANGE (0xFFFFFFFFU) |
Indicates the end of a pin configuration structure. More... | |
#define | GPIO_PORT_SHIFT (0x8U) |
Bits shifted for the GPIO port number. More... | |
#define | GPIO_MAKE_PIN(r, p) (((r)<< GPIO_PORT_SHIFT) | (p)) |
Combines the port number and the pin number into a single scalar value. More... | |
#define | GPIO_EXTRACT_PORT(v) (((v) >> GPIO_PORT_SHIFT) & 0xFFU) |
Extracts the port number from a combined port and pin value. More... | |
#define | GPIO_EXTRACT_PIN(v) ((v) & 0xFFU) |
Extracts the pin number from a combined port and pin value. More... | |
Functions | |
Initialization | |
void | GPIO_DRV_Init (const gpio_input_pin_user_config_t *inputPins, const gpio_output_pin_user_config_t *outputPins) |
Initializes all GPIO pins used by the board. More... | |
void | GPIO_DRV_InputPinInit (const gpio_input_pin_user_config_t *inputPin) |
Initializes one GPIO input pin used by the board. More... | |
void | GPIO_DRV_OutputPinInit (const gpio_output_pin_user_config_t *outputPin) |
Initializes one GPIO output pin used by the board. More... | |
Pin Direction | |
gpio_pin_direction_t | GPIO_DRV_GetPinDir (uint32_t pinName) |
Gets the current direction of the individual GPIO pin. More... | |
void | GPIO_DRV_SetPinDir (uint32_t pinName, gpio_pin_direction_t direction) |
Sets the current direction of the individual GPIO pin. More... | |
Output Operations | |
void | GPIO_DRV_WritePinOutput (uint32_t pinName, uint32_t output) |
Sets the output level of the individual GPIO pin to the logic 1 or 0. More... | |
void | GPIO_DRV_SetPinOutput (uint32_t pinName) |
Sets the output level of the individual GPIO pin to the logic 1. More... | |
void | GPIO_DRV_ClearPinOutput (uint32_t pinName) |
Sets the output level of the individual GPIO pin to the logic 0. More... | |
void | GPIO_DRV_TogglePinOutput (uint32_t pinName) |
Reverses current output logic of the individual GPIO pin. More... | |
Input Operations | |
uint32_t | GPIO_DRV_ReadPinInput (uint32_t pinName) |
Reads the current input value of the individual GPIO pin. More... | |
Interrupt | |
bool | GPIO_DRV_IsPinIntPending (uint32_t pinName) |
Reads the individual pin-interrupt status flag. More... | |
void | GPIO_DRV_ClearPinIntFlag (uint32_t pinName) |
Clears the individual GPIO pin interrupt status flag. More... | |
Variables | |
GPIO_Type *const | g_gpioBase [GPIO_INSTANCE_COUNT] |
Table of base addresses for GPIO instances. More... | |
PORT_Type *const | g_portBase [PORT_INSTANCE_COUNT] |
Table of base addresses for PORT instances. More... | |
const IRQn_Type | g_portIrqId [PORT_INSTANCE_COUNT] |
By using the virtual name, each pin name is self-explanatory. To use the GPIO driver, an enumeration variable must be predefined in the user application files. The variable saves all GPIO pin information used in a project.
This example shows how to define the enumeration variable.
The port features such as "digital filter", "pull", are valid when they are available in one of the pins. That doesn't mean, however, that all pins have the capability to use such features. See the related reference manual for accurate pin features.