Data Structures
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 ti_drivers_config.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)
    };
Note
GPIOCC32XX_GPIO_26 & GPIOCC32XX_GPIO_27 can only be used as output pins.
#include <stdint.h>
#include <ti/drivers/GPIO.h>
Include dependency graph for GPIOCC32XX.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   0x0001
 
#define GPIOCC32XX_GPIO_01   0x0002
 
#define GPIOCC32XX_GPIO_02   0x0004
 
#define GPIOCC32XX_GPIO_03   0x0008
 
#define GPIOCC32XX_GPIO_04   0x0010
 
#define GPIOCC32XX_GPIO_05   0x0020
 
#define GPIOCC32XX_GPIO_06   0x0040
 
#define GPIOCC32XX_GPIO_07   0x0080
 
#define GPIOCC32XX_GPIO_08   0x0101
 
#define GPIOCC32XX_GPIO_09   0x0102
 
#define GPIOCC32XX_GPIO_10   0x0104
 
#define GPIOCC32XX_GPIO_11   0x0108
 
#define GPIOCC32XX_GPIO_12   0x0110
 
#define GPIOCC32XX_GPIO_13   0x0120
 
#define GPIOCC32XX_GPIO_14   0x0140
 
#define GPIOCC32XX_GPIO_15   0x0180
 
#define GPIOCC32XX_GPIO_16   0x0201
 
#define GPIOCC32XX_GPIO_17   0x0202
 
#define GPIOCC32XX_GPIO_22   0x0240
 
#define GPIOCC32XX_GPIO_23   0x0280
 
#define GPIOCC32XX_GPIO_24   0x0301
 
#define GPIOCC32XX_GPIO_25   0x0302
 
#define GPIOCC32XX_GPIO_26   0x0304
 
#define GPIOCC32XX_GPIO_27   0x0308
 
#define GPIOCC32XX_GPIO_28   0x0310
 
#define GPIOCC32XX_GPIO_29   0x0320
 
#define GPIOCC32XX_GPIO_30   0x0340
 
#define GPIOCC32XX_GPIO_31   0x0380
 
#define GPIOCC32XX_GPIO_32   0x0401
 
CC32xx device specific GPIO_PinConfig macros
#define GPIOCC32XX_USE_STATIC
 
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale