Data Structures | Functions
GPIOCC26XX.h File Reference

Detailed Description

GPIO driver implementation for CC26xx/CC13xx 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.

CC26XX 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 CC26XX 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 CC2650_LAUNCH.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
    // Output pins
    };
  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 an CC26XX 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 CC2650_LAUNCH.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, // Button 0
    NULL, // Button 1
    };
  3. The device specific GPIOCC26XX_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 GPIOCC26XX_Config structure:
    const GPIOCC26XX_Config GPIOCC26XX_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>
#include <ti/devices/DeviceFamily.h>
#include <DeviceFamily_constructPath(driverlib/ioc.h)>
Include dependency graph for GPIOCC26XX.h:

Go to the source code of this file.

Data Structures

struct  GPIOCC26XX_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 GPIOCC26XX_EMPTY_PIN
 
#define GPIOCC26XX_DIO_00
 
#define GPIOCC26XX_DIO_01
 
#define GPIOCC26XX_DIO_02
 
#define GPIOCC26XX_DIO_03
 
#define GPIOCC26XX_DIO_04
 
#define GPIOCC26XX_DIO_05
 
#define GPIOCC26XX_DIO_06
 
#define GPIOCC26XX_DIO_07
 
#define GPIOCC26XX_DIO_08
 
#define GPIOCC26XX_DIO_09
 
#define GPIOCC26XX_DIO_10
 
#define GPIOCC26XX_DIO_11
 
#define GPIOCC26XX_DIO_12
 
#define GPIOCC26XX_DIO_13
 
#define GPIOCC26XX_DIO_14
 
#define GPIOCC26XX_DIO_15
 
#define GPIOCC26XX_DIO_16
 
#define GPIOCC26XX_DIO_17
 
#define GPIOCC26XX_DIO_18
 
#define GPIOCC26XX_DIO_19
 
#define GPIOCC26XX_DIO_20
 
#define GPIOCC26XX_DIO_21
 
#define GPIOCC26XX_DIO_22
 
#define GPIOCC26XX_DIO_23
 
#define GPIOCC26XX_DIO_24
 
#define GPIOCC26XX_DIO_25
 
#define GPIOCC26XX_DIO_26
 
#define GPIOCC26XX_DIO_27
 
#define GPIOCC26XX_DIO_28
 
#define GPIOCC26XX_DIO_29
 
#define GPIOCC26XX_DIO_30
 
#define GPIOCC26XX_DIO_31
 

Functions

void GPIOCC26xx_release (int index)
 Un-oonfigure a GPIO pin. More...
 

Function Documentation

§ GPIOCC26xx_release()

void GPIOCC26xx_release ( int  index)

Un-oonfigure a GPIO pin.

Disables pin interrupt, clears callback, restores pin to default setting, removes pin from PIN object

Parameters
indexGPIO index
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale