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