GPIO driver implementation for MSP432 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.
MSP432 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:
- 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 MSP432 device specific example of the GPIO_PinConfig array:
- 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: 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 MSP432 device specific example of the GPIO_CallbackFxn array:
- The device specific GPIOMSP432_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 GPIOMSP432_Config structure:
Drive Strength Limitation
Only pins 2.0 thru 2.3 support high output drive strength. All other pins only support low drive strength. For pins that do not support high output drive strength, the GPIO_CFG_OUT_STR_XXX setting is ignored.