Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
opa_ap_1.0.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2015 Freek van Tienen <freek.v.tienen@gmail.com>
3
*
4
* This file is part of paparazzi.
5
*
6
* paparazzi is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* paparazzi is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with paparazzi; see the file COPYING. If not, write to
18
* the Free Software Foundation, 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
20
*
21
*/
22
23
#ifndef CONFIG_OPA_FTD_1_0_H
24
#define CONFIG_OPA_FTD_1_0_H
25
26
#define BOARD_OPA_AP
27
28
/* OPA/FTD has a 12MHz external clock and 168MHz internal. */
29
#define EXT_CLK 12000000
30
#define AHB_CLK 168000000
31
32
/*
33
* Power control
34
*/
35
36
/* VISION power */
37
#define VISION_PWR GPIOA
38
#define VISION_PWR_PIN GPIO1
39
#define VISION_PWR_ON gpio_set
40
#define VISION_PWR_OFF gpio_clear
41
42
/*
43
* Onboard LEDs
44
*/
45
46
/* Status (red), on PA8 */
47
#ifndef USE_LED_1
48
#define USE_LED_1 1
49
#endif
50
#define LED_1_GPIO GPIOA
51
#define LED_1_GPIO_PIN GPIO8
52
#define LED_1_GPIO_ON gpio_set
53
#define LED_1_GPIO_OFF gpio_clear
54
#define LED_1_AFIO_REMAP ((void)0)
55
56
57
/* UART */
58
#define UART1_GPIO_AF GPIO_AF7
59
#define UART1_GPIO_PORT_RX GPIOA
60
#define UART1_GPIO_RX GPIO10
61
#define UART1_GPIO_PORT_TX GPIOA
62
#define UART1_GPIO_TX GPIO9
63
64
#define UART2_GPIO_AF GPIO_AF7
65
#define UART2_GPIO_PORT_RX GPIOA
66
#define UART2_GPIO_RX GPIO3
67
#define UART2_GPIO_PORT_TX GPIOA
68
#define UART2_GPIO_TX GPIO2
69
70
#define UART3_GPIO_AF GPIO_AF7
71
#define UART3_GPIO_PORT_RX GPIOB
72
#define UART3_GPIO_RX GPIO11
73
#define UART3_GPIO_PORT_TX GPIOB
74
#define UART3_GPIO_TX GPIO10
75
76
#define UART4_GPIO_AF GPIO_AF8
77
#define UART4_GPIO_PORT_RX GPIOC
78
#define UART4_GPIO_RX GPIO11
79
#define UART4_GPIO_PORT_TX GPIOC
80
#define UART4_GPIO_TX GPIO10
81
82
#define UART5_GPIO_AF GPIO_AF8
83
#define UART5_GPIO_PORT_RX GPIOD
84
#define UART5_GPIO_RX GPIO2
85
86
/* SPI */
87
#define SPI1_GPIO_AF GPIO_AF5
88
#define SPI1_GPIO_PORT_MISO GPIOA
89
#define SPI1_GPIO_MISO GPIO6
90
#define SPI1_GPIO_PORT_MOSI GPIOA
91
#define SPI1_GPIO_MOSI GPIO7
92
#define SPI1_GPIO_PORT_SCK GPIOA
93
#define SPI1_GPIO_SCK GPIO5
94
#define SPI1_GPIO_PORT_NSS GPIOA
95
#define SPI1_GPIO_NSS GPIO4
96
97
#define SPI2_GPIO_AF GPIO_AF5
98
#define SPI2_GPIO_PORT_MISO GPIOB
99
#define SPI2_GPIO_MISO GPIO14
100
#define SPI2_GPIO_PORT_MOSI GPIOB
101
#define SPI2_GPIO_MOSI GPIO15
102
#define SPI2_GPIO_PORT_SCK GPIOB
103
#define SPI2_GPIO_SCK GPIO13
104
#define SPI2_GPIO_PORT_NSS GPIOB
105
#define SPI2_GPIO_NSS GPIO12
106
107
#define SPI_SELECT_SLAVE0_PORT GPIOA
// SD CARD (on spi1)
108
#define SPI_SELECT_SLAVE0_PIN GPIO4
109
110
#define SPI_SELECT_SLAVE1_PORT GPIOB
// IMU (on spi2)
111
#define SPI_SELECT_SLAVE1_PIN GPIO12
112
113
#define SPI_SELECT_SLAVE2_PORT GPIOC
// BARO (on spi2)
114
#define SPI_SELECT_SLAVE2_PIN GPIO13
115
116
117
/*
118
* RPM sensor
119
*/
120
#ifdef USE_PWM_INPUT1
121
#define PWM_INPUT1_GPIO_PORT GPIOB
122
#define PWM_INPUT1_GPIO_PIN GPIO6
123
#define PWM_INPUT1_GPIO_AF GPIO_AF2
124
125
#define PWM_INPUT1_TIMER TIM4
126
#define PWM_INPUT1_CHANNEL_PERIOD TIM_IC1
127
#define PWM_INPUT1_CHANNEL_DUTY TIM_IC2
128
#define PWM_INPUT1_TIMER_INPUT TIM_IC_IN_TI1
129
#define PWM_INPUT1_SLAVE_TRIG TIM_SMCR_TS_TI1FP1
130
#define PWM_INPUT1_IRQ NVIC_TIM4_IRQ
131
#define PWM_INPUT1_CC_IE (TIM_DIER_CC1IE | TIM_DIER_CC2IE)
132
#define USE_PWM_INPUT_TIM4 TRUE
133
134
#ifdef PWM_INPUT1_TICKS_PER_USEC
135
#define TIM4_TICKS_PER_USEC PWM_INPUT1_TICKS_PER_USEC
136
#endif
137
#define TIM4_PWM_INPUT_IDX 0
138
#define TIM4_CC_IF_PERIOD TIM_SR_CC1IF
139
#define TIM4_CC_IF_DUTY TIM_SR_CC2IF
140
#define TIM4_CCR_PERIOD TIM4_CCR1
141
#define TIM4_CCR_DUTY TIM4_CCR2
142
#endif
143
144
/*
145
* ADC
146
*/
147
148
/* BATT PC4/ADC14 */
149
#ifndef USE_ADC_1
150
#define USE_ADC_1 1
151
#endif
152
#if USE_ADC_1
153
#define AD1_1_CHANNEL 14
154
#define ADC_1 AD1_1
155
#define ADC_1_GPIO_PORT GPIOC
156
#define ADC_1_GPIO_PIN GPIO4
157
#endif
158
159
/* CURRENT PC3/ADC13 */
160
#if USE_ADC_2
161
#define AD1_2_CHANNEL 13
162
#define ADC_2 AD1_2
163
#define ADC_2_GPIO_PORT GPIOC
164
#define ADC_2_GPIO_PIN GPIO3
165
#endif
166
167
/* TEMP_MOTOR PC0/ADC10 */
168
#ifndef USE_ADC_3
169
#define USE_ADC_3 1
170
#endif
171
#if USE_ADC_3
172
#define AD1_3_CHANNEL 10
173
#define ADC_3 AD1_3
174
#define ADC_3_GPIO_PORT GPIOC
175
#define ADC_3_GPIO_PIN GPIO0
176
#endif
177
178
/* TEMP_BATT PC1/ADC11 */
179
#ifndef USE_ADC_4
180
#define USE_ADC_4 1
181
#endif
182
#if USE_ADC_4
183
#define AD1_4_CHANNEL 11
184
#define ADC_4 AD1_4
185
#define ADC_4_GPIO_PORT GPIOC
186
#define ADC_4_GPIO_PIN GPIO1
187
#endif
188
189
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
190
#ifndef ADC_CHANNEL_VSUPPLY
191
#define ADC_CHANNEL_VSUPPLY ADC_1
192
#endif
193
194
// Default: 10k / 2k2
195
// #define DefaultVoltageOfAdc(adc) (0.0045*adc)
196
// Opa: 31k6 / 4k7
197
#define DefaultVoltageOfAdc(adc) (0.0063*adc)
198
199
// ADC756-B050: +/-50Amp range bidirectional
200
// 40 mV / Ampere
201
// 1 ADC-count = 0,000805664 Volt, 0.040 V = 1 Ampere -> 1 Ampere = 49,6484887 ADC ticks: 1 ADC-tck = 20mA
202
// 5.0/3.3 from datasheet
203
#define DefaultMilliAmpereOfAdc(adc) (20.142*(adc-2048) * 5.0/3.3)
204
205
/* TEMP MOTOR: NTC with 2k fixed pull up */
206
// R0: 10k (@25C)
207
// T0: 25C -> 298.15K
208
// B: 3976 K
209
// a = (1/T0) - (1/B)*ln(R0) = 0.00103753243
210
// b = 1/B = 0.00025150905
211
// c = 0
212
#define TEMP_ADC_CHANNEL1 ADC_3
213
#define TEMP_ADC_CHANNEL1_TYPE NTC
214
#define TEMP_ADC_CHANNEL1_PU_R 2000
215
#define TEMP_ADC_CHANNEL1_A 0.00103753243
216
#define TEMP_ADC_CHANNEL1_B 0.00025150905
217
#define TEMP_ADC_CHANNEL1_C 0
218
219
/* TEMP BATT: NTC with 2k fixed pull up */
220
// R0: 10k (@25C)
221
// T0: 25C -> 298.15K
222
// B: 3976 K
223
// a = (1/T0) - (1/B)*ln(R0) = 0.00103753243
224
// b = 1/B = 0.00025150905
225
// c = 0
226
#define TEMP_ADC_CHANNEL2 ADC_4
227
#define TEMP_ADC_CHANNEL2_TYPE NTC
228
#define TEMP_ADC_CHANNEL2_PU_R 2000
229
#define TEMP_ADC_CHANNEL2_A 0.00103753243
230
#define TEMP_ADC_CHANNEL2_B 0.00025150905
231
#define TEMP_ADC_CHANNEL2_C 0
232
233
/* by default activate onboard baro */
234
#ifndef USE_BARO_BOARD
235
#define USE_BARO_BOARD 1
236
#endif
237
238
#endif
/* CONFIG_OPA_AP_1_0_H */
sw
airborne
boards
opa_ap_1.0.h
Generated on Thu Dec 5 2024 13:05:29 for Paparazzi UAS by
1.9.1