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:
typedef enum CC3200_LP_GPIOName {
CC3200_LP_SW2 = 0,
CC3200_LP_SW3,
CC3200_LP_LED_D7,
CC3200_LP_LED_D6,
CC3200_LP_LED_D5,
CC3200_LP_GPIOCOUNT
} CC3200_LP_GPIOName;
Board initialization code:
array. Callback entries can be omitted from callbacks array to
reduce memory usage.
};
reduce memory usage (if placed at end of gpioPinConfigs array).
const GPIO_callbackFxn gpioCallbackFunctions[] = {
NULL,
NULL
};
.numberOfPinConfigs =
.numberOfCallbacks =
.intPriority = (~0)
};
void CC3200_initGPIO(void)
{
}
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 |