gpio.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_GPIO_H__
00002 #define __MSP430WARE_GPIO_H__
00003 //*****************************************************************************
00004 //
00005 //The following are the defines to include the required modules for this
00006 //peripheral in msp430xgeneric.h file
00007 //
00008 //*****************************************************************************
00009 #define __MSP430_HAS_PORT1_R__
00010 #define __MSP430_HAS_PORT2_R__
00011 #define __MSP430_HAS_PORTA_R__
00012 
00013 //*****************************************************************************
00014 //
00015 //The following are values that can be passed to the all GPIO module API
00016 //as the selectedPort parameter.
00017 //
00018 //*****************************************************************************
00019 #define GPIO_PORT_P1     0x00
00020 #define GPIO_PORT_P2     0x01
00021 #define GPIO_PORT_P3     0x00
00022 #define GPIO_PORT_P4     0x01
00023 #define GPIO_PORT_P5     0x00
00024 #define GPIO_PORT_P6     0x01
00025 #define GPIO_PORT_P7     0x00
00026 #define GPIO_PORT_P8     0x01
00027 #define GPIO_PORT_P9     0x00
00028 #define GPIO_PORT_P10    0x01
00029 #define GPIO_PORT_P11    0x00
00030 #define GPIO_PORT_PA     0x02
00031 #define GPIO_PORT_PB     0x02
00032 #define GPIO_PORT_PC     0x02
00033 #define GPIO_PORT_PD     0x02
00034 #define GPIO_PORT_PE     0x02
00035 #define GPIO_PORT_PF     0x02
00036 #define GPIO_PORT_PJ     0x02
00037 
00038 //*****************************************************************************
00039 //
00040 //The following are values that can be passed to the all GPIO module API
00041 //as the selectedPin parameter.
00042 //
00043 //*****************************************************************************
00044 #define GPIO_PIN0   0x01
00045 #define GPIO_PIN1   0x02
00046 #define GPIO_PIN2   0x04
00047 #define GPIO_PIN3   0x08
00048 #define GPIO_PIN4   0x10
00049 #define GPIO_PIN5   0x20
00050 #define GPIO_PIN6   0x40
00051 #define GPIO_PIN7   0x80
00052 #define GPIO_PIN8   0x100
00053 #define GPIO_PIN9   0x200
00054 #define GPIO_PIN10   0x400
00055 #define GPIO_PIN11   0x800
00056 #define GPIO_PIN12   0x1000
00057 #define GPIO_PIN13   0x2000
00058 #define GPIO_PIN14   0x4000
00059 #define GPIO_PIN15   0x8000
00060 
00061 //*****************************************************************************
00062 //
00063 //The following are values that may be returned by the GPIO_getInputPinValue()
00064 //API.
00065 //
00066 //*****************************************************************************
00067 #define GPIO_INPUT_PIN_HIGH 0x01
00068 #define GPIO_INPUT_PIN_LOW  0x00
00069 
00070 //*****************************************************************************
00071 //
00072 //The following are values that can be passed to the GPIO_interruptEdgeSelect()
00073 //API as the edgeSelect parameter.
00074 //
00075 //*****************************************************************************
00076 #define GPIO_HIGH_TO_LOW_TRANSITION 0x01
00077 #define GPIO_LOW_TO_HIGH_TRANSITION 0x00
00078 
00079 //*****************************************************************************
00080 //
00081 //The following are values that can be passed to the GPIO_setDriveStrength()
00082 //API as the driveStrength parameter.
00083 //
00084 //*****************************************************************************
00085 #define GPIO_FULL_OUTPUT_DRIVE_STRENGTH     0x01
00086 #define GPIO_REDUCED_OUTPUT_DRIVE_STRENGTH  0x00
00087 
00088 
00089 //*****************************************************************************
00090 //
00091 //Prototypes for the APIs.
00092 //
00093 //*****************************************************************************
00094 extern
00095 void GPIO_setAsOutputPin (unsigned int baseAddress,
00096     unsigned char selectedPort,
00097     unsigned int selectedPin
00098     );
00099 extern
00100 void GPIO_setAsInputPin (unsigned int baseAddress,
00101     unsigned char selectedPort,
00102     unsigned int selectedPin
00103     );
00104 
00105 extern
00106 void GPIO_setOutputHighOnPin ( unsigned int baseAddress,
00107     unsigned char selectedPort,
00108     unsigned int selectedPin
00109     );
00110 
00111 extern
00112 void GPIO_setOutputLowOnPin (unsigned int baseAddress,
00113     unsigned char selectedPort,
00114     unsigned int selectedPin
00115     );
00116 
00117 extern
00118 void GPIO_toggleOutputOnPin (unsigned int baseAddress,
00119     unsigned char selectedPort,
00120     unsigned int selectedPin
00121     );
00122 extern
00123 void GPIO_setAsInputPinWithPullDownresistor (unsigned int baseAddress,
00124     unsigned char selectedPort,
00125     unsigned int selectedPin
00126     );
00127 extern
00128 void GPIO_setAsInputPinWithPullUpresistor (unsigned int baseAddress,
00129     unsigned char selectedPort,
00130     unsigned int selectedPin
00131     );
00132 
00133 
00134 extern
00135 void GPIO_enableInterrupt (unsigned int baseAddress,
00136     unsigned char selectedPort,
00137     unsigned int selectedPins
00138     );
00139 
00140 extern
00141 void GPIO_disableInterrupt (unsigned int baseAddress,
00142     unsigned char selectedPort,
00143     unsigned int selectedPins
00144     );
00145 extern
00146 void GPIO_disbleInterrupt (unsigned int baseAddress,
00147     unsigned char selectedPort,
00148     unsigned int selectedPins
00149     );
00150 extern
00151 void GPIO_clearInterruptFlag (unsigned int baseAddress,
00152     unsigned char selectedPort,
00153     unsigned int selectedPins
00154     );
00155 extern
00156 unsigned int GPIO_getInterruptStatus (unsigned int baseAddress,
00157     unsigned char selectedPort,
00158     unsigned int selectedPins
00159     );
00160 
00161 extern
00162 void GPIO_interruptEdgeSelect (unsigned int baseAddress,
00163     unsigned char selectedPort,
00164     unsigned int selectedPins,
00165     unsigned char edgeSelect
00166     );
00167 
00168 extern
00169 unsigned short GPIO_getInputPinValue (unsigned int baseAddress,
00170     unsigned char selectedPort,
00171     unsigned int selectedPin
00172     );
00173 
00174 extern
00175 void GPIO_setDriveStrength (unsigned int baseAddress,
00176     unsigned char selectedPort,
00177     unsigned int selectedPins,
00178     unsigned char driveStrength
00179     );
00180 extern
00181 void GPIO_setAsPeripheralModuleFunctionOutputPin ( unsigned int baseAddress,
00182     unsigned char selectedPort,
00183     unsigned int selectedPin
00184     );
00185 
00186 extern
00187 void GPIO_setAsPeripheralModuleFunctionInputPin ( unsigned int baseAddress,
00188     unsigned char selectedPort,
00189     unsigned int selectedPin
00190     );
00191 
00192 #endif

Copyright 2012, Texas Instruments Incorporated