Paparazzi UAS  v5.15_devel-81-gd13dafb
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
lisa_l_1.0.h
Go to the documentation of this file.
1 #ifndef CONFIG_LISA_L_1_0_H
2 #define CONFIG_LISA_L_1_0_H
3 
4 #define BOARD_LISA_L
5 
6 /* Lisa/L has an 8MHZ external clock and 72MHz internal. */
7 #define EXT_CLK 8000000
8 #define AHB_CLK 72000000
9 
10 /* Onboard LEDs */
11 #ifndef USE_LED_1
12 #define USE_LED_1 1
13 #endif
14 #define LED_STP08
15 
16 /* SPI slave mapping */
17 
18 #define SPI_SELECT_SLAVE0_PORT GPIOA
19 #define SPI_SELECT_SLAVE0_PIN GPIO15
20 
21 #define SPI_SELECT_SLAVE1_PORT GPIOA
22 #define SPI_SELECT_SLAVE1_PIN GPIO4
23 
24 #define SPI_SELECT_SLAVE2_PORT GPIOB
25 #define SPI_SELECT_SLAVE2_PIN GPIO12
26 
27 #define SPI_SELECT_SLAVE3_PORT GPIOC
28 #define SPI_SELECT_SLAVE3_PIN GPIO13
29 
30 #define SPI_SELECT_SLAVE4_PORT GPIOC
31 #define SPI_SELECT_SLAVE4_PIN GPIO12
32 
33 
34 /*
35  * I2C
36  *
37  */
38 #define I2C1_GPIO_PORT GPIOB
39 #define I2C1_GPIO_SCL GPIO6
40 #define I2C1_GPIO_SDA GPIO7
41 
42 #define I2C2_GPIO_PORT GPIOB
43 #define I2C2_GPIO_SCL GPIO10
44 #define I2C2_GPIO_SDA GPIO11
45 
46 
47 /*
48  * UART pin configuration
49  *
50  * sets on which pins the UARTs are connected
51  */
52 #define UART1_GPIO_AF 0
53 #define UART1_GPIO_PORT_RX GPIO_BANK_USART1_RX
54 #define UART1_GPIO_RX GPIO_USART1_RX
55 #define UART1_GPIO_PORT_TX GPIO_BANK_USART1_TX
56 #define UART1_GPIO_TX GPIO_USART1_TX
57 
58 #define UART2_GPIO_AF 0
59 #define UART2_GPIO_PORT_RX GPIO_BANK_USART2_RX
60 #define UART2_GPIO_RX GPIO_USART2_RX
61 #define UART2_GPIO_PORT_TX GPIO_BANK_USART2_TX
62 #define UART2_GPIO_TX GPIO_USART2_TX
63 
64 #define UART3_GPIO_AF AFIO_MAPR_USART3_REMAP_PARTIAL_REMAP
65 #define UART3_GPIO_PORT_RX GPIO_BANK_USART3_PR_RX
66 #define UART3_GPIO_RX GPIO_USART3_PR_RX
67 #define UART3_GPIO_PORT_TX GPIO_BANK_USART3_PR_TX
68 #define UART3_GPIO_TX GPIO_USART3_PR_TX
69 
70 #define UART5_GPIO_AF 0
71 #define UART5_GPIO_PORT_RX GPIO_BANK_UART5_RX
72 #define UART5_GPIO_RX GPIO_UART5_RX
73 #define UART5_GPIO_PORT_TX GPIO_BANK_UART5_TX
74 #define UART5_GPIO_TX GPIO_UART5_TX
75 
76 
77 /*
78  * Spektrum
79  */
80 /* The line that is pulled low at power up to initiate the bind process */
81 #define SPEKTRUM_BIND_PIN GPIO3
82 #define SPEKTRUM_BIND_PIN_PORT GPIOC
83 
84 #define SPEKTRUM_UART1_RCC RCC_USART1
85 #define SPEKTRUM_UART1_BANK GPIO_BANK_USART1_RX
86 #define SPEKTRUM_UART1_PIN GPIO_USART1_RX
87 #define SPEKTRUM_UART1_AF 0
88 #define SPEKTRUM_UART1_IRQ NVIC_USART1_IRQ
89 #define SPEKTRUM_UART1_ISR usart1_isr
90 #define SPEKTRUM_UART1_DEV USART1
91 
92 #define SPEKTRUM_UART3_RCC RCC_USART3
93 #define SPEKTRUM_UART3_BANK GPIO_BANK_USART3_PR_RX
94 #define SPEKTRUM_UART3_PIN GPIO_USART3_PR_RX
95 #define SPEKTRUM_UART3_AF AFIO_MAPR_USART3_REMAP_PARTIAL_REMAP
96 #define SPEKTRUM_UART3_IRQ NVIC_USART3_IRQ
97 #define SPEKTRUM_UART3_ISR usart3_isr
98 #define SPEKTRUM_UART3_DEV USART3
99 
100 #define SPEKTRUM_UART5_RCC RCC_UART5
101 #define SPEKTRUM_UART5_BANK GPIO_BANK_UART5_RX
102 #define SPEKTRUM_UART5_PIN GPIO_UART5_RX
103 #define SPEKTRUM_UART5_AF 0
104 #define SPEKTRUM_UART5_IRQ NVIC_UART5_IRQ
105 #define SPEKTRUM_UART5_ISR uart5_isr
106 #define SPEKTRUM_UART5_DEV UART5
107 
108 
109 /*
110  * PPM input
111  */
112 #define USE_PPM_TIM2 1
113 #define PPM_CHANNEL TIM_IC2
114 #define PPM_TIMER_INPUT TIM_IC_IN_TI2
115 #define PPM_IRQ NVIC_TIM2_IRQ
116 // Capture/Compare InteruptEnable and InterruptFlag
117 #define PPM_CC_IE TIM_DIER_CC2IE
118 #define PPM_CC_IF TIM_SR_CC2IF
119 #define PPM_GPIO_PORT GPIOA
120 #define PPM_GPIO_PIN GPIO1
121 #define PPM_GPIO_AF 0
122 
123 
124 /*
125  * ADC
126  */
127 #define USE_AD_TIM1 1
128 
129 #if USE_ADC_1
130 #define AD1_1_CHANNEL 8
131 #define ADC_1 AD1_1
132 #define ADC_1_GPIO_PORT GPIOB
133 #define ADC_1_GPIO_PIN GPIO0
134 #endif
135 
136 #if USE_ADC_2
137 #define AD1_2_CHANNEL 9
138 #define ADC_2 AD1_2
139 #define ADC_2_GPIO_PORT GPIOB
140 #define ADC_2_GPIO_PIN GPIO1
141 #endif
142 
143 // Internal ADC for battery enabled by default
144 #ifndef USE_ADC_3
145 #define USE_ADC_3 1
146 #endif
147 #if USE_ADC_3
148 #define AD1_3_CHANNEL 0
149 #define ADC_3 AD1_3
150 #define ADC_3_GPIO_PORT GPIOA
151 #define ADC_3_GPIO_PIN GPIO0
152 #endif
153 
154 #if USE_ADC_4
155 #define AD1_4_CHANNEL 15
156 #define ADC_4 AD1_4
157 #define ADC_4_GPIO_PORT GPIOC
158 #define ADC_4_GPIO_PIN GPIO5
159 #endif
160 
161 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
162 #ifndef ADC_CHANNEL_VSUPPLY
163 #define ADC_CHANNEL_VSUPPLY ADC_3
164 #endif
165 
166 #define DefaultVoltageOfAdc(adc) (0.0059*adc)
167 
168 
169 /* by default activate onboard baro */
170 #ifndef USE_BARO_BOARD
171 #define USE_BARO_BOARD 1
172 #endif
173 
174 
175 /* Default actuators driver */
176 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
177 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
178 #define ActuatorsDefaultInit() ActuatorsPwmInit()
179 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
180 
181 /*
182  * PWM
183  *
184  */
185 #define PWM_USE_TIM3 1
186 #define PWM_USE_TIM4 1
187 
188 #define USE_PWM1 1
189 #define USE_PWM2 1
190 #define USE_PWM3 1
191 #define USE_PWM4 1
192 #define USE_PWM5 1
193 #define USE_PWM6 1
194 
195 #define ACTUATORS_PWM_NB 6
196 
197 // PWM_SERVO_x is the index of the servo in the actuators_pwm_values array
198 #if USE_PWM1
199 #define PWM_SERVO_1 0
200 #define PWM_SERVO_1_TIMER TIM3
201 #define PWM_SERVO_1_GPIO GPIOC
202 #define PWM_SERVO_1_PIN GPIO6
203 #define PWM_SERVO_1_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
204 #define PWM_SERVO_1_OC TIM_OC1
205 #define PWM_SERVO_1_OC_BIT (1<<0)
206 #else
207 #define PWM_SERVO_1_OC_BIT 0
208 #endif
209 
210 #if USE_PWM2
211 #define PWM_SERVO_2 1
212 #define PWM_SERVO_2_TIMER TIM3
213 #define PWM_SERVO_2_GPIO GPIOC
214 #define PWM_SERVO_2_PIN GPIO7
215 #define PWM_SERVO_2_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
216 #define PWM_SERVO_2_OC TIM_OC2
217 #define PWM_SERVO_2_OC_BIT (1<<1)
218 #else
219 #define PWM_SERVO_2_OC_BIT 0
220 #endif
221 
222 #if USE_PWM3
223 #define PWM_SERVO_3 2
224 #define PWM_SERVO_3_TIMER TIM3
225 #define PWM_SERVO_3_GPIO GPIOC
226 #define PWM_SERVO_3_PIN GPIO8
227 #define PWM_SERVO_3_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
228 #define PWM_SERVO_3_OC TIM_OC3
229 #define PWM_SERVO_3_OC_BIT (1<<2)
230 #else
231 #define PWM_SERVO_3_OC_BIT 0
232 #endif
233 
234 #if USE_PWM4
235 #define PWM_SERVO_4 3
236 #define PWM_SERVO_4_TIMER TIM3
237 #define PWM_SERVO_4_GPIO GPIOC
238 #define PWM_SERVO_4_PIN GPIO9
239 #define PWM_SERVO_4_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
240 #define PWM_SERVO_4_OC TIM_OC4
241 #define PWM_SERVO_4_OC_BIT (1<<3)
242 #else
243 #define PWM_SERVO_4_OC_BIT 0
244 #endif
245 
246 #if USE_PWM5
247 #define PWM_SERVO_5 4
248 #define PWM_SERVO_5_TIMER TIM4
249 #define PWM_SERVO_5_GPIO GPIOB
250 #define PWM_SERVO_5_PIN GPIO8
251 #define PWM_SERVO_5_AF 0
252 #define PWM_SERVO_5_OC TIM_OC3
253 #define PWM_SERVO_5_OC_BIT (1<<2)
254 #else
255 #define PWM_SERVO_5_OC_BIT 0
256 #endif
257 
258 #if USE_PWM6
259 #define PWM_SERVO_6 5
260 #define PWM_SERVO_6_TIMER TIM4
261 #define PWM_SERVO_6_GPIO GPIOB
262 #define PWM_SERVO_6_PIN GPIO9
263 #define PWM_SERVO_6_AF 0
264 #define PWM_SERVO_6_OC TIM_OC4
265 #define PWM_SERVO_6_OC_BIT (1<<3)
266 #else
267 #define PWM_SERVO_6_OC_BIT 0
268 #endif
269 
270 /* servos 1-4 on TIM3 */
271 #define PWM_TIM3_CHAN_MASK (PWM_SERVO_1_OC_BIT|PWM_SERVO_2_OC_BIT|PWM_SERVO_3_OC_BIT|PWM_SERVO_4_OC_BIT)
272 /* servos 5-6 on TIM4 */
273 #define PWM_TIM4_CHAN_MASK (PWM_SERVO_5_OC_BIT|PWM_SERVO_6_OC_BIT)
274 
275 #endif /* CONFIG_LISA_L_1_0_H */