Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos] / src / core / ao_flight.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_FLIGHT_H_
19 #define _AO_FLIGHT_H_
20
21
22 /*
23  * ao_flight.c
24  */
25
26 enum ao_flight_state {
27         ao_flight_startup = 0,
28         ao_flight_idle = 1,
29         ao_flight_pad = 2,
30         ao_flight_boost = 3,
31         ao_flight_fast = 4,
32         ao_flight_coast = 5,
33         ao_flight_drogue = 6,
34         ao_flight_main = 7,
35         ao_flight_landed = 8,
36         ao_flight_invalid = 9,
37         ao_flight_test = 10
38 };
39
40 extern __pdata enum ao_flight_state     ao_flight_state;
41 extern __pdata uint16_t                 ao_boost_tick;
42 extern __pdata uint16_t                 ao_motor_number;
43
44 #if HAS_IMU
45 extern __xdata uint8_t                  ao_sensor_errors;
46 #endif
47
48 extern __pdata uint16_t                 ao_launch_time;
49 extern __pdata uint8_t                  ao_flight_force_idle;
50
51 /* Flight thread */
52 void
53 ao_flight(void);
54
55 /* Initialize flight thread */
56 void
57 ao_flight_init(void);
58
59 /*
60  * ao_flight_nano.c
61  */
62
63 void
64 ao_flight_nano_init(void);
65
66 #endif /* _AO_FLIGHT_H_ */