TI-RTOS Drivers  tidrivers_full_2_20_00_08
Data Structures | Macros | Typedefs | Functions
GPIOCC26XX.h File Reference

Detailed Description

CC26XX GPIO driver.

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

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

Operation

The GPIO module allows you to manage General Purpose I/O pins via simple and portable APIs. The application is required to supply a GPIOCC26XX_Config structure to the module (see example below). This structure communicates to the GPIO module how to configure the pins used by the application (See the description of GPIO_PinConfig in the GPIO.h file).

The application is required to call GPIO_init(). This function will initialize all the GPIO pins defined in the GPIO_PinConfig table to the configurations specified. Once completed the other APIs can be used to access the pins.

Asserts are used to verify that the driver has been initialized, and is reading/writing a valid index.

The following is an example of the code required to use the 2 switches and 4 LEDs on the CC26XX Launchpad board.

Board header:

// Enum of GPIO names on the CC26XX_LP dev board
typedef enum CC26XX_LP_GPIOName {
// input pins with callbacks first
CC26XX_LP_SW2 = 0,
CC26XX_LP_SW3,
// output pins
CC26XX_LP_LED_D7,
CC26XX_LP_LED_D6,
CC26XX_LP_LED_D5,
CC26XX_LP_GPIOCOUNT
} CC26XX_LP_GPIOName;

Board initialization code:

// Array of Pin configurations
// NOTE: The order of the pin configurations must coincide with what was
// defined in CC26XX_LP.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.
const GPIO_PinConfig gpioPinConfigs[] = {
// input pins with callbacks
// CC26XX_LP_SW2
// CC26XX_LP_SW3
// output pins
// CC26XX_LP_LED_D7
// CC26XX_LP_LED_D6
// CC26XX_LP_LED_D5
};
// Array of callback function pointers
// NOTE: The order of the pin configurations must coincide with what was
// defined in CC26XX_LP.h
// NOTE: Pins not used for interrupts can be omitted from callbacks array to
reduce memory usage (if placed at end of gpioPinConfigs array).
const GPIO_callbackFxn gpioCallbackFunctions[] = {
// CC26XX_LP_SW2
NULL,
// CC26XX_LP_SW3
NULL
};
//
// The device-specific GPIO_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
};
// Initialize peripheral and pins
void CC26XX_initGPIO(void)
{
// set up initial GPIO pin configurations
}

Keep in mind that the callback functions will be called in the context of an interrupt service routine and should be designed accordingly. When an interrupt is triggered, the interrupt status of all (interrupt enabled) pins on a port will be read, cleared, and the respective callbacks will be executed. Callbacks will be called in order from least significant bit to most significant bit.

Instrumentation

The GPIO driver interface produces log statements if instrumentation is enabled.

Diagnostics Mask Log details
Diags_USER1 basic operations performed

#include <stdint.h>
#include <driverlib/ioc.h>
#include <ti/drivers/GPIO.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

#define GPIOCC26XX_EMPTY_PIN   0xffff
 Device specific port/pin definition macros. More...
 
#define GPIOCC26XX_DIO_00   IOID_0
 
#define GPIOCC26XX_DIO_01   IOID_1
 
#define GPIOCC26XX_DIO_02   IOID_2
 
#define GPIOCC26XX_DIO_03   IOID_3
 
#define GPIOCC26XX_DIO_04   IOID_4
 
#define GPIOCC26XX_DIO_05   IOID_5
 
#define GPIOCC26XX_DIO_06   IOID_6
 
#define GPIOCC26XX_DIO_07   IOID_7
 
#define GPIOCC26XX_DIO_08   IOID_8
 
#define GPIOCC26XX_DIO_09   IOID_9
 
#define GPIOCC26XX_DIO_10   IOID_10
 
#define GPIOCC26XX_DIO_11   IOID_11
 
#define GPIOCC26XX_DIO_12   IOID_12
 
#define GPIOCC26XX_DIO_13   IOID_13
 
#define GPIOCC26XX_DIO_14   IOID_14
 
#define GPIOCC26XX_DIO_15   IOID_15
 
#define GPIOCC26XX_DIO_16   IOID_16
 
#define GPIOCC26XX_DIO_17   IOID_17
 
#define GPIOCC26XX_DIO_18   IOID_18
 
#define GPIOCC26XX_DIO_19   IOID_19
 
#define GPIOCC26XX_DIO_20   IOID_20
 
#define GPIOCC26XX_DIO_21   IOID_21
 
#define GPIOCC26XX_DIO_22   IOID_22
 
#define GPIOCC26XX_DIO_23   IOID_23
 
#define GPIOCC26XX_DIO_24   IOID_24
 
#define GPIOCC26XX_DIO_25   IOID_25
 
#define GPIOCC26XX_DIO_26   IOID_26
 
#define GPIOCC26XX_DIO_27   IOID_27
 
#define GPIOCC26XX_DIO_28   IOID_28
 
#define GPIOCC26XX_DIO_29   IOID_29
 
#define GPIOCC26XX_DIO_30   IOID_30
 
#define GPIOCC26XX_DIO_31   IOID_31
 

Typedefs

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

Functions

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

Macro Definition Documentation

#define GPIOCC26XX_EMPTY_PIN   0xffff

Device specific port/pin definition macros.

Below are the port/pin definitions to be used within the board's pin configuration table.

#define GPIOCC26XX_DIO_00   IOID_0
#define GPIOCC26XX_DIO_01   IOID_1
#define GPIOCC26XX_DIO_02   IOID_2
#define GPIOCC26XX_DIO_03   IOID_3
#define GPIOCC26XX_DIO_04   IOID_4
#define GPIOCC26XX_DIO_05   IOID_5
#define GPIOCC26XX_DIO_06   IOID_6
#define GPIOCC26XX_DIO_07   IOID_7
#define GPIOCC26XX_DIO_08   IOID_8
#define GPIOCC26XX_DIO_09   IOID_9
#define GPIOCC26XX_DIO_10   IOID_10
#define GPIOCC26XX_DIO_11   IOID_11
#define GPIOCC26XX_DIO_12   IOID_12
#define GPIOCC26XX_DIO_13   IOID_13
#define GPIOCC26XX_DIO_14   IOID_14
#define GPIOCC26XX_DIO_15   IOID_15
#define GPIOCC26XX_DIO_16   IOID_16
#define GPIOCC26XX_DIO_17   IOID_17
#define GPIOCC26XX_DIO_18   IOID_18
#define GPIOCC26XX_DIO_19   IOID_19
#define GPIOCC26XX_DIO_20   IOID_20
#define GPIOCC26XX_DIO_21   IOID_21
#define GPIOCC26XX_DIO_22   IOID_22
#define GPIOCC26XX_DIO_23   IOID_23
#define GPIOCC26XX_DIO_24   IOID_24
#define GPIOCC26XX_DIO_25   IOID_25
#define GPIOCC26XX_DIO_26   IOID_26
#define GPIOCC26XX_DIO_27   IOID_27
#define GPIOCC26XX_DIO_28   IOID_28
#define GPIOCC26XX_DIO_29   IOID_29
#define GPIOCC26XX_DIO_30   IOID_30
#define GPIOCC26XX_DIO_31   IOID_31

Typedef Documentation

GPIO device specific driver configuration structure.

Function Documentation

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 2016, Texas Instruments Incorporated