altos/test: Adjust CRC error rate after FEC fix
[fw/altos] / src / telemini-v3.0 / ao_telemini.c
1 /*
2  * Copyright © 2017 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 #include <ao.h>
20 #include <ao_exti.h>
21
22 #if HAS_FORCE_FREQ
23 static void
24 ao_check_recovery(void)
25 {
26         int     i;
27         ao_enable_input(AO_RECOVERY_PORT, AO_RECOVERY_PIN, AO_RECOVERY_MODE);
28         for (i = 0; i < 100; i++)
29                 ao_arch_nop();
30         if (ao_gpio_get(AO_RECOVERY_PORT, AO_RECOVERY_PIN) == AO_RECOVERY_VALUE) {
31                 ao_flight_force_idle = 1;
32                 ao_force_freq = 1;
33         }
34         ao_gpio_set_mode(AO_RECOVERY_PORT, AO_RECOVERY_PIN, 0);
35         ao_disable_port(AO_RECOVERY_PORT);
36 }
37 #endif
38
39 int
40 main(void)
41 {
42 #if HAS_FORCE_FREQ
43         ao_check_recovery();
44 #endif
45
46         ao_clock_init();
47         ao_task_init();
48         ao_timer_init();
49
50         ao_dma_init();
51         ao_spi_init();
52         ao_exti_init();
53
54         ao_adc_init();
55
56 #if HAS_BEEP
57         ao_beep_init();
58 #endif
59 #if HAS_SERIAL_1
60         ao_serial_init();
61 #endif
62 #if HAS_USB
63         ao_usb_init();
64 #endif
65         ao_cmd_init();
66
67         ao_ms5607_init();
68
69         ao_storage_init();
70         ao_flight_init();
71         ao_log_init();
72         ao_report_init();
73         ao_telemetry_init();
74         ao_radio_init();
75         ao_packet_slave_init(true);
76         ao_igniter_init();
77         ao_config_init();
78
79         ao_start_scheduler();
80 }