Data Structures | Typedefs
GPIOCC32XX.h File Reference

Detailed Description

GPIO driver implementation for CC32xx devices.

============================================================================

The GPIO header file should be included in an application as follows:

Refer to GPIO.h for a complete description of the GPIO driver APIs provided and examples of their use.

CC32xx GPIO Driver Configuration

In order to use the GPIO APIs, the application is required to provide 3 structures in the Board.c file:

  1. An array of GPIO_PinConfig elements that defines the initial configuration of each pin used by the application. A pin is referenced in the application by its corresponding index in this array. The pin type (that is, INPUT/OUTPUT), its initial state (that is OUTPUT_HIGH or LOW), interrupt behavior (RISING/FALLING edge, etc.) (see Macros used to configure GPIO pins), and device specific pin identification (see GPIO pin identification macros used to configure GPIO pins) are configured in each element of this array. Below is an CC32XX device specific example of the GPIO_PinConfig array:
    //
    // Array of Pin configurations
    // NOTE: The order of the pin configurations must coincide with what was
    // defined in CC3220SF_LAUNCHXL.h
    // NOTE: Pins not used for interrupts should be placed at the end of the
    // array. Callback entries can be omitted from callbacks array to
    // reduce memory usage.
    //
    GPIO_PinConfig gpioPinConfigs[] = {
    // input pins with callbacks
    // CC3220SF_LAUNCHXL_GPIO_SW2
    // CC3220SF_LAUNCHXL_GPIO_SW3
    // output pins
    // CC3220SF_LAUNCHXL_GPIO_LED_D7
    };
  2. An array of GPIO_CallbackFxn elements that is used to store callback function pointers for GPIO pins configured with interrupts. The indexes for these array elements correspond to the pins defined in the GPIO_PinConfig array. These function pointers can be defined statically by referencing the callback function name in the array element, or dynamically, by setting the array element to NULL and using GPIO_setCallback() at runtime to plug the callback entry. Pins not used for interrupts can be omitted from the callback array to reduce memory usage (if they are placed at the end of the GPIO_PinConfig array). The callback function syntax should match the following:
    void (*GPIO_CallbackFxn)(unsigned int index);
    The index parameter is the same index that was passed to GPIO_setCallback(). This allows the same callback function to be used for multiple GPIO interrupts, by using the index to identify the GPIO that caused the interrupt. Below is a CC32XX device specific example of the GPIO_CallbackFxn array:
    //
    // Array of callback function pointers
    // NOTE: The order of the pin configurations must coincide with what was
    // defined in CC3220SF_LAUNCHXL.h
    // NOTE: Pins not used for interrupts can be omitted from callbacks array to
    // reduce memory usage (if placed at end of gpioPinConfigs array).
    //
    GPIO_CallbackFxn gpioCallbackFunctions[] = {
    NULL, // CC3220SF_LAUNCHXL_GPIO_SW2
    NULL // CC3220SF_LAUNCHXL_GPIO_SW3
    };
  3. The device specific GPIOCC32XX_Config structure that tells the GPIO driver where the two aforementioned arrays are and the number of elements in each. The interrupt priority of all pins configured to generate interrupts is also specified here. Values for the interrupt priority are device-specific. You should be well-acquainted with the interrupt controller used in your device before setting this parameter to a non-default value. The sentinel value of (~0) (the default value) is used to indicate that the lowest possible priority should be used. Below is an example of an initialized GPIOCC32XX_Config structure:
    const GPIOCC32XX_Config GPIOCC32XX_config = {
    .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
    .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
    .numberOfPinConfigs = sizeof(gpioPinConfigs)/sizeof(GPIO_PinConfig),
    .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
    .intPriority = (~0)
    };

#include <stdint.h>
#include <ti/drivers/GPIO.h>

Go to the source code of this file.

Data Structures

struct  GPIOCC32XX_Config
 GPIO device specific driver configuration structure. More...
 

Macros

Device specific GPIO port/pin identifiers to be used within the board's GPIO_PinConfig table.
#define GPIOCC32XX_EMPTY_PIN
 
#define GPIOCC32XX_GPIO_00
 
#define GPIOCC32XX_GPIO_01
 
#define GPIOCC32XX_GPIO_02
 
#define GPIOCC32XX_GPIO_03
 
#define GPIOCC32XX_GPIO_04
 
#define GPIOCC32XX_GPIO_05
 
#define GPIOCC32XX_GPIO_06
 
#define GPIOCC32XX_GPIO_07
 
#define GPIOCC32XX_GPIO_08
 
#define GPIOCC32XX_GPIO_09
 
#define GPIOCC32XX_GPIO_10
 
#define GPIOCC32XX_GPIO_11
 
#define GPIOCC32XX_GPIO_12
 
#define GPIOCC32XX_GPIO_13
 
#define GPIOCC32XX_GPIO_14
 
#define GPIOCC32XX_GPIO_15
 
#define GPIOCC32XX_GPIO_16
 
#define GPIOCC32XX_GPIO_17
 
#define GPIOCC32XX_GPIO_18
 
#define GPIOCC32XX_GPIO_19
 
#define GPIOCC32XX_GPIO_20
 
#define GPIOCC32XX_GPIO_21
 
#define GPIOCC32XX_GPIO_22
 
#define GPIOCC32XX_GPIO_23
 
#define GPIOCC32XX_GPIO_24
 
#define GPIOCC32XX_GPIO_25
 
#define GPIOCC32XX_GPIO_26
 
#define GPIOCC32XX_GPIO_27
 
#define GPIOCC32XX_GPIO_28
 
#define GPIOCC32XX_GPIO_29
 
#define GPIOCC32XX_GPIO_30
 
#define GPIOCC32XX_GPIO_31
 
#define GPIOCC32XX_GPIO_32
 
CC32xx device specific GPIO_PinConfig macros
#define GPIOCC32XX_USE_STATIC
 

Typedefs

typedef struct GPIOCC32XX_Config GPIOCC32XX_Config
 GPIO device specific driver configuration structure. More...
 

Typedef Documentation

§ GPIOCC32XX_Config

GPIO device specific driver configuration structure.

The device specific GPIOCC32XX_Config structure that tells the GPIO driver where the two aforementioned arrays are and the number of elements in each. The interrupt priority of all pins configured to generate interrupts is also specified here. Values for the interrupt priority are device-specific. You should be well-acquainted with the interrupt controller used in your device before setting this parameter to a non-default value. The sentinel value of (~0) (the default value) is used to indicate that the lowest possible priority should be used.

Below is an example of an initialized GPIOCC32XX_Config structure:

const GPIOCC32XX_Config GPIOCC32XX_config = {
.pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
.callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
.numberOfPinConfigs = sizeof(gpioPinConfigs)/sizeof(GPIO_PinConfig),
.numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
.intPriority = (~0)
};
Copyright 2017, Texas Instruments Incorporated