altos: move igniter defines back to ao_pins.h
[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
40         #define HAS_COMPANION           1
41         #define COMPANION_CS_ON_P1      1
42         #define COMPANION_CS_MASK       0x4     /* CS1 is P1_2 */
43         #define COMPANION_CS            P1_2
44
45         #define AO_LED_RED              1
46         #define LEDS_AVAILABLE          (AO_LED_RED)
47         #define HAS_EXTERNAL_TEMP       0
48         #define HAS_ACCEL_REF           0
49         #define HAS_ACCEL               1
50         #define HAS_IGNITE              1
51         #define HAS_MONITOR             0
52 #endif
53
54 #if defined(TELEMETRUM_V_1_1)
55         #define HAS_FLIGHT              1
56         #define HAS_USB                 1
57         #define HAS_BEEP                1
58         #define HAS_GPS                 1
59         #define HAS_SERIAL_1            1
60         #define USE_SERIAL_STDIN        0
61         #define HAS_ADC                 1
62         #define HAS_EEPROM              1
63         #define HAS_LOG                 1
64         #define USE_INTERNAL_FLASH      0
65         #define HAS_DBG                 1
66         #define DBG_ON_P1               1
67         #define DBG_ON_P0               0
68         #define IGNITE_ON_P2            1
69         #define IGNITE_ON_P0            0
70         #define PACKET_HAS_MASTER       0
71         #define PACKET_HAS_SLAVE        1
72
73         #define HAS_COMPANION           1
74         #define COMPANION_CS_ON_P1      1
75         #define COMPANION_CS_MASK       0x4     /* CS1 is P1_2 */
76         #define COMPANION_CS            P1_2
77
78         #define AO_LED_RED              1
79         #define LEDS_AVAILABLE          (AO_LED_RED)
80         #define HAS_EXTERNAL_TEMP       0
81         #define HAS_ACCEL_REF           1
82         #define SPI_CS_ON_P1            1
83         #define SPI_CS_ON_P0            0
84         #define M25_CS_MASK             0x02    /* CS0 is P1_1 */
85         #define M25_MAX_CHIPS           1
86         #define HAS_ACCEL               1
87         #define HAS_IGNITE              1
88         #define HAS_MONITOR             0
89 #endif
90
91 #if defined(TELEDONGLE_V_0_2)
92         #define HAS_FLIGHT              0
93         #define HAS_USB                 1
94         #define HAS_BEEP                0
95         #define HAS_SERIAL_1            0
96         #define USE_SERIAL_STDIN        0
97         #define HAS_ADC                 0
98         #define HAS_DBG                 1
99         #define HAS_EEPROM              0
100         #define HAS_LOG                 0
101         #define DBG_ON_P1               1
102         #define DBG_ON_P0               0
103         #define IGNITE_ON_P2            0
104         #define IGNITE_ON_P0            0
105         #define PACKET_HAS_MASTER       1
106         #define PACKET_HAS_SLAVE        0
107         #define AO_LED_RED              1
108         #define AO_LED_GREEN            2
109         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
110         #define SPI_CS_ON_P1            1
111         #define SPI_CS_ON_P0            0
112         #define HAS_IGNITE              0
113         #define HAS_MONITOR             1
114         #define HAS_AES                 1
115 #endif
116
117 #if defined(TELEMINI_V_1_0)
118         #define HAS_FLIGHT              1
119         #define HAS_USB                 0
120         #define HAS_BEEP                0
121         #define HAS_GPS                 0
122         #define HAS_SERIAL_1            0
123         #define USE_SERIAL_STDIN        0
124         #define HAS_ADC                 1
125         #define HAS_EEPROM              1
126         #define HAS_LOG                 1
127         #define USE_INTERNAL_FLASH      1
128         #define HAS_DBG                 0
129         #define IGNITE_ON_P2            0
130         #define IGNITE_ON_P0            1
131         #define PACKET_HAS_MASTER       0
132         #define PACKET_HAS_SLAVE        1
133         #define USE_FAST_ASCENT_LOG     1
134
135         #define AO_LED_GREEN            1
136         #define AO_LED_RED              2
137         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
138         #define HAS_EXTERNAL_TEMP       0
139         #define HAS_ACCEL               0
140         #define HAS_IGNITE              1
141         #define HAS_MONITOR             0
142 #endif
143
144 #if defined(TELENANO_V_0_1)
145         #define HAS_FLIGHT              1
146         #define HAS_USB                 0
147         #define HAS_BEEP                0
148         #define HAS_GPS                 0
149         #define HAS_SERIAL_1            0
150         #define USE_SERIAL_STDIN        0
151         #define HAS_ADC                 1
152         #define HAS_EEPROM              1
153         #define HAS_LOG                 1
154         #define USE_INTERNAL_FLASH      1
155         #define HAS_DBG                 0
156         #define IGNITE_ON_P2            0
157         #define IGNITE_ON_P0            1
158         #define PACKET_HAS_MASTER       0
159         #define PACKET_HAS_SLAVE        1
160
161         #define AO_LED_GREEN            1
162         #define AO_LED_RED              2
163         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
164         #define HAS_EXTERNAL_TEMP       0
165         #define HAS_ACCEL               0
166         #define HAS_IGNITE              0
167         #define HAS_MONITOR             0
168 #endif
169
170 #if defined(TELEMETRUM_V_0_1)
171         #define HAS_FLIGHT              1
172         #define HAS_USB                 1
173         #define HAS_BEEP                1
174         #define HAS_GPS                 1
175         #define HAS_SERIAL_1            1
176         #define USE_SERIAL_STDIN        0
177         #define HAS_ADC                 1
178         #define HAS_DBG                 0
179         #define HAS_EEPROM              1
180         #define HAS_LOG                 1
181         #define USE_INTERNAL_FLASH      0
182         #define DBG_ON_P1               0
183         #define DBG_ON_P0               1
184         #define IGNITE_ON_P2            1
185         #define IGNITE_ON_P0            0
186         #define PACKET_HAS_MASTER       0
187         #define PACKET_HAS_SLAVE        1
188         #define AO_LED_RED              2
189         #define AO_LED_GREEN            1
190         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
191         #define HAS_EXTERNAL_TEMP       1
192         #define HAS_ACCEL_REF           0
193         #define SPI_CS_ON_P1            1
194         #define SPI_CS_ON_P0            0
195         #define HAS_ACCEL               1
196         #define HAS_IGNITE              1
197         #define HAS_MONITOR             0
198 #endif
199
200 #if defined(TELEDONGLE_V_0_1)
201         #define HAS_FLIGHT              0
202         #define HAS_USB                 1
203         #define HAS_BEEP                0
204         #define HAS_SERIAL_1            0
205         #define USE_SERIAL_STDIN        0
206         #define HAS_ADC                 0
207         #define HAS_DBG                 0
208         #define HAS_EEPROM              0
209         #define HAS_LOG                 0
210         #define DBG_ON_P1               0
211         #define DBG_ON_P0               1
212         #define IGNITE_ON_P2            0
213         #define IGNITE_ON_P0            0
214         #define PACKET_HAS_MASTER       1
215         #define PACKET_HAS_SLAVE        0
216         #define AO_LED_RED              2
217         #define AO_LED_GREEN            1
218         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
219         #define SPI_CS_ON_P1            0
220         #define SPI_CS_ON_P0            1
221         #define HAS_IGNITE              0
222         #define HAS_MONITOR             1
223         #define HAS_AES                 1
224 #endif
225
226 #if defined(TIDONGLE)
227         #define HAS_FLIGHT              0
228         #define HAS_USB                 1
229         #define HAS_BEEP                0
230         #define HAS_SERIAL_1            0
231         #define USE_SERIAL_STDIN        0
232         #define HAS_ADC                 0
233         #define HAS_DBG                 1
234         #define HAS_EEPROM              0
235         #define HAS_LOG                 0
236         #define DBG_ON_P1               0
237         #define DBG_ON_P0               1
238         #define IGNITE_ON_P2            0
239         #define IGNITE_ON_P0            0
240         #define PACKET_HAS_MASTER       1
241         #define PACKET_HAS_SLAVE        0
242         #define AO_LED_RED              2
243         #define LEDS_AVAILABLE          (AO_LED_RED)
244         #define SPI_CS_ON_P1            0
245         #define SPI_CS_ON_P0            1
246         #define HAS_IGNITE              0
247         #define HAS_MONITOR             1
248         #define HAS_AES                 1
249 #endif
250
251 #if defined(TELEBT_V_0_0)
252         #define HAS_FLIGHT              0
253         #define HAS_USB                 1
254         #define HAS_BEEP                0
255         #define HAS_SERIAL_1            1
256         #define USE_SERIAL_STDIN        1
257         #define HAS_ADC                 0
258         #define HAS_DBG                 1
259         #define HAS_EEPROM              0
260         #define HAS_LOG                 0
261         #define HAS_BTM                 1
262         #define DBG_ON_P1               0
263         #define DBG_ON_P0               1
264         #define IGNITE_ON_P2            0
265         #define IGNITE_ON_P0            0
266         #define PACKET_HAS_MASTER       1
267         #define PACKET_HAS_SLAVE        0
268         #define AO_LED_RED              2
269         #define AO_LED_GREEN            1
270         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
271         #define SPI_CS_ON_P1            1
272         #define SPI_CS_ON_P0            0
273         #define HAS_IGNITE              0
274         #define BT_LINK_ON_P2           1
275         #define BT_LINK_ON_P1           0
276         #define BT_LINK_PIN_INDEX       7
277         #define BT_LINK_PIN             P2_1
278         #define HAS_MONITOR             1
279         #define HAS_AES                 1
280 #endif
281
282 #if defined(TELEBT_V_0_1)
283         #define HAS_FLIGHT              0
284         #define HAS_USB                 1
285         #define HAS_BEEP                1
286         #define HAS_SERIAL_1            1
287         #define HAS_SERIAL_1_ALT_1      1
288         #define HAS_SERIAL_1_ALT_2      0
289         #define HAS_SERIAL_1_HW_FLOW    1
290         #define USE_SERIAL_STDIN        1
291         #define HAS_ADC                 0
292         #define HAS_DBG                 1
293         #define HAS_EEPROM              1
294         #define HAS_LOG                 1
295         #define USE_INTERNAL_FLASH      0
296         #define HAS_BTM                 1
297         #define DBG_ON_P1               1
298         #define DBG_ON_P0               0
299         #define IGNITE_ON_P2            0
300         #define IGNITE_ON_P0            0
301         #define PACKET_HAS_MASTER       1
302         #define PACKET_HAS_SLAVE        0
303         #define AO_LED_RED              1
304         #define AO_LED_GREEN            2
305         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
306         #define SPI_CS_ON_P1            1
307         #define SPI_CS_ON_P0            0
308         #define M25_CS_MASK             0x04    /* CS0 is P1_2 */
309         #define M25_MAX_CHIPS           1
310         #define HAS_ACCEL               0
311         #define HAS_IGNITE              0
312         #define BT_LINK_ON_P2           0
313         #define BT_LINK_ON_P1           1
314         #define BT_LINK_PIN_INDEX       7
315         #define BT_LINK_PIN             P1_7
316         #define HAS_MONITOR             1
317         #define HAS_AES                 1
318 #endif
319
320 #if defined(TELELAUNCH_V_0_1)
321         #define HAS_FLIGHT              0
322         #define HAS_USB                 1
323         #define HAS_BEEP                1
324         #define HAS_GPS                 0
325         #define HAS_SERIAL_1            1
326         #define USE_SERIAL_STDIN        0
327         #define HAS_ADC                 1
328         #define HAS_DBG                 0
329         #define HAS_EEPROM              1
330         #define HAS_LOG                 0
331         #define USE_INTERNAL_FLASH      1
332         #define DBG_ON_P1               0
333         #define DBG_ON_P0               1
334         #define IGNITE_ON_P2            1
335         #define IGNITE_ON_P0            0
336         #define PACKET_HAS_MASTER       0
337         #define PACKET_HAS_SLAVE        0
338         #define AO_LED_RED              2
339         #define AO_LED_GREEN            1
340         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
341         #define HAS_EXTERNAL_TEMP       1
342         #define HAS_ACCEL_REF           0
343         #define SPI_CS_ON_P1            1
344         #define SPI_CS_ON_P0            0
345         #define HAS_ACCEL               0
346         #define HAS_IGNITE              1
347         #define HAS_MONITOR             0
348         #define HAS_AES                 1
349 #endif
350
351 #if DBG_ON_P1
352
353         #define DBG_CLOCK       (1 << 4)        /* mi0 */
354         #define DBG_DATA        (1 << 5)        /* mo0 */
355         #define DBG_RESET_N     (1 << 3)        /* c0 */
356
357         #define DBG_CLOCK_PIN   (P1_4)
358         #define DBG_DATA_PIN    (P1_5)
359         #define DBG_RESET_N_PIN (P1_3)
360
361         #define DBG_PORT_NUM    1
362         #define DBG_PORT        P1
363         #define DBG_PORT_SEL    P1SEL
364         #define DBG_PORT_INP    P1INP
365         #define DBG_PORT_DIR    P1DIR
366
367 #endif /* DBG_ON_P1 */
368
369 #if DBG_ON_P0
370
371         #define DBG_CLOCK       (1 << 3)
372         #define DBG_DATA        (1 << 4)
373         #define DBG_RESET_N     (1 << 5)
374
375         #define DBG_CLOCK_PIN   (P0_3)
376         #define DBG_DATA_PIN    (P0_4)
377         #define DBG_RESET_N_PIN (P0_5)
378
379         #define DBG_PORT_NUM    0
380         #define DBG_PORT        P0
381         #define DBG_PORT_SEL    P0SEL
382         #define DBG_PORT_INP    P0INP
383         #define DBG_PORT_DIR    P0DIR
384
385 #endif /* DBG_ON_P0 */
386
387 #if COMPANION_CS_ON_P1
388         #define COMPANION_CS_PORT       P1
389         #define COMPANION_CS_SEL        P1SEL
390         #define COMPANION_CS_DIR        P1DIR
391 #endif
392
393 #if SPI_CS_ON_P1
394         #define SPI_CS_PORT     P1
395         #define SPI_CS_SEL      P1SEL
396         #define SPI_CS_DIR      P1DIR
397 #endif
398
399 #if SPI_CS_ON_P0
400         #define SPI_CS_PORT     P0
401         #define SPI_CS_SEL      P0SEL
402         #define SPI_CS_DIR      P0DIR
403 #endif
404
405 #ifndef IGNITE_ON_P2
406 #error Please define IGNITE_ON_P2
407 #endif
408
409 #ifndef IGNITE_ON_P0
410 #error Please define IGNITE_ON_P0
411 #endif
412
413 #ifndef HAS_SERIAL_1
414 #error Please define HAS_SERIAL_1
415 #endif
416
417 #ifndef USE_SERIAL_STDIN
418 #error Please define USE_SERIAL_STDIN
419 #endif
420
421 #ifndef HAS_ADC
422 #error Please define HAS_ADC
423 #endif
424
425 #ifndef HAS_EEPROM
426 #error Please define HAS_EEPROM
427 #endif
428
429 #ifndef HAS_LOG
430 #error Please define HAS_LOG
431 #endif
432
433 #if HAS_EEPROM
434 #ifndef USE_INTERNAL_FLASH
435 #error Please define USE_INTERNAL_FLASH
436 #endif
437 #endif
438
439 #ifndef HAS_DBG
440 #error Please define HAS_DBG
441 #endif
442
443 #ifndef HAS_IGNITE
444 #error Please define HAS_IGNITE
445 #endif
446
447 #ifndef PACKET_HAS_MASTER
448 #error Please define PACKET_HAS_MASTER
449 #endif
450
451 #ifndef PACKET_HAS_SLAVE
452 #error Please define PACKET_HAS_SLAVE
453 #endif
454
455 #ifndef HAS_MONITOR
456 #error Please define HAS_MONITOR
457 #endif
458
459 #ifndef HAS_ADC
460 #error Please define HAS_ADC
461 #endif
462
463 #if HAS_ADC
464
465 #if HAS_ACCEL
466 #ifndef HAS_ACCEL_REF
467 #error Please define HAS_ACCEL_REF
468 #endif
469 #else
470 #define HAS_ACCEL_REF 0
471 #endif
472
473 #endif /* HAS_ADC */
474
475 #if IGNITE_ON_P2
476 #define AO_IGNITER_DROGUE       P2_3
477 #define AO_IGNITER_MAIN         P2_4
478 #define AO_IGNITER_DIR          P2DIR
479 #define AO_IGNITER_DROGUE_BIT   (1 << 3)
480 #define AO_IGNITER_MAIN_BIT     (1 << 4)
481 #endif
482
483 #if IGNITE_ON_P0
484 #define AO_IGNITER_DROGUE       P0_5
485 #define AO_IGNITER_MAIN         P0_4
486 #define AO_IGNITER_DIR          P0DIR
487 #define AO_IGNITER_DROGUE_BIT   (1 << 5)
488 #define AO_IGNITER_MAIN_BIT     (1 << 4)
489 #endif
490
491 /* test these values with real igniters */
492 #define AO_IGNITER_OPEN         1000
493 #define AO_IGNITER_CLOSED       7000
494 #define AO_IGNITER_FIRE_TIME    AO_MS_TO_TICKS(50)
495 #define AO_IGNITER_CHARGE_TIME  AO_MS_TO_TICKS(2000)
496
497 #endif /* _AO_PINS_H_ */