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