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

Detailed Description

CC3200 GPIO driver.

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

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

Refer to GPIO.h for a complete description of APIs.

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 GPIOCC3200_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 CC3200 Launchpad board.

Board header:

// Enum of GPIO names on the CC3200_LP dev board
typedef enum CC3200_LP_GPIOName {
// input pins with callbacks first
CC3200_LP_SW2 = 0,
CC3200_LP_SW3,
// output pins
CC3200_LP_LED_D7,
CC3200_LP_LED_D6,
CC3200_LP_LED_D5,
CC3200_LP_GPIOCOUNT
} CC3200_LP_GPIOName;

Board initialization code:

// Array of Pin configurations
// NOTE: The order of the pin configurations must coincide with what was
// defined in CC3200_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
// CC3200_LP_SW2
// CC3200_LP_SW3
// output pins
// CC3200_LP_LED_D7
// CC3200_LP_LED_D6
// CC3200_LP_LED_D5
};
// Array of callback function pointers
// NOTE: The order of the pin configurations must coincide with what was
// defined in CC3200_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[] = {
// CC3200_LP_SW2
NULL,
// CC3200_LP_SW3
NULL
};
//
// The device-specific GPIO_config structure
//
const GPIOCC3200_Config GPIOCC3200_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 CC3200_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 <ti/drivers/GPIO.h>
Include dependency graph for GPIOCC3200.h:

Go to the source code of this file.

Data Structures

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

Macros

#define GPIOCC3200_EMPTY_PIN   0x0000
 Device specific port/pin definition macros. More...
 
#define GPIOCC3200_GPIO_00   0x0001
 
#define GPIOCC3200_GPIO_01   0x0002
 
#define GPIOCC3200_GPIO_02   0x0004
 
#define GPIOCC3200_GPIO_03   0x0008
 
#define GPIOCC3200_GPIO_04   0x0010
 
#define GPIOCC3200_GPIO_05   0x0020
 
#define GPIOCC3200_GPIO_06   0x0040
 
#define GPIOCC3200_GPIO_07   0x0080
 
#define GPIOCC3200_GPIO_08   0x0101
 
#define GPIOCC3200_GPIO_09   0x0102
 
#define GPIOCC3200_GPIO_10   0x0104
 
#define GPIOCC3200_GPIO_11   0x0108
 
#define GPIOCC3200_GPIO_12   0x0110
 
#define GPIOCC3200_GPIO_13   0x0120
 
#define GPIOCC3200_GPIO_14   0x0140
 
#define GPIOCC3200_GPIO_15   0x0180
 
#define GPIOCC3200_GPIO_16   0x0201
 
#define GPIOCC3200_GPIO_17   0x0202
 
#define GPIOCC3200_GPIO_18   0x0204
 
#define GPIOCC3200_GPIO_19   0x0208
 
#define GPIOCC3200_GPIO_20   0x0210
 
#define GPIOCC3200_GPIO_21   0x0220
 
#define GPIOCC3200_GPIO_22   0x0240
 
#define GPIOCC3200_GPIO_23   0x0280
 
#define GPIOCC3200_GPIO_24   0x0301
 
#define GPIOCC3200_GPIO_25   0x0302
 
#define GPIOCC3200_GPIO_26   0x0304
 
#define GPIOCC3200_GPIO_27   0x0308
 
#define GPIOCC3200_GPIO_28   0x0310
 
#define GPIOCC3200_GPIO_29   0x0320
 
#define GPIOCC3200_GPIO_30   0x0340
 
#define GPIOCC3200_GPIO_31   0x0380
 
#define GPIOCC3200_USE_STATIC   0x8000 /* use statically-defined parking state */
 

Typedefs

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

Macro Definition Documentation

#define GPIOCC3200_EMPTY_PIN   0x0000

Device specific port/pin definition macros.

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

#define GPIOCC3200_GPIO_00   0x0001
#define GPIOCC3200_GPIO_01   0x0002
#define GPIOCC3200_GPIO_02   0x0004
#define GPIOCC3200_GPIO_03   0x0008
#define GPIOCC3200_GPIO_04   0x0010
#define GPIOCC3200_GPIO_05   0x0020
#define GPIOCC3200_GPIO_06   0x0040
#define GPIOCC3200_GPIO_07   0x0080
#define GPIOCC3200_GPIO_08   0x0101
#define GPIOCC3200_GPIO_09   0x0102
#define GPIOCC3200_GPIO_10   0x0104
#define GPIOCC3200_GPIO_11   0x0108
#define GPIOCC3200_GPIO_12   0x0110
#define GPIOCC3200_GPIO_13   0x0120
#define GPIOCC3200_GPIO_14   0x0140
#define GPIOCC3200_GPIO_15   0x0180
#define GPIOCC3200_GPIO_16   0x0201
#define GPIOCC3200_GPIO_17   0x0202
#define GPIOCC3200_GPIO_18   0x0204
#define GPIOCC3200_GPIO_19   0x0208
#define GPIOCC3200_GPIO_20   0x0210
#define GPIOCC3200_GPIO_21   0x0220
#define GPIOCC3200_GPIO_22   0x0240
#define GPIOCC3200_GPIO_23   0x0280
#define GPIOCC3200_GPIO_24   0x0301
#define GPIOCC3200_GPIO_25   0x0302
#define GPIOCC3200_GPIO_26   0x0304
#define GPIOCC3200_GPIO_27   0x0308
#define GPIOCC3200_GPIO_28   0x0310
#define GPIOCC3200_GPIO_29   0x0320
#define GPIOCC3200_GPIO_30   0x0340
#define GPIOCC3200_GPIO_31   0x0380
#define GPIOCC3200_USE_STATIC   0x8000 /* use statically-defined parking state */

Typedef Documentation

GPIO device specific driver configuration structure.

Copyright 2016, Texas Instruments Incorporated