2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
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.
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.
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.
20 #include <ao_micropeak.h>
21 #include <ao_ms5607.h>
22 #include <ao_log_micro.h>
25 static struct ao_ms5607_value value;
27 alt_t ground_alt, max_alt;
33 ao_ms5607_sample(&ao_ms5607_current);
34 ao_ms5607_convert(&ao_ms5607_current, &value);
39 ao_compute_height(void)
41 ground_alt = ao_pa_to_altitude(pa_ground);
42 max_alt = ao_pa_to_altitude(pa_min);
43 ao_max_height = max_alt - ground_alt;
50 for (i = 0; i < 10; i++) {
51 ao_led_toggle(AO_LED_REPORT);
52 ao_delay(AO_MS_TO_TICKS(80));
54 ao_delay(AO_MS_TO_TICKS(200));
63 /* Init external hardware */
68 /* Give the person a second to get their finger out of the way */
69 ao_delay(AO_MS_TO_TICKS(1000));
71 ao_log_micro_restore();
77 ao_delay(BOOST_DELAY);
87 set_sleep_mode(SLEEP_MODE_PWR_DOWN);