Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
px4io_2.4.h
Go to the documentation of this file.
1
#ifndef CONFIG_PX4IO_2_4_H
2
#define CONFIG_PX4IO_2_4_H
3
4
#define BOARD_PX4IO
5
//STM32F103c8t6 (medium density!)
6
7
/* Pixhawk board (PX4FIOv2 has a 24MHz external clock and 24MHz internal. */
8
#define EXT_CLK 24000000 //this osc is actually outside of the specs (max 16MHz)
9
#define AHB_CLK 24000000
10
11
12
/*
13
* LEDs
14
*/
15
/* blue led, a.k.a. ACT */
16
#ifndef USE_LED_1
17
#define USE_LED_1 1
18
#endif
19
#define LED_1_GPIO GPIOB
20
#define LED_1_GPIO_PIN GPIO14
21
#define LED_1_GPIO_ON gpio_clear
22
#define LED_1_GPIO_OFF gpio_set
23
#define LED_1_AFIO_REMAP ((void)0)
24
25
//led Amber a.k.a b/e led
26
#ifndef USE_LED_2
27
#define USE_LED_2 1
28
#endif
29
#define LED_2_GPIO GPIOB
30
#define LED_2_GPIO_PIN GPIO15
31
#define LED_2_GPIO_ON gpio_clear
32
#define LED_2_GPIO_OFF gpio_set
33
#define LED_2_AFIO_REMAP ((void)0)
34
35
//safety led in the switch, red
36
#ifndef USE_LED_3
37
#define USE_LED_3 1
38
#endif
39
#define LED_3_GPIO GPIOB
40
#define LED_3_GPIO_PIN GPIO13
41
#define LED_3_GPIO_ON gpio_clear
42
#define LED_3_GPIO_OFF gpio_set
43
#define LED_3_AFIO_REMAP ((void)0)
44
45
//TODO: safety switch is on PB5!
46
47
/*
48
* UART
49
*/
50
51
// fmu debug / spektrum receiver (only rx)
52
#define UART1_GPIO_AF 0
53
#define UART1_GPIO_PORT_RX GPIOA
54
#define UART1_GPIO_RX GPIO10
55
#define UART1_GPIO_PORT_TX GPIOA
56
#define UART1_GPIO_TX GPIO9
57
// intermcu fmu
58
#define UART2_GPIO_AF 0
59
#define UART2_GPIO_PORT_RX GPIOA
60
#define UART2_GPIO_RX GPIO3
61
#define UART2_GPIO_PORT_TX GPIOA
62
#define UART2_GPIO_TX GPIO2
63
// SBUS
64
#define UART3_GPIO_AF 0
65
#define UART3_GPIO_PORT_RX GPIOB
66
#define UART3_GPIO_RX GPIO11
67
#define UART3_GPIO_PORT_TX GPIOB
68
#define UART3_GPIO_TX GPIO10
69
70
/*
71
* Spektrum
72
*/
73
/* The line that is pulled low at power up to initiate the bind process */
74
#define RADIO_CONTROL_POWER_PORT GPIOC
75
#define RADIO_CONTROL_POWER_PIN GPIO13
76
#define RADIO_CONTROL_POWER_ON gpio_set
77
#define RADIO_CONTROL_POWER_OFF gpio_clear
78
79
#define SPEKTRUM_TIMER 3
80
81
#define SPEKTRUM_UART1_RCC RCC_USART1
82
#define SPEKTRUM_UART1_BANK GPIOA
83
#define SPEKTRUM_UART1_PIN GPIO10
84
#define SPEKTRUM_UART1_AF 0
85
#define SPEKTRUM_UART1_IRQ NVIC_USART1_IRQ
86
#define SPEKTRUM_UART1_ISR usart1_isr
87
#define SPEKTRUM_UART1_DEV USART1
88
89
90
/*
91
* PPM input
92
*/
93
#define USE_PPM_TIM1 1
94
#define PPM_CHANNEL TIM_IC1
95
#define PPM_TIMER_INPUT TIM_IC_IN_TI1
96
#define PPM_IRQ NVIC_TIM1_UP_IRQ
97
#define PPM_IRQ2 NVIC_TIM1_CC_IRQ
98
// Capture/Compare InteruptEnable and InterruptFlag
99
#define PPM_CC_IE TIM_DIER_CC1IE
100
#define PPM_CC_IF TIM_SR_CC1IF
101
#define PPM_GPIO_PORT GPIOA
102
#define PPM_GPIO_PIN GPIO8
103
#define PPM_GPIO_AF 0
104
105
//#define USE_AD_TIM1 1
106
#ifndef USE_ADC_1
107
#define USE_ADC_1 0
108
#endif
109
#if USE_ADC_1 // VDD servo ADC12_IN4, untested
110
#define AD1_1_CHANNEL 12
111
#define ADC_1 AD1_4
112
#define ADC_1_GPIO_PORT GPIOA
113
#define ADC_1_GPIO_PIN GPIO4
114
#endif
115
116
/*
117
* PWM
118
*
119
*/
120
//sevo outputs on px4io f1:
121
//chn: 1 2 3 4 5 6 7 8
122
//pin: A0 A1 B8 B9 A6 A7 B0 B1
123
//timer/channel: 2/1 2/2 4/3 4/4 3/1 3/2 3/3 3/4
124
#define PWM_USE_TIM2 1
125
//#define PWM_USE_TIM3 1 // spektrum already uses tim3
126
#define PWM_USE_TIM4 1
127
128
//#define ACTUATORS_PWM_NB 4
129
130
#define USE_PWM1 1
131
#define USE_PWM2 1
132
#define USE_PWM3 1
133
#define USE_PWM4 1
134
//#define USE_PWM5 1
135
//#define USE_PWM6 1
136
//#define USE_PWM7 1
137
//#define USE_PWM8 1
138
139
// PWM_SERVO_x is the index of the servo in the actuators_pwm_values array
140
#if USE_PWM1
141
#define PWM_SERVO_1 0
142
#define PWM_SERVO_1_TIMER TIM2
143
#define PWM_SERVO_1_GPIO GPIOA
144
#define PWM_SERVO_1_PIN GPIO0
145
#define PWM_SERVO_1_AF 0
146
#define PWM_SERVO_1_OC TIM_OC1
147
#define PWM_SERVO_1_OC_BIT (1<<0)
148
#else
149
#define PWM_SERVO_1_OC_BIT 0
150
#endif
151
152
#if USE_PWM2
153
#define PWM_SERVO_2 1
154
#define PWM_SERVO_2_TIMER TIM2
155
#define PWM_SERVO_2_GPIO GPIOA
156
#define PWM_SERVO_2_PIN GPIO1
157
#define PWM_SERVO_2_AF 0
158
#define PWM_SERVO_2_OC TIM_OC2
159
#define PWM_SERVO_2_OC_BIT (1<<1)
160
#else
161
#define PWM_SERVO_2_OC_BIT 0
162
#endif
163
164
#if USE_PWM3
165
#define PWM_SERVO_3 2
166
#define PWM_SERVO_3_TIMER TIM4
167
#define PWM_SERVO_3_GPIO GPIOB
168
#define PWM_SERVO_3_PIN GPIO8
169
#define PWM_SERVO_3_AF 0
170
#define PWM_SERVO_3_OC TIM_OC3
171
#define PWM_SERVO_3_OC_BIT (1<<2)
172
#else
173
#define PWM_SERVO_3_OC_BIT 0
174
#endif
175
176
#if USE_PWM4
177
#define PWM_SERVO_4 3
178
#define PWM_SERVO_4_TIMER TIM4
179
#define PWM_SERVO_4_GPIO GPIOB
180
#define PWM_SERVO_4_PIN GPIO9
181
#define PWM_SERVO_4_AF 0
182
#define PWM_SERVO_4_OC TIM_OC4
183
#define PWM_SERVO_4_OC_BIT (1<<3)
184
#else
185
#define PWM_SERVO_4_OC_BIT 0
186
#endif
187
188
#if USE_PWM5
189
#define PWM_SERVO_5 4
190
#define PWM_SERVO_5_TIMER TIM3
191
#define PWM_SERVO_5_GPIO GPIOA
192
#define PWM_SERVO_5_PIN GPIO6
193
#define PWM_SERVO_5_AF 0
194
#define PWM_SERVO_5_OC TIM_OC1
195
#define PWM_SERVO_5_OC_BIT (1<<0)
196
#else
197
#define PWM_SERVO_5_OC_BIT 0
198
#endif
199
200
#if USE_PWM6
201
#define PWM_SERVO_6 5
202
#define PWM_SERVO_6_TIMER TIM3
203
#define PWM_SERVO_6_GPIO GPIOA
204
#define PWM_SERVO_6_PIN GPIO7
205
#define PWM_SERVO_6_AF 0
206
#define PWM_SERVO_6_OC TIM_OC2
207
#define PWM_SERVO_6_OC_BIT (1<<1)
208
#else
209
#define PWM_SERVO_6_OC_BIT 0
210
#endif
211
212
#if USE_PWM7
213
#define PWM_SERVO_7 6
214
#define PWM_SERVO_7_TIMER TIM3
215
#define PWM_SERVO_7_GPIO GPIOB
216
#define PWM_SERVO_7_PIN GPIO0
217
#define PWM_SERVO_7_AF 0
218
#define PWM_SERVO_7_OC TIM_OC3
219
#define PWM_SERVO_7_OC_BIT (1<<2)
220
#else
221
#define PWM_SERVO_7_OC_BIT 0
222
#endif
223
224
#if USE_PWM8
225
#define PWM_SERVO_8 7
226
#define PWM_SERVO_8_TIMER TIM3
227
#define PWM_SERVO_8_GPIO GPIOB
228
#define PWM_SERVO_8_PIN GPIO1
229
#define PWM_SERVO_8_AF 0
230
#define PWM_SERVO_8_OC TIM_OC4
231
#define PWM_SERVO_8_OC_BIT (1<<3)
232
#else
233
#define PWM_SERVO_8_OC_BIT 0
234
#endif
235
236
/* servos 1-2 on TIM2 */
237
#define PWM_TIM2_CHAN_MASK (PWM_SERVO_1_OC_BIT|PWM_SERVO_2_OC_BIT)
238
/* servos 3-4 on TIM4 */
239
#define PWM_TIM4_CHAN_MASK (PWM_SERVO_3_OC_BIT|PWM_SERVO_4_OC_BIT)
240
/* servos 5-8 on TIM3 */
241
//#define PWM_TIM3_CHAN_MASK (PWM_SERVO_5_OC_BIT|PWM_SERVO_6_OC_BIT|PWM_SERVO_7_OC_BIT|PWM_SERVO_8_OC_BIT)
242
243
/* Default actuators driver */
244
#define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
245
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
246
#define ActuatorsDefaultInit() ActuatorsPwmInit()
247
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
248
249
250
#endif
/* CONFIG_PX4IO_2_4_H */
sw
airborne
boards
px4io_2.4.h
Generated on Sat Feb 9 2019 06:43:48 for Paparazzi UAS by
1.8.8