1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32
33 import ti.catalog.msp430.peripherals.communication.USI as USI;
34
35 /*!
36 * ======== GPIO for MSP430G2x02 ========
37 * MSP430 General Purpose Input Output Ports
38 */
39 metaonly module GPIO_MSP430G2x02 inherits IGPIO {
40 /*!
41 * ======== create ========
42 * Create an instance of this peripheral.
43 */
44 create(USI.Instance usi);
45
46 instance:
47 /*! @_nodoc */
48 config USI.Instance usi;
49
50 /*! Define an array to describe all device pins. The 1st dimension
51 * denotes the port, the second the pin on that port. On an
52 * MSP430G2x02 device, there are 8 + 8 = 16 pins total.
53 */
54
55 56
57 58
59 config DevicePin_t devicePins[2][8];
60
61 /*! Implementation of Device Pin Functional Configuration */
62 override config DevicePinFunctionSetting_t devicePinSetting[2][8];
63
64 /*! Determine if each Register needs to be forced set or not */
65 readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
66 [
67 { register : "P1OUT" , regForceSet : true },
68 { register : "P1SEL" , regForceSet : false },
69 { register : "P1SEL2", regForceSet : false },
70 { register : "P1DIR" , regForceSet : true },
71 { register : "P1REN" , regForceSet : false },
72 { register : "P1IES" , regForceSet : true },
73 { register : "P1IFG" , regForceSet : true },
74 { register : "P1IE" , regForceSet : false },
75 { register : "P2OUT" , regForceSet : true },
76 { register : "P2SEL" , regForceSet : false },
77 { register : "P2SEL2", regForceSet : false },
78 { register : "P2DIR" , regForceSet : true },
79 { register : "P2REN" , regForceSet : false },
80 { register : "P2IES" , regForceSet : true },
81 { register : "P2IFG" , regForceSet : true },
82 { register : "P2IE" , regForceSet : false }
83 ];
84
85 86 87 88 89 90
91
92 /*! Port 1 Output Register */
93 config GpioBits8PxOut_t P1OUT = {
94 Bit0 : BIT0_OFF,
95 Bit1 : BIT1_OFF,
96 Bit2 : BIT2_OFF,
97 Bit3 : BIT3_OFF,
98 Bit4 : BIT4_OFF,
99 Bit5 : BIT5_OFF,
100 Bit6 : BIT6_OFF,
101 Bit7 : BIT7_OFF
102 };
103
104 /*! Port 1 Port Select Register */
105 config GpioBits8PxSel_t P1SEL = {
106 Bit0 : BIT0_OFF,
107 Bit1 : BIT1_OFF,
108 Bit2 : BIT2_OFF,
109 Bit3 : BIT3_OFF,
110 Bit4 : BIT4_OFF,
111 Bit5 : BIT5_OFF,
112 Bit6 : BIT6_OFF,
113 Bit7 : BIT7_OFF
114 };
115
116 /*! Port 1 Port Select 2 Register */
117 config GpioBits8PxSel2_t P1SEL2 = {
118 Bit0 : BIT0_OFF,
119 Bit1 : BIT1_OFF,
120 Bit2 : BIT2_OFF,
121 Bit3 : BIT3_OFF,
122 Bit4 : BIT4_OFF,
123 Bit5 : BIT5_OFF,
124 Bit6 : BIT6_OFF,
125 Bit7 : BIT7_OFF
126 };
127
128 /*! Port 1 Direction Register */
129 config GpioBits8PxDir_t P1DIR = {
130 Bit0 : BIT0_OFF,
131 Bit1 : BIT1_OFF,
132 Bit2 : BIT2_OFF,
133 Bit3 : BIT3_OFF,
134 Bit4 : BIT4_OFF,
135 Bit5 : BIT5_OFF,
136 Bit6 : BIT6_OFF,
137 Bit7 : BIT7_OFF
138 };
139
140 /*! Port 1 Resistor Enable Register */
141 config GpioBits8PxRen_t P1REN = {
142 Bit0 : BIT0_OFF,
143 Bit1 : BIT1_OFF,
144 Bit2 : BIT2_OFF,
145 Bit3 : BIT3_OFF,
146 Bit4 : BIT4_OFF,
147 Bit5 : BIT5_OFF,
148 Bit6 : BIT6_OFF,
149 Bit7 : BIT7_OFF
150 };
151
152 /*! Port 2 Output Register */
153 config GpioBits8PxOut_t P2OUT = {
154 Bit0 : BIT0_OFF,
155 Bit1 : BIT1_OFF,
156 Bit2 : BIT2_OFF,
157 Bit3 : BIT3_OFF,
158 Bit4 : BIT4_OFF,
159 Bit5 : BIT5_OFF,
160 Bit6 : BIT6_OFF,
161 Bit7 : BIT7_OFF
162 };
163
164 /*! Port 2 Port Select Register */
165 config GpioBits8PxSel_t P2SEL = {
166 Bit0 : BIT0_OFF,
167 Bit1 : BIT1_OFF,
168 Bit2 : BIT2_OFF,
169 Bit3 : BIT3_OFF,
170 Bit4 : BIT4_OFF,
171 Bit5 : BIT5_OFF,
172 Bit6 : BIT6,
173 Bit7 : BIT7
174 };
175
176 /*! Port 2 Port Select 2 Register */
177 config GpioBits8PxSel2_t P2SEL2 = {
178 Bit0 : BIT0_OFF,
179 Bit1 : BIT1_OFF,
180 Bit2 : BIT2_OFF,
181 Bit3 : BIT3_OFF,
182 Bit4 : BIT4_OFF,
183 Bit5 : BIT5_OFF,
184 Bit6 : BIT6_OFF,
185 Bit7 : BIT7_OFF
186 };
187
188 /*! Port 2 Direction Register */
189 config GpioBits8PxDir_t P2DIR = {
190 Bit0 : BIT0_OFF,
191 Bit1 : BIT1_OFF,
192 Bit2 : BIT2_OFF,
193 Bit3 : BIT3_OFF,
194 Bit4 : BIT4_OFF,
195 Bit5 : BIT5_OFF,
196 Bit6 : BIT6_OFF,
197 Bit7 : BIT7_OFF
198 };
199
200 /*! Port 2 Resistor Enable Register */
201 config GpioBits8PxRen_t P2REN = {
202 Bit0 : BIT0_OFF,
203 Bit1 : BIT1_OFF,
204 Bit2 : BIT2_OFF,
205 Bit3 : BIT3_OFF,
206 Bit4 : BIT4_OFF,
207 Bit5 : BIT5_OFF,
208 Bit6 : BIT6_OFF,
209 Bit7 : BIT7_OFF
210 };
211 }