![]() |
![]() |
TI-RTOS Drivers
tidrivers_full_2_20_01_10
|
MSP430 GPIO driver.
============================================================================
The GPIO header file should be included in an application as follows:
Refer to GPIO.h for a complete description of APIs.
The GPIO module allows you to manage General Purpose I/O pins via simple and portable APIs. The application is required to supply a GPIOMSP430_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 2 switches and 2 LEDs on an MSP_EXP430F5529 Launchpad board.
Board header file:
Board initialization code:
MSP430 devices require GPIO interrupts to be statically created in the application specific configuration. The interrupt service routine for the Hwi must be set to "GPIO_hwiIntFxn". Additionally, the GPIO port number must be provided as a Hwi parameter. 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. Keep in mind that the callback functions will be called in the context of an interrupt service routine and should be designed accordingly. The following is an example for creating a Hwi for Port 2.
Application configuration file:
Callback functions can be assigned to interrupt enabled input pins on Port 2.
The GPIO driver interface produces log statements if instrumentation is enabled.
Diagnostics Mask | Log details |
---|---|
Diags_USER1 | basic operations performed |
Go to the source code of this file.
Data Structures | |
struct | GPIOMSP430_Config |
GPIO device specific driver configuration structure. More... | |
Macros | |
#define | GPIOMSP430_EMPTY_PIN 0x0000 |
Device specific port/pin definition macros. More... | |
#define | GPIOMSP430_P1_0 0x0101 |
#define | GPIOMSP430_P1_1 0x0102 |
#define | GPIOMSP430_P1_2 0x0104 |
#define | GPIOMSP430_P1_3 0x0108 |
#define | GPIOMSP430_P1_4 0x0110 |
#define | GPIOMSP430_P1_5 0x0120 |
#define | GPIOMSP430_P1_6 0x0140 |
#define | GPIOMSP430_P1_7 0x0180 |
#define | GPIOMSP430_P2_0 0x0201 |
#define | GPIOMSP430_P2_1 0x0202 |
#define | GPIOMSP430_P2_2 0x0204 |
#define | GPIOMSP430_P2_3 0x0208 |
#define | GPIOMSP430_P2_4 0x0210 |
#define | GPIOMSP430_P2_5 0x0220 |
#define | GPIOMSP430_P2_6 0x0240 |
#define | GPIOMSP430_P2_7 0x0280 |
#define | GPIOMSP430_P3_0 0x0301 |
#define | GPIOMSP430_P3_1 0x0302 |
#define | GPIOMSP430_P3_2 0x0304 |
#define | GPIOMSP430_P3_3 0x0308 |
#define | GPIOMSP430_P3_4 0x0310 |
#define | GPIOMSP430_P3_5 0x0320 |
#define | GPIOMSP430_P3_6 0x0340 |
#define | GPIOMSP430_P3_7 0x0380 |
#define | GPIOMSP430_P4_0 0x0401 |
#define | GPIOMSP430_P4_1 0x0402 |
#define | GPIOMSP430_P4_2 0x0404 |
#define | GPIOMSP430_P4_3 0x0408 |
#define | GPIOMSP430_P4_4 0x0410 |
#define | GPIOMSP430_P4_5 0x0420 |
#define | GPIOMSP430_P4_6 0x0440 |
#define | GPIOMSP430_P4_7 0x0480 |
#define | GPIOMSP430_P5_0 0x0501 |
#define | GPIOMSP430_P5_1 0x0502 |
#define | GPIOMSP430_P5_2 0x0504 |
#define | GPIOMSP430_P5_3 0x0508 |
#define | GPIOMSP430_P5_4 0x0510 |
#define | GPIOMSP430_P5_5 0x0520 |
#define | GPIOMSP430_P5_6 0x0540 |
#define | GPIOMSP430_P5_7 0x0580 |
#define | GPIOMSP430_P6_0 0x0601 |
#define | GPIOMSP430_P6_1 0x0602 |
#define | GPIOMSP430_P6_2 0x0604 |
#define | GPIOMSP430_P6_3 0x0608 |
#define | GPIOMSP430_P6_4 0x0610 |
#define | GPIOMSP430_P6_5 0x0620 |
#define | GPIOMSP430_P6_6 0x0640 |
#define | GPIOMSP430_P6_7 0x0680 |
#define | GPIOMSP430_P7_0 0x0701 |
#define | GPIOMSP430_P7_1 0x0702 |
#define | GPIOMSP430_P7_2 0x0704 |
#define | GPIOMSP430_P7_3 0x0708 |
#define | GPIOMSP430_P7_4 0x0710 |
#define | GPIOMSP430_P7_5 0x0720 |
#define | GPIOMSP430_P7_6 0x0740 |
#define | GPIOMSP430_P7_7 0x0780 |
#define | GPIOMSP430_P8_0 0x0801 |
#define | GPIOMSP430_P8_1 0x0802 |
#define | GPIOMSP430_P8_2 0x0804 |
#define | GPIOMSP430_P8_3 0x0808 |
#define | GPIOMSP430_P8_4 0x0810 |
#define | GPIOMSP430_P8_5 0x0820 |
#define | GPIOMSP430_P8_6 0x0840 |
#define | GPIOMSP430_P8_7 0x0880 |
#define | GPIOMSP430_P9_0 0x0901 |
#define | GPIOMSP430_P9_1 0x0902 |
#define | GPIOMSP430_P9_2 0x0904 |
#define | GPIOMSP430_P9_3 0x0908 |
#define | GPIOMSP430_P9_4 0x0910 |
#define | GPIOMSP430_P9_5 0x0920 |
#define | GPIOMSP430_P9_6 0x0940 |
#define | GPIOMSP430_P9_7 0x0980 |
#define | GPIOMSP430_P10_0 0x0A01 |
#define | GPIOMSP430_P10_1 0x0A02 |
#define | GPIOMSP430_P10_2 0x0A04 |
#define | GPIOMSP430_P10_3 0x0A08 |
#define | GPIOMSP430_P10_4 0x0A10 |
#define | GPIOMSP430_P10_5 0x0A20 |
#define | GPIOMSP430_P10_6 0x0A40 |
#define | GPIOMSP430_P10_7 0x0A80 |
#define | GPIOMSP430_P11_0 0x0B01 |
#define | GPIOMSP430_P11_1 0x0B02 |
#define | GPIOMSP430_P11_2 0x0B04 |
#define | GPIOMSP430_P11_3 0x0B08 |
#define | GPIOMSP430_P11_4 0x0B10 |
#define | GPIOMSP430_P11_5 0x0B20 |
#define | GPIOMSP430_P11_6 0x0B40 |
#define | GPIOMSP430_P11_7 0x0B80 |
#define | GPIOMSP430_PJ_0 0x0D01 |
#define | GPIOMSP430_PJ_1 0x0D02 |
#define | GPIOMSP430_PJ_2 0x0D04 |
#define | GPIOMSP430_PJ_3 0x0D08 |
#define | GPIOMSP430_PJ_4 0x0D10 |
#define | GPIOMSP430_PJ_5 0x0D20 |
#define | GPIOMSP430_PJ_6 0x0D40 |
#define | GPIOMSP430_PJ_7 0x0D80 |
Typedefs | |
typedef struct GPIOMSP430_Config | GPIOMSP430_Config |
GPIO device specific driver configuration structure. More... | |
#define GPIOMSP430_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 GPIOMSP430_P1_0 0x0101 |
#define GPIOMSP430_P1_1 0x0102 |
#define GPIOMSP430_P1_2 0x0104 |
#define GPIOMSP430_P1_3 0x0108 |
#define GPIOMSP430_P1_4 0x0110 |
#define GPIOMSP430_P1_5 0x0120 |
#define GPIOMSP430_P1_6 0x0140 |
#define GPIOMSP430_P1_7 0x0180 |
#define GPIOMSP430_P2_0 0x0201 |
#define GPIOMSP430_P2_1 0x0202 |
#define GPIOMSP430_P2_2 0x0204 |
#define GPIOMSP430_P2_3 0x0208 |
#define GPIOMSP430_P2_4 0x0210 |
#define GPIOMSP430_P2_5 0x0220 |
#define GPIOMSP430_P2_6 0x0240 |
#define GPIOMSP430_P2_7 0x0280 |
#define GPIOMSP430_P3_0 0x0301 |
#define GPIOMSP430_P3_1 0x0302 |
#define GPIOMSP430_P3_2 0x0304 |
#define GPIOMSP430_P3_3 0x0308 |
#define GPIOMSP430_P3_4 0x0310 |
#define GPIOMSP430_P3_5 0x0320 |
#define GPIOMSP430_P3_6 0x0340 |
#define GPIOMSP430_P3_7 0x0380 |
#define GPIOMSP430_P4_0 0x0401 |
#define GPIOMSP430_P4_1 0x0402 |
#define GPIOMSP430_P4_2 0x0404 |
#define GPIOMSP430_P4_3 0x0408 |
#define GPIOMSP430_P4_4 0x0410 |
#define GPIOMSP430_P4_5 0x0420 |
#define GPIOMSP430_P4_6 0x0440 |
#define GPIOMSP430_P4_7 0x0480 |
#define GPIOMSP430_P5_0 0x0501 |
#define GPIOMSP430_P5_1 0x0502 |
#define GPIOMSP430_P5_2 0x0504 |
#define GPIOMSP430_P5_3 0x0508 |
#define GPIOMSP430_P5_4 0x0510 |
#define GPIOMSP430_P5_5 0x0520 |
#define GPIOMSP430_P5_6 0x0540 |
#define GPIOMSP430_P5_7 0x0580 |
#define GPIOMSP430_P6_0 0x0601 |
#define GPIOMSP430_P6_1 0x0602 |
#define GPIOMSP430_P6_2 0x0604 |
#define GPIOMSP430_P6_3 0x0608 |
#define GPIOMSP430_P6_4 0x0610 |
#define GPIOMSP430_P6_5 0x0620 |
#define GPIOMSP430_P6_6 0x0640 |
#define GPIOMSP430_P6_7 0x0680 |
#define GPIOMSP430_P7_0 0x0701 |
#define GPIOMSP430_P7_1 0x0702 |
#define GPIOMSP430_P7_2 0x0704 |
#define GPIOMSP430_P7_3 0x0708 |
#define GPIOMSP430_P7_4 0x0710 |
#define GPIOMSP430_P7_5 0x0720 |
#define GPIOMSP430_P7_6 0x0740 |
#define GPIOMSP430_P7_7 0x0780 |
#define GPIOMSP430_P8_0 0x0801 |
#define GPIOMSP430_P8_1 0x0802 |
#define GPIOMSP430_P8_2 0x0804 |
#define GPIOMSP430_P8_3 0x0808 |
#define GPIOMSP430_P8_4 0x0810 |
#define GPIOMSP430_P8_5 0x0820 |
#define GPIOMSP430_P8_6 0x0840 |
#define GPIOMSP430_P8_7 0x0880 |
#define GPIOMSP430_P9_0 0x0901 |
#define GPIOMSP430_P9_1 0x0902 |
#define GPIOMSP430_P9_2 0x0904 |
#define GPIOMSP430_P9_3 0x0908 |
#define GPIOMSP430_P9_4 0x0910 |
#define GPIOMSP430_P9_5 0x0920 |
#define GPIOMSP430_P9_6 0x0940 |
#define GPIOMSP430_P9_7 0x0980 |
#define GPIOMSP430_P10_0 0x0A01 |
#define GPIOMSP430_P10_1 0x0A02 |
#define GPIOMSP430_P10_2 0x0A04 |
#define GPIOMSP430_P10_3 0x0A08 |
#define GPIOMSP430_P10_4 0x0A10 |
#define GPIOMSP430_P10_5 0x0A20 |
#define GPIOMSP430_P10_6 0x0A40 |
#define GPIOMSP430_P10_7 0x0A80 |
#define GPIOMSP430_P11_0 0x0B01 |
#define GPIOMSP430_P11_1 0x0B02 |
#define GPIOMSP430_P11_2 0x0B04 |
#define GPIOMSP430_P11_3 0x0B08 |
#define GPIOMSP430_P11_4 0x0B10 |
#define GPIOMSP430_P11_5 0x0B20 |
#define GPIOMSP430_P11_6 0x0B40 |
#define GPIOMSP430_P11_7 0x0B80 |
#define GPIOMSP430_PJ_0 0x0D01 |
#define GPIOMSP430_PJ_1 0x0D02 |
#define GPIOMSP430_PJ_2 0x0D04 |
#define GPIOMSP430_PJ_3 0x0D08 |
#define GPIOMSP430_PJ_4 0x0D10 |
#define GPIOMSP430_PJ_5 0x0D20 |
#define GPIOMSP430_PJ_6 0x0D40 |
#define GPIOMSP430_PJ_7 0x0D80 |
typedef struct GPIOMSP430_Config GPIOMSP430_Config |
GPIO device specific driver configuration structure.