WISP ERT (Client)  1.0.0
The WISP Extended Runtime (WISP side)
pin-assign.h
Go to the documentation of this file.
1 
13 #ifndef PIN_ASSIGN_H_
14 #define PIN_ASSIGN_H_
15 #include "wispGuts.h"
16 
24 /************************************************************************************************************************************/
25 
26 /*
27  * Port 1
28  */
29 
30 // P1.0 - RX_BITLINE INPUT
31 #define PIN_RX_BITLINE (BIT0)
32 #define PRX_BITLINEOUT (P1OUT)
33 
34 // P1.4 - AUX3 - INPUT/OUTPUT
35 #define PIN_AUX3 (BIT4)
36 #define PIN_AUX3_OUT (P1OUT)
37 #define PAUX3IN (P1IN)
38 #define PDIR_AUX3 (P1DIR)
39 #define PAUX3SEL0 (P1SEL0)
40 #define PAUX3SEL1 (P1SEL1)
41 
42 // P1.6 - I2C_SDA - INPUT/OUTPUT
43 #define PIN_I2C_SDA (BIT6)
44 #define PI2C_SDAIN (P1IN)
45 #define PDIR_I2C_SDA (P1DIR)
46 #define PI2C_SDASEL0 (P1SEL0)
47 #define PI2C_SDASEL1 (P1SEL1)
48 
49 // P1.7 - I2C_SCL - INPUT/OUTPUT
50 #define PIN_I2C_SCL (BIT7)
51 #define PDIR_I2C_SCL (P1DIR)
52 #define PI2C_SCLSEL0 (P1SEL0)
53 #define PI2C_SCLSEL1 (P1SEL1)
54 
55 /*
56  * Port 2
57  */
58 
59 // P2.0 - UART TX - OUTPUT
60 #define PIN_UART_TX (BIT0)
61 #define PUART_TXSEL0 (P2SEL0)
62 #define PUART_TXSEL1 (P2SEL1)
63 
64 // P2.1 - UART RX - INPUT
65 #define PIN_UART_RX (BIT1)
66 #define PUART_RXSEL0 (P2SEL0)
67 #define PUART_RXSEL1 (P2SEL1)
68 
69 // P2.3 - RECEIVE - INPUT
70 #define PIN_RX (BIT3)
71 #define PRXIN (P2IN)
72 #define PDIR_RX (P2DIR)
73 #define PRXIES (P2IES)
74 #define PRXIE (P2IE)
75 #define PRXIFG (P2IFG)
76 #define PRXSEL0 (P2SEL0)
77 #define PRXSEL1 (P2SEL1)
78 #define PRX_VECTOR_DEF (PORT2_VECTOR)
79 
80 // P2.4 - ACCEL_SCLK - OUTPUT
81 #define PIN_ACCEL_SCLK (BIT4)
82 #define PDIR_ACCEL_SCLK (P2DIR)
83 #define PACCEL_SCLKSEL0 (P2SEL0)
84 #define PACCEL_SCLKSEL1 (P2SEL1)
85 
86 // P2.5 - ACCEL_MOSI - OUTPUT
87 #define PIN_ACCEL_MOSI (BIT5)
88 #define PDIR_ACCEL_MOSI (P2DIR)
89 #define PACCEL_MOSISEL0 (P2SEL0)
90 #define PACCEL_MOSISEL1 (P2SEL1)
91 
92 
93 // P2.6 - ACCEL_MISO - INPUT
94 #define PIN_ACCEL_MISO (BIT6)
95 #define PDIR_ACCEL_MISO (P2DIR)
96 #define PACCEL_MISOSEL0 (P2SEL0)
97 #define PACCEL_MISOSEL1 (P2SEL1)
98 
99 
100 // P2.7 - TRANSMIT - OUTPUT
101 #define PIN_TX (BIT7)
102 #define PTXOUT (P2OUT)
103 #define PTXDIR (P2DIR)
104 
105 /*
106  * Port 3
107  */
108 
109 // P3.4 - AUX1 - INPUT/OUTPUT
110 #define PIN_AUX1 (BIT4)
111 #define PAUX1IN (P3IN)
112 #define PDIR_AUX1 (P3DIR)
113 #define PAUX1SEL0 (P3SEL0)
114 #define PAUX1SEL1 (P3SEL1)
115 
116 // P3.5 - AUX2 - INPUT/OUTPUT
117 #define PIN_AUX2 (BIT5)
118 #define PAUX2IN (P3IN)
119 #define PDIR_AUX2 (P3DIR)
120 #define PAUX2SEL0 (P3SEL0)
121 #define PAUX2SEL1 (P3SEL1)
122 
123 // P3.6 - ACCEL_INT2 - INPUT
124 #define PIN_ACCEL_INT2 (BIT6)
125 #define PDIR_ACCEL_INT2 (P3DIR)
126 #define PACCEL_INT2SEL0 (P3SEL0)
127 #define PACCEL_INT2SEL1 (P3SEL1)
128 
129 // P3.7 - ACCEL_INT1 - INPUT
130 #define PIN_ACCEL_INT1 (BIT7)
131 #define PDIR_ACCEL_INT1 (P3DIR)
132 #define PACCEL_INT1SEL0 (P3SEL0)
133 #define PACCEL_INT1SEL1 (P3SEL1)
134 
135 /*
136  * Port 4
137  */
138 
139 // P4.0 - LED1 OUTPUT
140 #define PLED1OUT (P4OUT)
141 #define PIN_LED1 (BIT0)
142 #define PDIR_LED1 (P4DIR)
143 
144 // P4.1 MEAS INPUT
145 #define PIN_MEAS (BIT1)
146 #define PMEASOUT (P4OUT)
147 #define PMEASDIR (P4DIR)
148 #define PMEASSEL0 (P4SEL0)
149 #define PMEASSEL1 (P4SEL1)
150 
151 // P4.2 - ACCEL_EN - OUTPUT
152 #define PIN_ACCEL_EN BIT2
153 #define POUT_ACCEL_EN P4OUT
154 #define PDIR_ACCEL_EN P4DIR
155 
156 // P4.3 - ACCEL_CS - OUTPUT
157 #define PIN_ACCEL_CS BIT3
158 #define POUT_ACCEL_CS P4OUT
159 #define PDIR_ACCEL_CS P4DIR
160 
161 // P4.5 - RECEIVE ENABLE - OUTPUT
162 #define PIN_RX_EN (BIT5)
163 #define PRXEOUT (P4OUT)
164 #define PDIR_RX_EN (P4DIR)
165 
166 
167 // P4.6 - DEBUG LINE - OUTPUT
168 #define PIN_DBG0 (BIT6)
169 #define PDBGOUT (P4OUT)
170 
171 /*
172  * Port 5
173  */
174 
175 /*
176  * Port 6
177  */
178 
179 /*
180  * Port J
181  */
182 
183 // PJ.1 MEAS_EN (OUTPUT)
184 #define PMEAS_ENOUT (PJOUT)
185 #define PMEAS_ENDIR (PJDIR)
186 #define PIN_MEAS_EN (BIT1)
187 
188 
189 // PJ.6 - LED2
190 #define PDIR_LED2 (PJDIR)
191 #define PLED2OUT (PJOUT)
192 #define PIN_LED2 (BIT6)
193 
194 /*
195  * ADC Channel definitions
196  */
197 
203 // Set as many as possible pins to output and drive them low
204 #ifndef __ASSEMBLER__
205 #define setupDflt_IO() \
206  P1OUT = 0x00;\
207  P2OUT = 0x00;\
208  P3OUT = 0x00;\
209  P4OUT = 0x00;\
210  PJOUT = 0x00;\
211  P1DIR = ~PIN_RX_BITLINE;\
212  PJDIR = 0xFF;\
213  P2DIR = ~PIN_RX;\
214  P3DIR = 0xFF;\
215  P4DIR = (~PIN_MEAS & ~PIN_ACCEL_EN);\
216 
217 #endif /* ~__ASSEMBLER__ */
218 
219 #endif /* PIN_ASSIGN_H */