altos: Make sure we don't beep out continuity twice in idle mode
[fw/altos] / src / kernel / ao_pyro.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; 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_PYRO_H_
19 #define _AO_PYRO_H_
20
21 enum ao_pyro_flag {
22         ao_pyro_none                    = 0x00000000,
23
24         ao_pyro_accel_less              = 0x00000001,
25         ao_pyro_accel_greater           = 0x00000002,
26
27         ao_pyro_speed_less              = 0x00000004,
28         ao_pyro_speed_greater           = 0x00000008,
29
30         ao_pyro_height_less             = 0x00000010,
31         ao_pyro_height_greater          = 0x00000020,
32
33         ao_pyro_orient_less             = 0x00000040,
34         ao_pyro_orient_greater          = 0x00000080,
35
36         ao_pyro_time_less               = 0x00000100,
37         ao_pyro_time_greater            = 0x00000200,
38
39         ao_pyro_ascending               = 0x00000400,
40         ao_pyro_descending              = 0x00000800,
41
42         ao_pyro_after_motor             = 0x00001000,
43
44         ao_pyro_delay                   = 0x00002000,
45
46         ao_pyro_state_less              = 0x00004000,
47         ao_pyro_state_greater_or_equal  = 0x00008000,
48 }
49 #ifdef __GNUC__
50         __attribute__ ((packed))
51 #endif
52         ;
53
54 struct ao_pyro {
55         enum ao_pyro_flag       flags;
56         int16_t                 accel_less, accel_greater;
57         int16_t                 speed_less, speed_greater;
58         int16_t                 height_less, height_greater;
59         int16_t                 orient_less, orient_greater;
60         int16_t                 time_less, time_greater;
61         int16_t                 delay;
62         uint8_t                 state_less, state_greater_or_equal;
63         int16_t                 motor;
64         uint16_t                delay_done;
65         uint8_t                 fired;
66 };
67
68 #define AO_PYRO_8_BIT_VALUE     (ao_pyro_state_less|ao_pyro_state_greater_or_equal)
69
70 extern uint8_t  ao_pyro_wakeup;
71
72 extern uint16_t ao_pyro_fired;
73
74 void
75 ao_pyro_set(void);
76
77 void
78 ao_pyro_show(void);
79
80 void
81 ao_pyro_init(void);
82
83 void
84 ao_pyro_manual(uint8_t p);
85
86 enum ao_igniter_status
87 ao_pyro_status(uint8_t p);
88
89 void
90 ao_pyro_print_status(void);
91
92 #endif