1 2 3 4 5 6 7 8 9 10 11
12 import ti.catalog.msp430.peripherals.communication.USI as USI;
13 import ti.catalog.msp430.peripherals.adc.ADC10 as ADC10;
14
15 /*!
16 * ======== GPIO for MSP430G2230 ========
17 * MSP430 General Purpose Input Output Ports
18 */
19 metaonly module GPIO_MSP430G2230 inherits IGPIO {
20 /*!
21 * ======== create ========
22 * Create an instance of this peripheral.
23 */
24 create(USI.Instance usi, ADC10.Instance adc10);
25
26 instance:
27 /*! @_nodoc */
28 config USI.Instance usi;
29
30 /*! @_nodoc */
31 config ADC10.Instance adc10;
32
33 /*! Define an array to describe all device pins. The 1st dimension
34 * denotes the port, the second the pin on that port. On an
35 * MSP430G2230 device, there are 8 + 1 = 8 pins total.
36 */
37
38 39
40 41
42 config DevicePin_t devicePins[1][8];
43
44 /*! Implementation of Device Pin Functional Configuration */
45 override config DevicePinFunctionSetting_t devicePinSetting[1][8];
46
47 /*! Determine if each Register needs to be forced set or not */
48 readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
49 [
50 { register : "P1OUT" , regForceSet : true },
51 { register : "P1SEL" , regForceSet : false },
52 { register : "P1DIR" , regForceSet : false },
53 { register : "P1REN" , regForceSet : false },
54 { register : "P1IES" , regForceSet : true },
55 { register : "P1IFG" , regForceSet : true },
56 { register : "P1IE" , regForceSet : false }
57 ];
58
59 60 61 62 63 64
65
66 /*! Port 1 Output Register */
67 config GpioBits8PxOut_t P1OUT = {
68 Bit0 : BIT0_OFF,
69 Bit1 : BIT1_OFF,
70 Bit2 : BIT2_OFF,
71 Bit3 : BIT3_OFF,
72 Bit4 : BIT4_OFF,
73 Bit5 : BIT5_OFF,
74 Bit6 : BIT6_OFF,
75 Bit7 : BIT7_OFF
76 };
77
78 /*! Port 1 Port Select Register */
79 config GpioBits8PxSel_t P1SEL = {
80 Bit0 : BIT0_OFF,
81 Bit1 : BIT1_OFF,
82 Bit2 : BIT2_OFF,
83 Bit3 : BIT3_OFF,
84 Bit4 : BIT4_OFF,
85 Bit5 : BIT5_OFF,
86 Bit6 : BIT6_OFF,
87 Bit7 : BIT7_OFF
88 };
89
90 /*! Port 1 Direction Register */
91 config GpioBits8PxDir_t P1DIR = {
92 Bit0 : BIT0_OFF,
93 Bit1 : BIT1_OFF,
94 Bit2 : BIT2_OFF,
95 Bit3 : BIT3_OFF,
96 Bit4 : BIT4_OFF,
97 Bit5 : BIT5_OFF,
98 Bit6 : BIT6_OFF,
99 Bit7 : BIT7_OFF
100 };
101
102 /*! Port 1 Resistor Enable Register */
103 config GpioBits8PxRen_t P1REN = {
104 Bit0 : BIT0_OFF,
105 Bit1 : BIT1_OFF,
106 Bit2 : BIT2_OFF,
107 Bit3 : BIT3_OFF,
108 Bit4 : BIT4_OFF,
109 Bit5 : BIT5_OFF,
110 Bit6 : BIT6_OFF,
111 Bit7 : BIT7_OFF
112 };
113 }