01d21c119538701bccb08de33df65c93180e9ae1
[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 || HAS_MMA655X
45 #define HAS_SENSOR_ERRORS       1
46 #endif
47
48 #if HAS_SENSOR_ERRORS
49 extern __xdata uint8_t                  ao_sensor_errors;
50 #endif
51
52 extern __pdata uint16_t                 ao_launch_time;
53 extern __pdata uint8_t                  ao_flight_force_idle;
54
55 /* Flight thread */
56 void
57 ao_flight(void);
58
59 /* Initialize flight thread */
60 void
61 ao_flight_init(void);
62
63 /*
64  * ao_flight_nano.c
65  */
66
67 void
68 ao_flight_nano_init(void);
69
70 #endif /* _AO_FLIGHT_H_ */