Paparazzi UAS
v6.2.0_stable
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Data Structures
Data Structure Index
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
crazyflie.h
Go to the documentation of this file.
1
#ifndef CONFIG_CRAZYFLIE_2_1_H
2
#define CONFIG_CRAZYFLIE_2_1_H
3
4
#define BOARD_CRAZYFLIE
5
9
#include "
boards/crazyflie/chibios/v2.1/board.h
"
10
15
/*
16
* AHB_CLK
17
*/
18
#define AHB_CLK STM32_HCLK
19
20
/*
21
* LEDs
22
*/
23
#ifndef USE_LED_1
24
#define USE_LED_1 1
25
#endif
26
#define LED_1_GPIO PAL_PORT(LED_RED_R)
27
#define LED_1_GPIO_PIN PAL_PAD(LED_RED_R)
28
#define LED_1_GPIO_ON gpio_clear
29
#define LED_1_GPIO_OFF gpio_set
30
31
#ifndef USE_LED_2
32
#define USE_LED_2 1
33
#endif
34
#define LED_2_GPIO PAL_PORT(LED_RED_L)
35
#define LED_2_GPIO_PIN PAL_PAD(LED_RED_L)
36
#define LED_2_GPIO_ON gpio_clear
37
#define LED_2_GPIO_OFF gpio_set
38
39
#ifndef USE_LED_3
40
#define USE_LED_3 1
41
#endif
42
#define LED_3_GPIO PAL_PORT(LED_GREEN_R)
43
#define LED_3_GPIO_PIN PAL_PAD(LED_GREEN_R)
44
#define LED_3_GPIO_ON gpio_clear
45
#define LED_3_GPIO_OFF gpio_set
46
47
#ifndef USE_LED_4
48
#define USE_LED_4 1
49
#endif
50
#define LED_4_GPIO PAL_PORT(LED_GREEN_L)
51
#define LED_4_GPIO_PIN PAL_PAD(LED_GREEN_L)
52
#define LED_4_GPIO_ON gpio_clear
53
#define LED_4_GPIO_OFF gpio_set
54
55
#ifndef USE_LED_5
56
#define USE_LED_5 1
57
#endif
58
#define LED_5_GPIO PAL_PORT(LED_BLUE_L)
59
#define LED_5_GPIO_PIN PAL_PAD(PAL_PAD(LED_BLUE_L))
60
#define LED_5_GPIO_ON gpio_set
61
#define LED_5_GPIO_OFF gpio_clear
62
63
/*
64
* ADCs
65
*/
66
// TODO for AUX
67
// No VBAT monitoring ?
68
69
/*
70
* PWM defines
71
*/
72
73
// SRVa connectors, activated in PWM mode by default
74
75
#ifndef USE_PWM1
76
#define USE_PWM1 1
77
#endif
78
#if USE_PWM1
79
#define PWM_SERVO_1 1
80
#define PWM_SERVO_1_GPIO PAL_PORT(MOTOR1)
81
#define PWM_SERVO_1_PIN PAL_PAD(MOTOR1)
82
#define PWM_SERVO_1_AF AF_MOTOR1
83
#define PWM_SERVO_1_DRIVER PWMD2
84
#define PWM_SERVO_1_CHANNEL 1
85
#define PWM_SERVO_1_CONF pwmcfg2
86
#endif
87
88
#ifndef USE_PWM2
89
#define USE_PWM2 1
90
#endif
91
#if USE_PWM2
92
#define PWM_SERVO_2 2
93
#define PWM_SERVO_2_GPIO PAL_PORT(MOTOR2)
94
#define PWM_SERVO_2_PIN PAL_PAD(MOTOR2)
95
#define PWM_SERVO_2_AF AF_MOTOR2
96
#define PWM_SERVO_2_DRIVER PWMD2
97
#define PWM_SERVO_2_CHANNEL 3
98
#define PWM_SERVO_2_CONF pwmcfg2
99
#endif
100
101
#ifndef USE_PWM3
102
#define USE_PWM3 1
103
#endif
104
#if USE_PWM3
105
#define PWM_SERVO_3 3
106
#define PWM_SERVO_3_GPIO PAL_PORT(MOTOR3)
107
#define PWM_SERVO_3_PIN PAL_PAD(MOTOR3)
108
#define PWM_SERVO_3_AF AF_MOTOR3
109
#define PWM_SERVO_3_DRIVER PWMD2
110
#define PWM_SERVO_3_CHANNEL 0
111
#define PWM_SERVO_3_CONF pwmcfg2
112
#endif
113
114
#ifndef USE_PWM4
115
#define USE_PWM4 1
116
#endif
117
#if USE_PWM4
118
#define PWM_SERVO_4 4
119
#define PWM_SERVO_4_GPIO PAL_PORT(MOTOR4)
120
#define PWM_SERVO_4_PIN PAL_PAD(MOTOR4)
121
#define PWM_SERVO_4_AF AF_MOTOR4
122
#define PWM_SERVO_4_DRIVER PWMD4
123
#define PWM_SERVO_4_CHANNEL 3
124
#define PWM_SERVO_4_CONF pwmcfg4
125
#endif
126
127
// servo index starting at 1 + regular servos + aux servos
128
// so NB = 1+4
129
#define ACTUATORS_PWM_NB 5
130
131
132
// PWM control of brushed motors
133
// Freq = 84 MHz (corresponding to prescaler of 0)
134
// Period = 256 (corresponding to 8bit resolution for command at ~328 kHz))
135
// as indicated in Crazyflie source code, 328 kHz offers better natural filtering
136
// than 128 kHz
137
// It is also needed to redefined PWM_CMD_TO_US to get the proper converstion
138
// from command to clock pulses number
139
#define PWM_CMD_TO_US(_t) (_t)
140
#define PWM_FREQUENCY 84000000
141
#define SERVO_HZ (PWM_FREQUENCY / 256)
// 328125
142
146
#define UART2_GPIO_PORT_TX PAL_PORT(E_TX2)
147
#define UART2_GPIO_TX PAL_PAD(E_TX2)
148
#define UART2_GPIO_PORT_RX PAL_PORT(E_RX2)
149
#define UART2_GPIO_RX PAL_PAD(E_RX2)
150
#define UART2_GPIO_AF AF_E_RX2
151
#ifndef UART2_HW_FLOW_CONTROL
152
#define UART2_HW_FLOW_CONTROL FALSE
153
#endif
154
158
#define UART3_GPIO_PORT_TX PAL_PORT(E_TX1)
159
#define UART3_GPIO_TX PAL_PAD(E_TX1)
160
#define UART3_GPIO_PORT_RX PAL_PORT(E_RX1)
161
#define UART3_GPIO_RX PAL_PAD(E_RX1)
162
#define UART3_GPIO_AF AF_E_RX1
163
167
#define UART6_GPIO_PORT_TX PAL_PORT(NRF_TX)
168
#define UART6_GPIO_TX PAL_PAD(NRF_TX)
169
#define UART6_GPIO_PORT_RX PAL_PORT(NRF_RX)
170
#define UART6_GPIO_RX PAL_PAD(NRF_RX)
171
#define UART6_GPIO_AF AF_NRF_RX
172
#define UART6_GPIO_PORT_CTS PAL_PORT(NRF_FLOW_CTRL)
173
#define UART6_GPIO_CTS NRF_FLOW_CTRL
174
179
// Digital noise filter: 0 disabled, [0x1 - 0xF] enable up to n t_I2CCLK
180
#define STM32_CR1_DNF(n) ((n & 0x0f) << 8)
181
// Timing register
182
#define I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(0U) | \
183
STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(0U) | \
184
STM32_TIMINGR_SCLH(34U) | STM32_TIMINGR_SCLL(86U))
185
#define I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(1U) | \
186
STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(0U) | \
187
STM32_TIMINGR_SCLH(105U) | STM32_TIMINGR_SCLL(153U))
188
189
190
// Internal I2C (IMU, baro)
191
192
#ifndef I2C3_CLOCK_SPEED
193
#define I2C3_CLOCK_SPEED 400000
194
#endif
195
#if I2C3_CLOCK_SPEED == 400000
196
#define I2C3_DUTY_CYCLE FAST_DUTY_CYCLE_2
197
#elif I2C3_CLOCK_SPEED == 100000
198
#define I2C3_DUTY_CYCLE STD_DUTY_CYCLE
199
#else
200
#error "Invalid I2C3 clock speed"
201
#endif
202
#define I2C3_CFG_DEF { \
203
OPMODE_I2C, \
204
I2C3_CLOCK_SPEED, \
205
I2C3_DUTY_CYCLE, \
206
}
207
208
// External I2C
209
210
#ifndef I2C1_CLOCK_SPEED
211
#define I2C1_CLOCK_SPEED 400000
212
#endif
213
#if I2C1_CLOCK_SPEED == 400000
214
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
215
#elif I2C1_CLOCK_SPEED == 100000
216
#define I2C1_DUTY_CYCLE STD_DUTY_CYCLE
217
#else
218
#error "Invalid I2C1 clock speed"
219
#endif
220
#define I2C1_CFG_DEF { \
221
OPMODE_I2C, \
222
I2C1_CLOCK_SPEED, \
223
I2C1_DUTY_CYCLE, \
224
}
225
226
/*
227
#ifndef I2C3_CLOCK_SPEED
228
#define I2C3_CLOCK_SPEED 400000
229
#endif
230
231
#if I2C3_CLOCK_SPEED == 400000
232
#define I2C3_CFG_DEF { \
233
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
234
.cr1 = STM32_CR1_DNF(0), \
235
.cr2 = 0 \
236
}
237
#elif I2C3_CLOCK_SPEED == 100000
238
#define I2C3_CFG_DEF { \
239
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
240
.cr1 = STM32_CR1_DNF(0), \
241
.cr2 = 0 \
242
}
243
#else
244
#error "Unknown I2C3 clock speed"
245
#endif
246
247
// External I2C
248
249
#ifndef I2C1_CLOCK_SPEED
250
#define I2C1_CLOCK_SPEED 400000
251
#endif
252
253
#if I2C1_CLOCK_SPEED == 400000
254
#define I2C1_CFG_DEF { \
255
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
256
.cr1 = STM32_CR1_DNF(0), \
257
.cr2 = 0 \
258
}
259
#elif I2C1_CLOCK_SPEED == 100000
260
#define I2C1_CFG_DEF { \
261
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
262
.cr1 = STM32_CR1_DNF(0), \
263
.cr2 = 0 \
264
}
265
#else
266
#error "Unknown I2C2 clock speed"
267
#endif
268
*/
269
274
// External SPI
275
#define SPI1_GPIO_AF AF_E_SCK
276
#define SPI1_GPIO_PORT_MISO PAL_PORT(E_MISO)
277
#define SPI1_GPIO_MISO PAL_PAD(E_MISO)
278
#define SPI1_GPIO_PORT_MOSI PAL_PORT(E_MOSI)
279
#define SPI1_GPIO_MOSI PAL_PAD(E_MOSI)
280
#define SPI1_GPIO_PORT_SCK PAL_PORT(E_SCK)
281
#define SPI1_GPIO_SCK PAL_PAD(E_SCK)
282
283
#define SPI_SELECT_SLAVE0_PORT PAL_PORT(E_CS0)
284
#define SPI_SELECT_SLAVE0_PIN PAL_PAD(E_CS0)
285
#define SPI_SELECT_SLAVE1_PORT PAL_PORT(E_CS1)
286
#define SPI_SELECT_SLAVE1_PIN PAL_PAD(E_CS1)
287
#define SPI_SELECT_SLAVE2_PORT PAL_PORT(E_CS2)
288
#define SPI_SELECT_SLAVE2_PIN PAL_PAD(E_CS2)
289
#define SPI_SELECT_SLAVE3_PORT PAL_PORT(E_CS3)
290
#define SPI_SELECT_SLAVE3_PIN PAL_PAD(E_CS3
291
298
#ifndef USE_BARO_BOARD
299
#define USE_BARO_BOARD 0
300
#endif
301
302
/*
303
* Actuators for fixedwing
304
*/
305
/* Default actuators driver */
306
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
307
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
308
#define ActuatorsDefaultInit() ActuatorsPwmInit()
309
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
310
311
#endif
/* CONFIG_TAWAKI_1_00_H */
312
board.h
sw
airborne
boards
crazyflie
chibios
v2.1
crazyflie.h
Generated on Mon Feb 6 2023 21:00:23 for Paparazzi UAS by
1.9.1