ca85c39fbe4aa793d1254eb79c296463de8f775f
[fw/altos] / src / cc1111 / ao_pins.h
1 /*
2  * Copyright © 2010 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #ifndef _AO_PINS_H_
19 #define _AO_PINS_H_
20
21 #if defined(TELEMETRUM_V_1_0)
22         #define HAS_FLIGHT              1
23         #define HAS_USB                 1
24         #define HAS_BEEP                1
25         #define HAS_GPS                 1
26         #define HAS_SERIAL_1            1
27         #define HAS_ADC                 1
28         #define USE_SERIAL_STDIN        0
29         #define HAS_EEPROM              1
30         #define HAS_LOG                 1
31         #define USE_INTERNAL_FLASH      0
32         #define HAS_DBG                 1
33         #define DBG_ON_P1               1
34         #define DBG_ON_P0               0
35         #define IGNITE_ON_P2            1
36         #define IGNITE_ON_P0            0
37         #define PACKET_HAS_MASTER       0
38         #define PACKET_HAS_SLAVE        1
39         #define NOISY_ACCEL             1
40
41         #define HAS_COMPANION           1
42         #define COMPANION_CS_ON_P1      1
43         #define COMPANION_CS_MASK       0x4     /* CS1 is P1_2 */
44         #define COMPANION_CS            P1_2
45
46         #define AO_LED_RED              1
47         #define LEDS_AVAILABLE          (AO_LED_RED)
48         #define HAS_EXTERNAL_TEMP       0
49         #define HAS_ACCEL_REF           0
50         #define HAS_ACCEL               1
51         #define HAS_IGNITE              1
52         #define HAS_MONITOR             0
53 #endif
54
55 #if defined(TELEMETRUM_V_1_1)
56         #define HAS_FLIGHT              1
57         #define HAS_USB                 1
58         #define HAS_BEEP                1
59         #define HAS_GPS                 1
60         #define HAS_SERIAL_1            1
61         #define USE_SERIAL_STDIN        0
62         #define HAS_ADC                 1
63         #define HAS_EEPROM              1
64         #define HAS_LOG                 1
65         #define USE_INTERNAL_FLASH      0
66         #define HAS_DBG                 1
67         #define DBG_ON_P1               1
68         #define DBG_ON_P0               0
69         #define IGNITE_ON_P2            1
70         #define IGNITE_ON_P0            0
71         #define PACKET_HAS_MASTER       0
72         #define PACKET_HAS_SLAVE        1
73
74         #define HAS_COMPANION           1
75         #define COMPANION_CS_ON_P1      1
76         #define COMPANION_CS_MASK       0x4     /* CS1 is P1_2 */
77         #define COMPANION_CS            P1_2
78
79         #define AO_LED_RED              1
80         #define LEDS_AVAILABLE          (AO_LED_RED)
81         #define HAS_EXTERNAL_TEMP       0
82         #define HAS_ACCEL_REF           1
83         #define SPI_CS_ON_P1            1
84         #define SPI_CS_ON_P0            0
85         #define M25_CS_MASK             0x02    /* CS0 is P1_1 */
86         #define M25_MAX_CHIPS           1
87         #define HAS_ACCEL               1
88         #define HAS_IGNITE              1
89         #define HAS_MONITOR             0
90 #endif
91
92 #if defined(TELEDONGLE_V_0_2)
93         #define HAS_FLIGHT              0
94         #define HAS_USB                 1
95         #define HAS_BEEP                0
96         #define HAS_SERIAL_1            0
97         #define USE_SERIAL_STDIN        0
98         #define HAS_ADC                 0
99         #define HAS_DBG                 1
100         #define HAS_EEPROM              0
101         #define HAS_LOG                 0
102         #define DBG_ON_P1               1
103         #define DBG_ON_P0               0
104         #define IGNITE_ON_P2            0
105         #define IGNITE_ON_P0            0
106         #define PACKET_HAS_MASTER       1
107         #define PACKET_HAS_SLAVE        0
108         #define AO_LED_RED              1
109         #define AO_LED_GREEN            2
110         #define AO_MONITOR_LED          AO_LED_GREEN
111         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
112         #define SPI_CS_ON_P1            1
113         #define SPI_CS_ON_P0            0
114         #define HAS_IGNITE              0
115         #define HAS_MONITOR             1
116         #define LEGACY_MONITOR          1
117         #define HAS_RSSI                1
118         #define HAS_AES                 1
119 #endif
120
121 #if defined(TELEMINI_V_1_0)
122         #define HAS_FLIGHT              1
123         #define HAS_USB                 0
124         #define HAS_BEEP                0
125         #define HAS_GPS                 0
126         #define HAS_SERIAL_1            0
127         #define USE_SERIAL_STDIN        0
128         #define HAS_ADC                 1
129         #define HAS_EEPROM              1
130         #define HAS_LOG                 1
131         #define USE_INTERNAL_FLASH      1
132         #define HAS_DBG                 0
133         #define IGNITE_ON_P2            0
134         #define IGNITE_ON_P0            1
135         #define PACKET_HAS_MASTER       0
136         #define PACKET_HAS_SLAVE        1
137         #define USE_FAST_ASCENT_LOG     1
138
139         #define AO_LED_GREEN            1
140         #define AO_LED_RED              2
141         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
142         #define HAS_EXTERNAL_TEMP       0
143         #define HAS_ACCEL               0
144         #define HAS_IGNITE              1
145         #define HAS_MONITOR             0
146 #endif
147
148 #if defined(TELENANO_V_0_1)
149         #define HAS_FLIGHT              1
150         #define HAS_USB                 0
151         #define HAS_BEEP                0
152         #define HAS_GPS                 0
153         #define HAS_SERIAL_1            0
154         #define USE_SERIAL_STDIN        0
155         #define HAS_ADC                 1
156         #define HAS_EEPROM              1
157         #define HAS_LOG                 1
158         #define USE_INTERNAL_FLASH      1
159         #define HAS_DBG                 0
160         #define IGNITE_ON_P2            0
161         #define IGNITE_ON_P0            1
162         #define PACKET_HAS_MASTER       0
163         #define PACKET_HAS_SLAVE        1
164
165         #define AO_LED_GREEN            1
166         #define AO_LED_RED              2
167         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
168         #define HAS_EXTERNAL_TEMP       0
169         #define HAS_ACCEL               0
170         #define HAS_IGNITE              0
171         #define HAS_MONITOR             0
172 #endif
173
174 #if defined(TELEMETRUM_V_0_1)
175         #define HAS_FLIGHT              1
176         #define HAS_USB                 1
177         #define HAS_BEEP                1
178         #define HAS_GPS                 1
179         #define HAS_SERIAL_1            1
180         #define USE_SERIAL_STDIN        0
181         #define HAS_ADC                 1
182         #define HAS_DBG                 0
183         #define HAS_EEPROM              1
184         #define HAS_LOG                 1
185         #define USE_INTERNAL_FLASH      0
186         #define DBG_ON_P1               0
187         #define DBG_ON_P0               1
188         #define IGNITE_ON_P2            1
189         #define IGNITE_ON_P0            0
190         #define PACKET_HAS_MASTER       0
191         #define PACKET_HAS_SLAVE        1
192         #define AO_LED_RED              2
193         #define AO_LED_GREEN            1
194         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
195         #define HAS_EXTERNAL_TEMP       1
196         #define HAS_ACCEL_REF           0
197         #define SPI_CS_ON_P1            1
198         #define SPI_CS_ON_P0            0
199         #define HAS_ACCEL               1
200         #define HAS_IGNITE              1
201         #define HAS_MONITOR             0
202         #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX        ((uint32_t) 127 * (uint32_t) 1024)
203 #endif
204
205 #if defined(TELEDONGLE_V_0_1)
206         #define HAS_FLIGHT              0
207         #define HAS_USB                 1
208         #define HAS_BEEP                0
209         #define HAS_SERIAL_1            0
210         #define USE_SERIAL_STDIN        0
211         #define HAS_ADC                 0
212         #define HAS_DBG                 0
213         #define HAS_EEPROM              0
214         #define HAS_LOG                 0
215         #define DBG_ON_P1               0
216         #define DBG_ON_P0               1
217         #define IGNITE_ON_P2            0
218         #define IGNITE_ON_P0            0
219         #define PACKET_HAS_MASTER       1
220         #define PACKET_HAS_SLAVE        0
221         #define AO_LED_RED              2
222         #define AO_LED_GREEN            1
223         #define AO_MONITOR_LED          AO_LED_GREEN
224         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
225         #define SPI_CS_ON_P1            0
226         #define SPI_CS_ON_P0            1
227         #define HAS_IGNITE              0
228         #define HAS_MONITOR             1
229         #define LEGACY_MONITOR          1
230         #define HAS_RSSI                1
231         #define HAS_AES                 1
232 #endif
233
234 #if defined(TIDONGLE)
235         #define HAS_FLIGHT              0
236         #define HAS_USB                 1
237         #define HAS_BEEP                0
238         #define HAS_SERIAL_1            0
239         #define USE_SERIAL_STDIN        0
240         #define HAS_ADC                 0
241         #define HAS_DBG                 1
242         #define HAS_EEPROM              0
243         #define HAS_LOG                 0
244         #define DBG_ON_P1               0
245         #define DBG_ON_P0               1
246         #define IGNITE_ON_P2            0
247         #define IGNITE_ON_P0            0
248         #define PACKET_HAS_MASTER       1
249         #define PACKET_HAS_SLAVE        0
250         #define AO_LED_RED              2
251         #define AO_MONITOR_LED          AO_LED_RED
252         #define LEDS_AVAILABLE          (AO_LED_RED)
253         #define SPI_CS_ON_P1            0
254         #define SPI_CS_ON_P0            1
255         #define HAS_IGNITE              0
256         #define HAS_MONITOR             1
257         #define LEGACY_MONITOR          1
258         #define HAS_RSSI                1
259         #define HAS_AES                 1
260 #endif
261
262 #if defined(TELEBT_V_0_0)
263         #define HAS_FLIGHT              0
264         #define HAS_USB                 1
265         #define HAS_BEEP                0
266         #define HAS_SERIAL_1            1
267         #define USE_SERIAL_STDIN        1
268         #define HAS_ADC                 0
269         #define HAS_DBG                 1
270         #define HAS_EEPROM              0
271         #define HAS_LOG                 0
272         #define HAS_BTM                 1
273         #define DBG_ON_P1               0
274         #define DBG_ON_P0               1
275         #define IGNITE_ON_P2            0
276         #define IGNITE_ON_P0            0
277         #define PACKET_HAS_MASTER       1
278         #define PACKET_HAS_SLAVE        0
279         #define AO_LED_RED              2
280         #define AO_LED_GREEN            1
281         #define AO_MONITOR_LED          AO_LED_RED
282         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
283         #define SPI_CS_ON_P1            1
284         #define SPI_CS_ON_P0            0
285         #define HAS_IGNITE              0
286         #define HAS_IGNITE_REPORT       1
287         #define BT_LINK_ON_P2           1
288         #define BT_LINK_ON_P1           0
289         #define BT_LINK_PIN_INDEX       7
290         #define BT_LINK_PIN             P2_1
291         #define HAS_MONITOR             1
292         #define LEGACY_MONITOR          1
293         #define HAS_RSSI                0
294         #define HAS_AES                 1
295 #endif
296
297 #if defined(TELEBT_V_0_1)
298         #define HAS_FLIGHT              0
299         #define HAS_USB                 1
300         #define HAS_BEEP                1
301         #define HAS_SERIAL_1            1
302         #define HAS_SERIAL_1_ALT_1      1
303         #define HAS_SERIAL_1_ALT_2      0
304         #define HAS_SERIAL_1_HW_FLOW    1
305         #define USE_SERIAL_STDIN        1
306         #define HAS_ADC                 0
307         #define HAS_DBG                 1
308         #define HAS_EEPROM              1
309         #define HAS_LOG                 1
310         #define USE_INTERNAL_FLASH      0
311         #define HAS_BTM                 1
312         #define DBG_ON_P1               1
313         #define DBG_ON_P0               0
314         #define IGNITE_ON_P2            0
315         #define IGNITE_ON_P0            0
316         #define PACKET_HAS_MASTER       1
317         #define PACKET_HAS_SLAVE        0
318         #define AO_LED_RED              1
319         #define AO_LED_GREEN            2
320         #define AO_MONITOR_LED          AO_LED_RED
321         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
322         #define SPI_CS_ON_P1            1
323         #define SPI_CS_ON_P0            0
324         #define M25_CS_MASK             0x04    /* CS0 is P1_2 */
325         #define M25_MAX_CHIPS           1
326         #define HAS_ACCEL               0
327         #define HAS_IGNITE              0
328         #define HAS_IGNITE_REPORT       1
329         #define BT_LINK_ON_P2           0
330         #define BT_LINK_ON_P1           1
331         #define BT_LINK_PIN_INDEX       7
332         #define BT_LINK_PIN             P1_7
333         #define HAS_MONITOR             1
334         #define LEGACY_MONITOR          1
335         #define HAS_RSSI                0
336         #define HAS_AES                 1
337 #endif
338
339 #if defined(TELELAUNCH_V_0_1)
340         #define HAS_FLIGHT              0
341         #define HAS_USB                 1
342         #define HAS_BEEP                1
343         #define HAS_GPS                 0
344         #define HAS_SERIAL_1            1
345         #define USE_SERIAL_STDIN        0
346         #define HAS_ADC                 1
347         #define HAS_DBG                 0
348         #define HAS_EEPROM              1
349         #define HAS_LOG                 0
350         #define USE_INTERNAL_FLASH      1
351         #define DBG_ON_P1               0
352         #define DBG_ON_P0               1
353         #define IGNITE_ON_P2            1
354         #define IGNITE_ON_P0            0
355         #define PACKET_HAS_MASTER       0
356         #define PACKET_HAS_SLAVE        0
357         #define AO_LED_RED              2
358         #define AO_LED_GREEN            1
359         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
360         #define HAS_EXTERNAL_TEMP       1
361         #define HAS_ACCEL_REF           0
362         #define SPI_CS_ON_P1            1
363         #define SPI_CS_ON_P0            0
364         #define HAS_ACCEL               0
365         #define HAS_IGNITE              1
366         #define HAS_MONITOR             0
367         #define HAS_AES                 1
368 #endif
369
370 #if DBG_ON_P1
371
372         #define DBG_CLOCK       (1 << 4)        /* mi0 */
373         #define DBG_DATA        (1 << 5)        /* mo0 */
374         #define DBG_RESET_N     (1 << 3)        /* c0 */
375
376         #define DBG_CLOCK_PIN   (P1_4)
377         #define DBG_DATA_PIN    (P1_5)
378         #define DBG_RESET_N_PIN (P1_3)
379
380         #define DBG_PORT_NUM    1
381         #define DBG_PORT        P1
382         #define DBG_PORT_SEL    P1SEL
383         #define DBG_PORT_INP    P1INP
384         #define DBG_PORT_DIR    P1DIR
385
386 #endif /* DBG_ON_P1 */
387
388 #if DBG_ON_P0
389
390         #define DBG_CLOCK       (1 << 3)
391         #define DBG_DATA        (1 << 4)
392         #define DBG_RESET_N     (1 << 5)
393
394         #define DBG_CLOCK_PIN   (P0_3)
395         #define DBG_DATA_PIN    (P0_4)
396         #define DBG_RESET_N_PIN (P0_5)
397
398         #define DBG_PORT_NUM    0
399         #define DBG_PORT        P0
400         #define DBG_PORT_SEL    P0SEL
401         #define DBG_PORT_INP    P0INP
402         #define DBG_PORT_DIR    P0DIR
403
404 #endif /* DBG_ON_P0 */
405
406 #if COMPANION_CS_ON_P1
407         #define COMPANION_CS_PORT       P1
408         #define COMPANION_CS_SEL        P1SEL
409         #define COMPANION_CS_DIR        P1DIR
410 #endif
411
412 #if SPI_CS_ON_P1
413         #define SPI_CS_PORT     P1
414         #define SPI_CS_SEL      P1SEL
415         #define SPI_CS_DIR      P1DIR
416 #endif
417
418 #if SPI_CS_ON_P0
419         #define SPI_CS_PORT     P0
420         #define SPI_CS_SEL      P0SEL
421         #define SPI_CS_DIR      P0DIR
422 #endif
423
424 #ifndef IGNITE_ON_P2
425 #error Please define IGNITE_ON_P2
426 #endif
427
428 #ifndef IGNITE_ON_P0
429 #error Please define IGNITE_ON_P0
430 #endif
431
432 #ifndef HAS_SERIAL_1
433 #error Please define HAS_SERIAL_1
434 #endif
435
436 #ifndef USE_SERIAL_STDIN
437 #error Please define USE_SERIAL_STDIN
438 #endif
439
440 #ifndef HAS_ADC
441 #error Please define HAS_ADC
442 #endif
443
444 #ifndef HAS_EEPROM
445 #error Please define HAS_EEPROM
446 #endif
447
448 #ifndef HAS_LOG
449 #error Please define HAS_LOG
450 #endif
451
452 #if HAS_EEPROM
453 #ifndef USE_INTERNAL_FLASH
454 #error Please define USE_INTERNAL_FLASH
455 #endif
456 #endif
457
458 #ifndef HAS_DBG
459 #error Please define HAS_DBG
460 #endif
461
462 #ifndef HAS_IGNITE
463 #error Please define HAS_IGNITE
464 #endif
465
466 #if HAS_IGNITE
467 #define HAS_IGNITE_REPORT 1
468 #endif
469
470 #ifndef PACKET_HAS_MASTER
471 #error Please define PACKET_HAS_MASTER
472 #endif
473
474 #ifndef PACKET_HAS_SLAVE
475 #error Please define PACKET_HAS_SLAVE
476 #endif
477
478 #ifndef HAS_MONITOR
479 #error Please define HAS_MONITOR
480 #endif
481
482 #if HAS_MONITOR
483 #ifndef HAS_RSSI
484 #error Please define HAS_RSSI
485 #endif
486 #endif
487
488 #ifndef HAS_ADC
489 #error Please define HAS_ADC
490 #endif
491
492 #if HAS_ADC
493
494 #if HAS_ACCEL
495 #ifndef HAS_ACCEL_REF
496 #error Please define HAS_ACCEL_REF
497 #endif
498 #else
499 #define HAS_ACCEL_REF 0
500 #endif
501
502 #endif /* HAS_ADC */
503
504 #if IGNITE_ON_P2
505 #define AO_IGNITER_DROGUE       P2_3
506 #define AO_IGNITER_MAIN         P2_4
507 #define AO_IGNITER_DIR          P2DIR
508 #define AO_IGNITER_DROGUE_BIT   (1 << 3)
509 #define AO_IGNITER_MAIN_BIT     (1 << 4)
510 #endif
511
512 #if IGNITE_ON_P0
513 #define AO_IGNITER_DROGUE       P0_5
514 #define AO_IGNITER_MAIN         P0_4
515 #define AO_IGNITER_DIR          P0DIR
516 #define AO_IGNITER_DROGUE_BIT   (1 << 5)
517 #define AO_IGNITER_MAIN_BIT     (1 << 4)
518 #endif
519
520 /* test these values with real igniters */
521 #define AO_IGNITER_OPEN         1000
522 #define AO_IGNITER_CLOSED       7000
523 #define AO_IGNITER_FIRE_TIME    AO_MS_TO_TICKS(50)
524 #define AO_IGNITER_CHARGE_TIME  AO_MS_TO_TICKS(2000)
525
526 #endif /* _AO_PINS_H_ */