Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
lia_1.1.h
Go to the documentation of this file.
1 #ifndef CONFIG_LIA_1_1_H
2 #define CONFIG_LIA_1_1_H
3 
4 #include "boards/lisa_m_common.h"
5 
6 #define BOARD_LIA
7 
8 /* Lisa/M has a 12MHz external clock and 72MHz internal. */
9 #define EXT_CLK 12000000
10 #define AHB_CLK 72000000
11 
12 /*
13  * Onboard LEDs
14  */
15 
16 /* red, on PA8 */
17 #ifndef USE_LED_1
18 #define USE_LED_1 1
19 #endif
20 #define LED_1_GPIO GPIOA
21 #define LED_1_GPIO_CLK RCC_APB2ENR_IOPAEN
22 #define LED_1_GPIO_PIN GPIO8
23 #define LED_1_GPIO_ON gpio_clear
24 #define LED_1_GPIO_OFF gpio_set
25 #define LED_1_AFIO_REMAP ((void)0)
26 
27 /* green, shared with JTAG_TRST */
28 #ifndef USE_LED_2
29 #define USE_LED_2 1
30 #endif
31 #define LED_2_GPIO GPIOB
32 #define LED_2_GPIO_CLK RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN
33 #define LED_2_GPIO_PIN GPIO4
34 #define LED_2_GPIO_ON gpio_clear
35 #define LED_2_GPIO_OFF gpio_set
36 #define LED_2_AFIO_REMAP AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST
37 
38 /* green, shared with ADC12 (ADC_6 on connector ANALOG2) */
39 #ifndef USE_LED_3
40 #define USE_LED_3 1
41 #endif
42 #define LED_3_GPIO GPIOC
43 #define LED_3_GPIO_CLK RCC_APB2ENR_IOPCEN
44 #define LED_3_GPIO_PIN GPIO2
45 #define LED_3_GPIO_ON gpio_clear
46 #define LED_3_GPIO_OFF gpio_set
47 #define LED_3_AFIO_REMAP ((void)0)
48 
49 /* red, shared with ADC15 (ADC_4 on connector ANALOG2) */
50 #ifndef USE_LED_4
51 #define USE_LED_4 1
52 #endif
53 #define LED_4_GPIO GPIOC
54 #define LED_4_GPIO_CLK RCC_APB2ENR_IOPCEN
55 #define LED_4_GPIO_PIN GPIO5
56 #define LED_4_GPIO_ON gpio_clear
57 #define LED_4_GPIO_OFF gpio_set
58 #define LED_4_AFIO_REMAP ((void)0)
59 
60 /* green, on PC15 */
61 #ifndef USE_LED_5
62 #define USE_LED_5 1
63 #endif
64 #define LED_5_GPIO GPIOC
65 #define LED_5_GPIO_CLK RCC_APB2ENR_IOPCEN
66 #define LED_5_GPIO_PIN GPIO15
67 #define LED_5_GPIO_ON gpio_clear
68 #define LED_5_GPIO_OFF gpio_set
69 #define LED_5_AFIO_REMAP ((void)0)
70 
71 /*
72  * LEDs not populated by default
73  */
74 /* PC3, ADC13 on ADC_1 */
75 #define LED_6_GPIO GPIOC
76 #define LED_6_GPIO_CLK RCC_APB2ENR_IOPCEN
77 #define LED_6_GPIO_PIN GPIO3
78 #define LED_6_GPIO_ON gpio_clear
79 #define LED_6_GPIO_OFF gpio_set
80 #define LED_6_AFIO_REMAP ((void)0)
81 
82 /* PC0, ADC10 on ADC_2 */
83 #define LED_7_GPIO GPIOC
84 #define LED_7_GPIO_CLK RCC_APB2ENR_IOPCEN
85 #define LED_7_GPIO_PIN GPIO0
86 #define LED_7_GPIO_ON gpio_clear
87 #define LED_7_GPIO_OFF gpio_set
88 #define LED_7_AFIO_REMAP ((void)0)
89 
90 /* PC1, ADC11 on ADC_3 */
91 #define LED_8_GPIO GPIOC
92 #define LED_8_GPIO_CLK RCC_APB2ENR_IOPCEN
93 #define LED_8_GPIO_PIN GPIO1
94 #define LED_8_GPIO_ON gpio_clear
95 #define LED_8_GPIO_OFF gpio_set
96 #define LED_8_AFIO_REMAP ((void)0)
97 
98 
99 /*
100  * not actual LEDS, used as GPIOs
101  */
102 
103 /* PB1, DRDY on EXT SPI connector*/
104 #define LED_BODY_GPIO GPIOB
105 #define LED_BODY_GPIO_CLK RCC_APB2ENR_IOPBEN
106 #define LED_BODY_GPIO_PIN GPIO1
107 #define LED_BODY_GPIO_ON gpio_set
108 #define LED_BODY_GPIO_OFF gpio_clear
109 #define LED_BODY_AFIO_REMAP ((void)0)
110 
111 /* PC12, on GPIO connector*/
112 #define LED_12_GPIO GPIOC
113 #define LED_12_GPIO_CLK RCC_APB2ENR_IOPCEN
114 #define LED_12_GPIO_PIN GPIO12
115 #define LED_12_GPIO_ON gpio_clear
116 #define LED_12_GPIO_OFF gpio_set
117 #define LED_12_AFIO_REMAP ((void)0)
118 
119 
120 /* Default actuators driver */
121 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
122 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
123 #define ActuatorsDefaultInit() ActuatorsPwmInit()
124 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
125 
126 
127 #define DefaultVoltageOfAdc(adc) (0.0045*adc)
128 
129 /* Onboard ADCs */
130 /*
131  ADC1 PC3/ADC13
132  ADC2 PC0/ADC10
133  ADC3 PC1/ADC11
134  ADC4 PC5/ADC15
135  ADC6 PC2/ADC12
136  BATT PC4/ADC14
137 */
138 #define BOARD_ADC_CHANNEL_1 13
139 #define BOARD_ADC_CHANNEL_2 10
140 #define BOARD_ADC_CHANNEL_3 11
141 // we can only use ADC1,2,3; the last channel is for bat monitoring
142 #define BOARD_ADC_CHANNEL_4 14
143 
144 /* provide defines that can be used to access the ADC_x in the code or airframe file
145  * these directly map to the index number of the 4 adc channels defined above
146  * 4th (index 3) is used for bat monitoring by default
147  */
148 #define ADC_1 0
149 #define ADC_2 1
150 #define ADC_3 2
151 
152 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
153 #ifndef ADC_CHANNEL_VSUPPLY
154 #define ADC_CHANNEL_VSUPPLY 3
155 #endif
156 
157 /* GPIO mapping for ADC1 pins, overwrites the default in arch/stm32/mcu_periph/adc_arch.c */
158 // FIXME, this is not very nice, is also stm lib specific
159 #ifdef USE_AD1
160 #define ADC1_GPIO_INIT(gpio) { \
161  gpio_set_mode(GPIOC, GPIO_MODE_INPUT, \
162  GPIO_CNF_INPUT_ANALOG, \
163  GPIO3 | GPIO0 | GPIO1 | GPIO4); \
164  }
165 #endif // USE_AD1
166 
167 
168 // FIXME, using baro_board right now to include the appropriate header
169 #define BOARD_HAS_BARO 0
170 
171 
172 #endif /* CONFIG_LIA_1_1_H */