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 /*!
34 * ======== GPIO for MSP430G2x01 ========
35 * MSP430 General Purpose Input Output Ports
36 */
37 metaonly module GPIO_MSP430G2x01 inherits IGPIO {
38 /*!
39 * ======== create ========
40 * Create an instance of this peripheral.
41 */
42 create();
43
44 instance:
45 /*! Define an array to describe all device pins. The 1st dimension
46 * denotes the port, the second the pin on that port. On an
47 * MSP430G2x01 device, there are 8 + 2 = 10 pins total.
48 */
49
50 51
52 53
54 config DevicePin_t devicePins[2][8];
55
56 /*! Implementation of Device Pin Functional Configuration */
57 override config DevicePinFunctionSetting_t devicePinSetting[2][8];
58
59 /*! Determine if each Register needs to be forced set or not */
60 readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
61 [
62 { register : "P1OUT" , regForceSet : true },
63 { register : "P1SEL" , regForceSet : false },
64 { register : "P1DIR" , regForceSet : true },
65 { register : "P1REN" , regForceSet : false },
66 { register : "P1IES" , regForceSet : true },
67 { register : "P1IFG" , regForceSet : true },
68 { register : "P1IE" , regForceSet : false },
69 { register : "P2OUT" , regForceSet : true },
70 { register : "P2SEL" , regForceSet : false },
71 { register : "P2DIR" , regForceSet : true },
72 { register : "P2REN" , regForceSet : false },
73 { register : "P2IES" , regForceSet : true },
74 { register : "P2IFG" , regForceSet : true },
75 { register : "P2IE" , regForceSet : false }
76 ];
77
78 79 80 81 82 83
84
85 /*! Port 1 Output Register */
86 config GpioBits8PxOut_t P1OUT = {
87 Bit0 : BIT0_OFF,
88 Bit1 : BIT1_OFF,
89 Bit2 : BIT2_OFF,
90 Bit3 : BIT3_OFF,
91 Bit4 : BIT4_OFF,
92 Bit5 : BIT5_OFF,
93 Bit6 : BIT6_OFF,
94 Bit7 : BIT7_OFF
95 };
96
97 /*! Port 1 Port Select Register */
98 config GpioBits8PxSel_t P1SEL = {
99 Bit0 : BIT0_OFF,
100 Bit1 : BIT1_OFF,
101 Bit2 : BIT2_OFF,
102 Bit3 : BIT3_OFF,
103 Bit4 : BIT4_OFF,
104 Bit5 : BIT5_OFF,
105 Bit6 : BIT6_OFF,
106 Bit7 : BIT7_OFF
107 };
108
109 /*! Port 1 Direction Register */
110 config GpioBits8PxDir_t P1DIR = {
111 Bit0 : BIT0_OFF,
112 Bit1 : BIT1_OFF,
113 Bit2 : BIT2_OFF,
114 Bit3 : BIT3_OFF,
115 Bit4 : BIT4_OFF,
116 Bit5 : BIT5_OFF,
117 Bit6 : BIT6_OFF,
118 Bit7 : BIT7_OFF
119 };
120
121 /*! Port 1 Resistor Enable Register */
122 config GpioBits8PxRen_t P1REN = {
123 Bit0 : BIT0_OFF,
124 Bit1 : BIT1_OFF,
125 Bit2 : BIT2_OFF,
126 Bit3 : BIT3_OFF,
127 Bit4 : BIT4_OFF,
128 Bit5 : BIT5_OFF,
129 Bit6 : BIT6_OFF,
130 Bit7 : BIT7_OFF
131 };
132
133 /*! Port 2 Output Register */
134 config GpioBits8PxOut_t P2OUT = {
135 Bit0 : BIT0_OFF,
136 Bit1 : BIT1_OFF,
137 Bit2 : BIT2_OFF,
138 Bit3 : BIT3_OFF,
139 Bit4 : BIT4_OFF,
140 Bit5 : BIT5_OFF,
141 Bit6 : BIT6_OFF,
142 Bit7 : BIT7_OFF
143 };
144
145 /*! Port 2 Port Select Register */
146 config GpioBits8PxSel_t P2SEL = {
147 Bit0 : BIT0_OFF,
148 Bit1 : BIT1_OFF,
149 Bit2 : BIT2_OFF,
150 Bit3 : BIT3_OFF,
151 Bit4 : BIT4_OFF,
152 Bit5 : BIT5_OFF,
153 Bit6 : BIT6,
154 Bit7 : BIT7
155 };
156
157 /*! Port 2 Direction Register */
158 config GpioBits8PxDir_t P2DIR = {
159 Bit0 : BIT0_OFF,
160 Bit1 : BIT1_OFF,
161 Bit2 : BIT2_OFF,
162 Bit3 : BIT3_OFF,
163 Bit4 : BIT4_OFF,
164 Bit5 : BIT5_OFF,
165 Bit6 : BIT6_OFF,
166 Bit7 : BIT7_OFF
167 };
168
169 /*! Port 2 Resistor Enable Register */
170 config GpioBits8PxRen_t P2REN = {
171 Bit0 : BIT0_OFF,
172 Bit1 : BIT1_OFF,
173 Bit2 : BIT2_OFF,
174 Bit3 : BIT3_OFF,
175 Bit4 : BIT4_OFF,
176 Bit5 : BIT5_OFF,
177 Bit6 : BIT6_OFF,
178 Bit7 : BIT7_OFF
179 };
180 }