add static test start and stop commands to radio protocol for telefiretwo
[fw/altos] / src / drivers / ao_pad.h
1 /*
2  * Copyright © 2012 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; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18
19 #ifndef _AO_PAD_H_
20 #define _AO_PAD_H_
21
22 #define AO_PAD_MAX_CHANNELS     8
23 #define AO_PAD_MAX_BOXES        100
24
25 struct ao_pad_command {
26         uint16_t        tick;
27         uint16_t        box;
28         uint8_t         cmd;
29         uint8_t         channels;
30 };
31
32 /* Report current telefire status.
33  */
34
35 #define AO_PAD_QUERY            1
36
37 struct ao_pad_query {
38         uint16_t        tick;           /* telefire tick */
39         uint16_t        box;            /* telefire box number */
40         uint8_t         channels;       /* which chanels are present */
41         uint8_t         armed;          /* which channels are armed */
42         uint8_t         arm_status;     /* status of arming switch */
43         uint8_t         battery;        /* battery voltage in decivolts */
44         uint8_t         igniter_status[AO_PAD_MAX_CHANNELS];    /* status for each igniter */
45 };
46
47 /* Arm pads for 3 seconds, no report
48  */
49 #define AO_PAD_ARM              2
50
51 #define AO_PAD_ARM_TIME         AO_SEC_TO_TICKS(3)
52
53 /* Fire current armed pads for 200ms, no report
54  */
55 #define AO_PAD_FIRE             3
56
57 /* Fire current armed pads for 200ms, no report, logging test stand sensors
58  */
59 #define AO_PAD_STATIC           4
60 #define AO_PAD_ENDSTATIC        5
61
62 #define AO_PAD_FIRE_TIME        AO_MS_TO_TICKS(200)
63
64 #define AO_PAD_ARM_STATUS_DISARMED      0
65 #define AO_PAD_ARM_STATUS_ARMED         1
66 #define AO_PAD_ARM_STATUS_UNKNOWN       2
67
68 #define AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN     0
69 #define AO_PAD_IGNITER_STATUS_GOOD_IGNITER_RELAY_OPEN   1
70 #define AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_CLOSED   2
71 #define AO_PAD_IGNITER_STATUS_UNKNOWN                   3
72
73 void
74 ao_pad_init(void);
75
76 void
77 ao_pad_disable(void);
78
79 void
80 ao_pad_enable(void);
81
82 #endif /* _AO_PAD_H_ */