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.comparator.IComparator as Comparator;
34
35 /*!
36 * ======== GPIO for MSP430G2210 ========
37 * MSP430 General Purpose Input Output Ports
38 */
39 metaonly module GPIO_MSP430G2210 inherits IGPIO {
40 /*!
41 * ======== create ========
42 * Create an instance of this peripheral.
43 */
44 create(Comparator.Instance comparator);
45
46 instance:
47 /*! @_nodoc */
48 config Comparator.Instance comparator;
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 * MSP430G2210 device, there are 8 + 1 = 8 pins total.
53 */
54
55 56
57 58
59 config DevicePin_t devicePins[1][8];
60
61 /*! Implementation of Device Pin Functional Configuration */
62 override config DevicePinFunctionSetting_t devicePinSetting[1][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 : "P1DIR" , regForceSet : true },
70 { register : "P1REN" , regForceSet : false },
71 { register : "P1IES" , regForceSet : true },
72 { register : "P1IFG" , regForceSet : true },
73 { register : "P1IE" , regForceSet : false }
74 ];
75
76 77 78 79 80 81
82
83 /*! Port 1 Output Register */
84 config GpioBits8PxOut_t P1OUT = {
85 Bit0 : BIT0_OFF,
86 Bit1 : BIT1_OFF,
87 Bit2 : BIT2_OFF,
88 Bit3 : BIT3_OFF,
89 Bit4 : BIT4_OFF,
90 Bit5 : BIT5_OFF,
91 Bit6 : BIT6_OFF,
92 Bit7 : BIT7_OFF
93 };
94
95 /*! Port 1 Port Select Register */
96 config GpioBits8PxSel_t P1SEL = {
97 Bit0 : BIT0_OFF,
98 Bit1 : BIT1_OFF,
99 Bit2 : BIT2_OFF,
100 Bit3 : BIT3_OFF,
101 Bit4 : BIT4_OFF,
102 Bit5 : BIT5_OFF,
103 Bit6 : BIT6_OFF,
104 Bit7 : BIT7_OFF
105 };
106
107 /*! Port 1 Direction Register */
108 config GpioBits8PxDir_t P1DIR = {
109 Bit0 : BIT0_OFF,
110 Bit1 : BIT1_OFF,
111 Bit2 : BIT2_OFF,
112 Bit3 : BIT3_OFF,
113 Bit4 : BIT4_OFF,
114 Bit5 : BIT5_OFF,
115 Bit6 : BIT6_OFF,
116 Bit7 : BIT7_OFF
117 };
118
119 /*! Port 1 Resistor Enable Register */
120 config GpioBits8PxRen_t P1REN = {
121 Bit0 : BIT0_OFF,
122 Bit1 : BIT1_OFF,
123 Bit2 : BIT2_OFF,
124 Bit3 : BIT3_OFF,
125 Bit4 : BIT4_OFF,
126 Bit5 : BIT5_OFF,
127 Bit6 : BIT6_OFF,
128 Bit7 : BIT7_OFF
129 };
130 }