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