Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mcu.c
Go to the documentation of this file.
1 /*
2  * Paparazzi microcontroller initialisation function
3  *
4  * Copyright (C) 2010 The Paparazzi team
5  *
6  * This file is part of Paparazzi.
7  *
8  * Paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * Paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
25 #include "mcu.h"
26 
27 #ifdef PERIPHERALS_AUTO_INIT
28 #include "mcu_periph/sys_time.h"
29 #ifdef USE_LED
30 #include "led.h"
31 #endif
32 #if defined RADIO_CONTROL
33 #if defined RADIO_CONTROL_LINK || defined RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT
35 #endif
36 #endif
37 #if defined USE_UART0 || defined USE_UART1 || defined USE_UART2 || defined USE_UART3 || defined USE_UART4 || defined USE_UART5
38 #include "mcu_periph/uart.h"
39 #endif
40 #if defined USE_I2C0 || defined USE_I2C1 || defined USE_I2C2
41 #include "mcu_periph/i2c.h"
42 #endif
43 #if defined USE_ADC
44 #include "mcu_periph/adc.h"
45 #endif
46 #ifdef USE_USB_SERIAL
47 #include "mcu_periph/usb_serial.h"
48 #endif
49 #ifdef USE_SPI
50 #include "mcu_periph/spi.h"
51 #endif
52 #ifdef USE_DAC
53 #include "mcu_periph/dac.h"
54 #endif
55 #endif /* PERIPHERALS_AUTO_INIT */
56 
57 void mcu_init(void) {
58 
59  mcu_arch_init();
60 
61 #ifdef PERIPHERALS_AUTO_INIT
62  sys_time_init();
63 #ifdef USE_LED
64  led_init();
65 #endif
66  /* for now this means using spektrum */
67 #if defined RADIO_CONTROL & defined RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT & defined RADIO_CONTROL_BIND_IMPL_FUNC
68  RADIO_CONTROL_BIND_IMPL_FUNC();
69 #endif
70 #ifdef USE_UART0
71  uart0_init();
72 #endif
73 #ifdef USE_UART1
74  uart1_init();
75 #endif
76 #ifdef USE_UART2
77  uart2_init();
78 #endif
79 #ifdef USE_UART3
80  uart3_init();
81 #endif
82 #ifdef USE_UART4
83  uart4_init();
84 #endif
85 #ifdef USE_UART5
86  uart5_init();
87 #endif
88 #ifdef USE_I2C0
89  i2c0_init();
90 #endif
91 #ifdef USE_I2C1
92  i2c1_init();
93 #endif
94 #ifdef USE_I2C2
95  i2c2_init();
96 #endif
97 #ifdef USE_ADC
98  adc_init();
99 #endif
100 #ifdef USE_USB_SERIAL
101  VCOM_init();
102 #endif
103 #ifdef USE_SPI
104  spi_init();
105 #endif
106 #ifdef USE_DAC
107  dac_init();
108 #endif
109 #endif /* PERIPHERALS_AUTO_INIT */
110 
111 }
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
arch independent ADC (Analog to Digital Converter) API
arch independent SPI (Serial Peripheral Interface) API
void spi_init(void)
Definition: spi_arch.c:3
Architecture independent timing functions.
void VCOM_init(void)
static void led_init(void)
Definition: led.h:86
void sys_time_init(void)
Definition: sys_time.c:69
arch independent mcu ( Micro Controller Unit ) utilities
void adc_init(void)
Starts conversions.
Definition: adc_arch.c:189
arch independent LED (Light Emitting Diodes) API
void dac_init(void)
Definition: dac_arch.c:4
void mcu_arch_init(void)
Definition: mcu_arch.c:36
void mcu_init(void)
Definition: mcu.c:57
arch independent USB API