Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
board.h
Go to the documentation of this file.
1
/*
2
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
#pragma once
18
19
/*
20
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
21
22
Licensed under the Apache License, Version 2.0 (the "License");
23
you may not use this file except in compliance with the License.
24
You may obtain a copy of the License at
25
http://www.apache.org/licenses/LICENSE-2.0
26
Unless required by applicable law or agreed to in writing, software
27
distributed under the License is distributed on an "AS IS" BASIS,
28
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
See the License for the specific language governing permissions and
30
limitations under the License.
31
*/
32
33
/*
34
* Board identifier.
35
*/
36
#define BOARD_ST_APOGEE
37
#define BOARD_NAME "AB/GRZ STM32F4 Apogee 1.0"
38
39
/*
40
* Board oscillators-related settings.
41
* NOTE: LSE fitted.
42
*/
43
#if !defined(STM32_LSECLK)
44
#define STM32_LSECLK 32768
45
#endif
46
47
#if !defined(STM32_HSECLK)
48
#define STM32_HSECLK 16000000
49
#endif
50
51
52
/*
53
* Board voltages.
54
* Required for performance limits calculation.
55
*/
56
#define STM32_VDD 300
57
58
/*
59
* MCU type as defined in the ST header file stm32f4xx.h.
60
*/
61
#define STM32F407xx
62
63
/*
64
* PAPARAZZI CONFIGURATION
65
*/
66
67
68
/*
69
* Concat macro
70
*/
71
#define _CONCAT_BOARD_PARAM(_s1, _s2) _s1 ## _s2
72
#define CONCAT_BOARD_PARAM(_s1, _s2) _CONCAT_BOARD_PARAM(_s1, _s2)
73
74
75
/*
76
* LEDs
77
*/
78
/* red, on PC0 */
79
#ifndef USE_LED_1
80
#define USE_LED_1 1
81
#endif
82
#define LED_1_GPIO GPIOC
83
#define LED_1_GPIO_PIN GPIO0
84
#define LED_1_GPIO_ON gpio_clear
85
#define LED_1_GPIO_OFF gpio_set
86
87
/* orange, on PC13 */
88
#ifndef USE_LED_2
89
#define USE_LED_2 1
90
#endif
91
#define LED_2_GPIO GPIOC
92
#define LED_2_GPIO_PIN GPIO13
93
#define LED_2_GPIO_ON gpio_clear
94
#define LED_2_GPIO_OFF gpio_set
95
96
/* green, on PC1 */
97
#ifndef USE_LED_3
98
#define USE_LED_3 1
99
#endif
100
#define LED_3_GPIO GPIOC
101
#define LED_3_GPIO_PIN GPIO1
102
#define LED_3_GPIO_ON gpio_clear
103
#define LED_3_GPIO_OFF gpio_set
104
105
/* yellow, on PC3 */
106
#ifndef USE_LED_4
107
#define USE_LED_4 1
108
#endif
109
#define LED_4_GPIO GPIOC
110
#define LED_4_GPIO_PIN GPIO3
111
#define LED_4_GPIO_ON gpio_clear
112
#define LED_4_GPIO_OFF gpio_set
113
114
/* AUX1, on PB1, 1 on LED_ON, 0 on LED_OFF */
115
#ifndef USE_LED_5
116
#define USE_LED_5 0
117
#endif
118
#define LED_5_GPIO GPIOB
119
#define LED_5_GPIO_PIN GPIO1
120
#define LED_5_GPIO_ON gpio_set
121
#define LED_5_GPIO_OFF gpio_clear
122
123
/* AUX2, on PC5, 1 on LED_ON, 0 on LED_OFF */
124
#ifndef USE_LED_6
125
#define USE_LED_6 0
126
#endif
127
#define LED_6_GPIO GPIOC
128
#define LED_6_GPIO_PIN GPIO5
129
#define LED_6_GPIO_ON gpio_set
130
#define LED_6_GPIO_OFF gpio_clear
131
132
/* AUX3, on PC4, 1 on LED_ON, 0 on LED_OFF */
133
#ifndef USE_LED_7
134
#define USE_LED_7 0
135
#endif
136
#define LED_7_GPIO GPIOC
137
#define LED_7_GPIO_PIN GPIO4
138
#define LED_7_GPIO_ON gpio_set
139
#define LED_7_GPIO_OFF gpio_clear
140
141
/* AUX4, on PB15, 1 on LED_ON, 0 on LED_OFF */
142
#ifndef USE_LED_8
143
#define USE_LED_8 0
144
#endif
145
#define LED_8_GPIO GPIOB
146
#define LED_8_GPIO_PIN GPIO15
147
#define LED_8_GPIO_ON gpio_set
148
#define LED_8_GPIO_OFF gpio_clear
149
150
/* Power Switch, on PB12 */
151
#define POWER_SWITCH_GPIO GPIOB,GPIO12
152
153
/* Pint to set Uart2 RX polarity, on PB13, output high inverts, low doesn't */
154
#define RC_POLARITY_GPIO_PORT GPIOB
155
#define RC_POLARITY_GPIO_PIN GPIO13
156
157
/*
158
* ADCs
159
*/
160
// AUX 1
161
#if USE_ADC_1
162
#define AD1_1_CHANNEL ADC_CHANNEL_IN9
163
#define ADC_1 AD1_1
164
#define ADC_1_GPIO_PORT GPIOB
165
#define ADC_1_GPIO_PIN GPIO1
166
#endif
167
168
// AUX 2
169
#if USE_ADC_2
170
#define AD1_2_CHANNEL ADC_CHANNEL_IN15
171
#define ADC_2 AD1_2
172
#define ADC_2_GPIO_PORT GPIOC
173
#define ADC_2_GPIO_PIN GPIO5
174
#endif
175
176
// AUX 3
177
#if USE_ADC_3
178
#define AD1_3_CHANNEL ADC_CHANNEL_IN14
179
#define ADC_3 AD1_3
180
#define ADC_3_GPIO_PORT GPIOC
181
#define ADC_3_GPIO_PIN GPIO4
182
#endif
183
184
// Internal ADC for battery enabled by default
185
#ifndef USE_ADC_4
186
#define USE_ADC_4 1
187
#endif
188
#if USE_ADC_4
189
#define AD1_4_CHANNEL ADC_CHANNEL_IN4
190
#define ADC_4 AD1_4
191
#define ADC_4_GPIO_PORT GPIOA
192
#define ADC_4_GPIO_PIN GPIO4
193
#endif
194
195
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
196
#ifndef ADC_CHANNEL_VSUPPLY
197
#define ADC_CHANNEL_VSUPPLY ADC_4
198
#endif
199
200
#define DefaultVoltageOfAdc(adc) (0.006185*adc)
201
202
/*
203
* PWM TIM defines
204
* enable TIM2 and TIM3 by default
205
*/
206
#ifndef USE_PWM_TIM2
207
#define USE_PWM_TIM2 1
208
#endif
209
210
#ifndef USE_PWM_TIM3
211
#define USE_PWM_TIM3 1
212
#endif
213
214
/*
215
* PWM defines
216
*/
217
#ifndef USE_PWM0
218
#define USE_PWM0 1
219
#endif
220
#if USE_PWM0
221
#define PWM_SERVO_0 0
222
#define PWM_SERVO_0_GPIO PAL_PORT(LINE_SERVO0)
223
#define PWM_SERVO_0_PIN PAL_PAD(LINE_SERVO0)
224
#define PWM_SERVO_0_AF AF_LINE_SERVO0
225
#define PWM_SERVO_0_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO0_TIM)
226
#define PWM_SERVO_0_CHANNEL (SERVO0_TIM_CH-1)
227
#define PWM_SERVO_0_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO0_TIM)
228
#endif
229
230
#ifndef USE_PWM1
231
#define USE_PWM1 1
232
#endif
233
#if USE_PWM1
234
#define PWM_SERVO_1 1
235
#define PWM_SERVO_1_GPIO PAL_PORT(LINE_SERVO1)
236
#define PWM_SERVO_1_PIN PAL_PAD(LINE_SERVO1)
237
#define PWM_SERVO_1_AF AF_LINE_SERVO1
238
#define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO1_TIM)
239
#define PWM_SERVO_1_CHANNEL (SERVO1_TIM_CH-1)
240
#define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO1_TIM)
241
#endif
242
243
#ifndef USE_PWM2
244
#define USE_PWM2 1
245
#endif
246
#if USE_PWM2
247
#define PWM_SERVO_2 2
248
#define PWM_SERVO_2_GPIO PAL_PORT(LINE_SERVO2)
249
#define PWM_SERVO_2_PIN PAL_PAD(LINE_SERVO2)
250
#define PWM_SERVO_2_AF AF_LINE_SERVO2
251
#define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO2_TIM)
252
#define PWM_SERVO_2_CHANNEL (SERVO2_TIM_CH-1)
253
#define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO2_TIM)
254
#endif
255
256
#ifndef USE_PWM3
257
#define USE_PWM3 1
258
#endif
259
#if USE_PWM3
260
#define PWM_SERVO_3 3
261
#define PWM_SERVO_3_GPIO PAL_PORT(LINE_SERVO3)
262
#define PWM_SERVO_3_PIN PAL_PAD(LINE_SERVO3)
263
#define PWM_SERVO_3_AF AF_LINE_SERVO3
264
#define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO3_TIM)
265
#define PWM_SERVO_3_CHANNEL (SERVO3_TIM_CH-1)
266
#define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO3_TIM)
267
#endif
268
269
#ifndef USE_PWM4
270
#define USE_PWM4 1
271
#endif
272
#if USE_PWM4
273
#define PWM_SERVO_4 4
274
#define PWM_SERVO_4_GPIO PAL_PORT(LINE_SERVO4)
275
#define PWM_SERVO_4_PIN PAL_PAD(LINE_SERVO4)
276
#define PWM_SERVO_4_AF AF_LINE_SERVO4
277
#define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO4_TIM)
278
#define PWM_SERVO_4_CHANNEL (SERVO4_TIM_CH-1)
279
#define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO4_TIM)
280
#endif
281
282
#ifndef USE_PWM5
283
#define USE_PWM5 1
284
#endif
285
#if USE_PWM5
286
#define PWM_SERVO_5 5
287
#define PWM_SERVO_5_GPIO PAL_PORT(LINE_SERVO5)
288
#define PWM_SERVO_5_PIN PAL_PAD(LINE_SERVO5)
289
#define PWM_SERVO_5_AF AF_LINE_SERVO5
290
#define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO5_TIM)
291
#define PWM_SERVO_5_CHANNEL (SERVO5_TIM_CH-1)
292
#define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO5_TIM)
293
#endif
294
295
#if USE_PWM6
296
#define PWM_SERVO_6 6
297
#define PWM_SERVO_6_GPIO PAL_PORT(LINE_SERVO6)
298
#define PWM_SERVO_6_PIN PAL_PAD(LINE_SERVO6)
299
#define PWM_SERVO_6_AF AF_LINE_SERVO6
300
#define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO6_TIM)
301
#define PWM_SERVO_6_CHANNEL (SERVO6_TIM_CH-1)
302
#define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO6_TIM)
303
#endif
304
308
#ifndef DSHOT_TELEMETRY_DEV
309
#define DSHOT_TELEMETRY_DEV NULL
310
#endif
311
#ifndef USE_DSHOT_TIM2
312
#define USE_DSHOT_TIM2 1
313
#endif
314
#ifndef USE_DSHOT_TIM3
315
#define USE_DSHOT_TIM3 1
316
#endif
317
#if USE_DSHOT_TIM2
// Servo 1, 4, 5
318
#define DSHOT_SERVO_1 1
319
#define DSHOT_SERVO_1_GPIO GPIOA
320
#define DSHOT_SERVO_1_PIN GPIO2
321
#define DSHOT_SERVO_1_AF GPIO_AF1
322
#define DSHOT_SERVO_1_DRIVER DSHOTD2
323
#define DSHOT_SERVO_1_CHANNEL 2
324
#define DSHOT_SERVO_4 4
325
#define DSHOT_SERVO_4_GPIO GPIOB
326
#define DSHOT_SERVO_4_PIN GPIO3
327
#define DSHOT_SERVO_4_AF GPIO_AF1
328
#define DSHOT_SERVO_4_DRIVER DSHOTD2
329
#define DSHOT_SERVO_4_CHANNEL 1
330
#define DSHOT_SERVO_5 5
331
#define DSHOT_SERVO_5_GPIO GPIOA
332
#define DSHOT_SERVO_5_PIN GPIO15
333
#define DSHOT_SERVO_5_AF GPIO_AF1
334
#define DSHOT_SERVO_5_DRIVER DSHOTD2
335
#define DSHOT_SERVO_5_CHANNEL 0
336
#define DSHOT_CONF_TIM2 1
337
#define DSHOT_CONF2_DEF { \
338
.dma_stream = STM32_PWM2_UP_DMA_STREAM, \
339
.dma_channel = STM32_PWM2_UP_DMA_CHANNEL, \
340
.pwmp = &PWMD2, \
341
.tlm_sd = DSHOT_TELEMETRY_DEV, \
342
.dma_buf = &dshot2DmaBuffer, \
343
}
344
#endif
345
#if USE_DSHOT_TIM3
// Servo 0,2,3,6
346
#define DSHOT_SERVO_0 0
347
#define DSHOT_SERVO_0_GPIO GPIOB
348
#define DSHOT_SERVO_0_PIN GPIO0
349
#define DSHOT_SERVO_0_AF GPIO_AF2
350
#define DSHOT_SERVO_0_DRIVER DSHOTD3
351
#define DSHOT_SERVO_0_CHANNEL 2
352
#define DSHOT_SERVO_2 2
353
#define DSHOT_SERVO_2_GPIO GPIOB
354
#define DSHOT_SERVO_2_PIN GPIO5
355
#define DSHOT_SERVO_2_AF GPIO_AF2
356
#define DSHOT_SERVO_2_DRIVER DSHOTD3
357
#define DSHOT_SERVO_2_CHANNEL 1
358
#define DSHOT_SERVO_3 3
359
#define DSHOT_SERVO_3_GPIO GPIOB
360
#define DSHOT_SERVO_3_PIN GPIO4
361
#define DSHOT_SERVO_3_AF GPIO_AF2
362
#define DSHOT_SERVO_3_DRIVER DSHOTD3
363
#define DSHOT_SERVO_3_CHANNEL 0
364
#if USE_DSHOT6
365
// DSHOT6 on AUX1 pin, not activated by default
366
#define DSHOT_SERVO_6 6
367
#define DSHOT_SERVO_6_GPIO GPIOB
368
#define DSHOT_SERVO_6_PIN GPIO1
369
#define DSHOT_SERVO_6_AF GPIO_AF2
370
#define DSHOT_SERVO_6_DRIVER DSHOTD3
371
#define DSHOT_SERVO_6_CHANNEL 3
372
#endif
373
#define DSHOT_CONF_TIM3 1
374
#define DSHOT_CONF3_DEF { \
375
.dma_stream = STM32_PWM3_UP_DMA_STREAM, \
376
.dma_channel = STM32_PWM3_UP_DMA_CHANNEL, \
377
.pwmp = &PWMD3, \
378
.tlm_sd = DSHOT_TELEMETRY_DEV, \
379
.dma_buf = &dshot3DmaBuffer, \
380
}
381
#endif
382
386
#define RC_PPM_TICKS_PER_USEC 2
387
#define PPM_TIMER_FREQUENCY 2000000
388
#define PPM_CHANNEL ICU_CHANNEL_1
389
#define PPM_TIMER ICUD1
390
391
/*
392
* Spektrum
393
*/
394
395
// shorter wait with chibios as the RTC oscillator takes longer to stabilize
396
#define SPEKTRUM_BIND_WAIT 30000
397
398
/* The line that is pulled low at power up to initiate the bind process
399
* PB15: AUX4
400
*/
401
#define SPEKTRUM_BIND_PIN GPIO15
402
#define SPEKTRUM_BIND_PIN_PORT GPIOB
403
404
/* The line used to send the pulse train for the bind process
405
* When using UART2 on Apogee, this as to be a different pin than the uart2 rx
406
* Default pin for this is PA8: PPM_IN
407
*/
408
#ifndef SPEKTRUM_PRIMARY_BIND_CONF_PORT
409
#define SPEKTRUM_PRIMARY_BIND_CONF_PORT GPIOA
410
#define SPEKTRUM_PRIMARY_BIND_CONF_PIN GPIO8
411
#endif
412
413
/*
414
* PWM input
415
*/
416
// PWM_INPUT 1 on PA8 (also PPM IN)
417
#define PWM_INPUT1_ICU ICUD1
418
#define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
419
// PPM in (aka PA8) is used: not compatible with PPM RC receiver
420
#define PWM_INPUT1_GPIO_PORT GPIOA
421
#define PWM_INPUT1_GPIO_PIN GPIO8
422
#define PWM_INPUT1_GPIO_AF GPIO_AF1
423
424
// PWM_INPUT 2 on PA2 (also SERVO 1)
425
#if (USE_PWM1 && USE_PWM_INPUT2)
426
#error "PW1 and PWM_INPUT2 are not compatible"
427
#endif
428
#define PWM_INPUT2_ICU ICUD5
429
#define PWM_INPUT2_CHANNEL ICU_CHANNEL_4
430
#define PWM_INPUT2_GPIO_PORT GPIOA
431
#define PWM_INPUT2_GPIO_PIN GPIO2
432
#define PWM_INPUT2_GPIO_AF GPIO_AF2
433
437
#ifndef I2C1_CLOCK_SPEED
438
#define I2C1_CLOCK_SPEED 400000
439
#endif
440
#if I2C1_CLOCK_SPEED == 400000
441
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
442
#elif I2C1_CLOCK_SPEED == 100000
443
#define I2C1_DUTY_CYCLE STD_DUTY_CYCLE
444
#else
445
#error Invalid I2C1 clock speed
446
#endif
447
#define I2C1_CFG_DEF { \
448
OPMODE_I2C, \
449
I2C1_CLOCK_SPEED, \
450
I2C1_DUTY_CYCLE, \
451
}
452
453
#ifndef I2C2_CLOCK_SPEED
454
#define I2C2_CLOCK_SPEED 400000
455
#endif
456
#if I2C2_CLOCK_SPEED == 400000
457
#define I2C2_DUTY_CYCLE FAST_DUTY_CYCLE_2
458
#elif I2C2_CLOCK_SPEED == 100000
459
#define I2C2_DUTY_CYCLE STD_DUTY_CYCLE
460
#else
461
#error Invalid I2C2 clock speed
462
#endif
463
#define I2C2_CFG_DEF { \
464
OPMODE_I2C, \
465
I2C2_CLOCK_SPEED, \
466
I2C2_DUTY_CYCLE, \
467
}
468
472
#define SPI1_GPIO_AF GPIO_AF5
473
#define SPI1_GPIO_PORT_MISO GPIOA
474
#define SPI1_GPIO_MISO GPIO6
475
#define SPI1_GPIO_PORT_MOSI GPIOA
476
#define SPI1_GPIO_MOSI GPIO7
477
#define SPI1_GPIO_PORT_SCK GPIOA
478
#define SPI1_GPIO_SCK GPIO5
479
480
// SLAVE0 on SPI connector
481
#define SPI_SELECT_SLAVE0_PORT GPIOB
482
#define SPI_SELECT_SLAVE0_PIN GPIO9
483
// SLAVE1 on AUX1
484
#define SPI_SELECT_SLAVE1_PORT GPIOB
485
#define SPI_SELECT_SLAVE1_PIN GPIO1
486
// SLAVE2 on AUX2
487
#define SPI_SELECT_SLAVE2_PORT GPIOC
488
#define SPI_SELECT_SLAVE2_PIN GPIO5
489
// SLAVE3 on AUX3
490
#define SPI_SELECT_SLAVE3_PORT GPIOC
491
#define SPI_SELECT_SLAVE3_PIN GPIO4
492
// SLAVE4 on AUX4
493
#define SPI_SELECT_SLAVE4_PORT GPIOB
494
#define SPI_SELECT_SLAVE4_PIN GPIO15
495
502
#ifndef USE_BARO_BOARD
503
#define USE_BARO_BOARD 1
504
#endif
505
506
/*
507
* Actuators for fixedwing
508
*/
509
/* Default actuators driver */
510
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
511
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
512
#define ActuatorsDefaultInit() ActuatorsPwmInit()
513
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
514
515
519
#define SDIO_D0_PORT GPIOC
520
#define SDIO_D0_PIN SDIO_D0
521
#define SDIO_D1_PORT GPIOC
522
#define SDIO_D1_PIN SDIO_D1
523
#define SDIO_D2_PORT GPIOC
524
#define SDIO_D2_PIN SDIO_D2
525
#define SDIO_D3_PORT GPIOC
526
#define SDIO_D3_PIN SDIO_D3
527
#define SDIO_CK_PORT GPIOC
528
#define SDIO_CK_PIN SDIO_CK
529
#define SDIO_CMD_PORT GPIOD
530
#define SDIO_CMD_PIN SDIO_CMD
531
#define SDIO_AF 12
532
// bat monitoring for file closing
533
#define SDLOG_BAT_ADC ADCD1
534
#define SDLOG_BAT_CHAN AD1_4_CHANNEL
535
// usb led status
536
#define SDLOG_USB_LED 4
537
#define SDLOG_USB_VBUS_PORT GPIOA
538
#define SDLOG_USB_VBUS_PIN GPIO9
539
540
544
#define WS2812D1_GPIO GPIOA
545
#define WS2812D1_PIN GPIO8
546
#define WS2812D1_AF 1
547
#define WS2812D1_CFG_DEF { \
548
.dma_stream = STM32_PWM1_UP_DMA_STREAM, \
549
.dma_channel = STM32_PWM1_UP_DMA_CHANNEL, \
550
.dma_priority = STM32_PWM1_UP_DMA_PRIORITY, \
551
.pwm_channel = 0, \
552
.pwmp = &PWMD1 \
553
}
554
555
556
/*
557
* IO pins assignments.
558
*/
559
#define UART4_TX 0U
560
#define UART4_RX 1U
561
#define SERVO1 2U
562
#define UART2_RX 3U
563
#define ADC1_IN4 4U
564
#define SPI1_SCK 5U
565
#define SPI1_MISO 6U
566
#define SPI1_MOSI 7U
567
#define CU1_CH1 8U
568
#define OTG_FS_VBUS 9U
569
#define USART1_RX 10U
570
#define OTG_FS_DM 11U
571
#define OTG_FS_DP 12U
572
#define SWDIO 13U
573
#define SWCLK 14U
574
#define SERVO5 15U
575
576
#define SERVO0 0U
577
#define SERVO6 1U
578
#define BOOT1 2U
579
#define SERVO4 3U
580
#define SERVO3 4U
581
#define SERVO2 5U
582
#define USART1_TX 6U
583
#define I2C1_SDA 7U
584
#define I2C1_SCL 8U
585
#define SPI1_CS 9U
586
#define I2C2_SCL 10U
587
#define I2C2_SDA 11U
588
#define POWER_SWITCH 12U
589
#define RX2_POL 13U
590
#define SDIO_DETECT 14U
591
#define AUX4 15U
592
593
#define LED1 0U
594
#define LED3 1U
595
#define PC02 2U
596
#define LED4 3U
597
#define AUX3 4U
598
#define AUX2 5U
599
#define USART6_TX 6U
600
#define USART6_RX 7U
601
#define SDIO_D0 8U
602
#define SDIO_D1 9U
603
#define SDIO_D2 10U
604
#define SDIO_D3 11U
605
#define SDIO_CK 12U
606
#define LED2 13U
607
#define OSC32_IN 14U
608
#define OSC32_OUT 15U
609
610
#define PD00 0U
611
#define PD01 1U
612
#define SDIO_CMD 2U
613
#define PD03 3U
614
#define PD04 4U
615
#define PD05 5U
616
#define PD06 6U
617
#define PD07 7U
618
#define PD08 8U
619
#define PD09 9U
620
#define PD10 10U
621
#define PD11 11U
622
#define PD12 12U
623
#define PD13 13U
624
#define PD14 14U
625
#define PD15 15U
626
627
#define PE00 0U
628
#define PE01 1U
629
#define PE02 2U
630
#define PE03 3U
631
#define PE04 4U
632
#define PE05 5U
633
#define PE06 6U
634
#define PE07 7U
635
#define PE08 8U
636
#define PE09 9U
637
#define PE10 10U
638
#define PE11 11U
639
#define PE12 12U
640
#define PE13 13U
641
#define PE14 14U
642
#define PE15 15U
643
644
#define PF00 0U
645
#define PF01 1U
646
#define PF02 2U
647
#define PF03 3U
648
#define PF04 4U
649
#define PF05 5U
650
#define PF06 6U
651
#define PF07 7U
652
#define PF08 8U
653
#define PF09 9U
654
#define PF10 10U
655
#define PF11 11U
656
#define PF12 12U
657
#define PF13 13U
658
#define PF14 14U
659
#define PF15 15U
660
661
#define PG00 0U
662
#define PG01 1U
663
#define PG02 2U
664
#define PG03 3U
665
#define PG04 4U
666
#define PG05 5U
667
#define PG06 6U
668
#define PG07 7U
669
#define PG08 8U
670
#define PG09 9U
671
#define PG10 10U
672
#define PG11 11U
673
#define PG12 12U
674
#define PG13 13U
675
#define PG14 14U
676
#define PG15 15U
677
678
#define OSC_IN 0U
679
#define OSC_OUT 1U
680
#define PH02 2U
681
#define PH03 3U
682
#define PH04 4U
683
#define PH05 5U
684
#define PH06 6U
685
#define PH07 7U
686
#define PH08 8U
687
#define PH09 9U
688
#define PH10 10U
689
#define PH11 11U
690
#define PH12 12U
691
#define PH13 13U
692
#define PH14 14U
693
#define PH15 15U
694
695
#define PI00 0U
696
#define PI01 1U
697
#define PI02 2U
698
#define PI03 3U
699
#define PI04 4U
700
#define PI05 5U
701
#define PI06 6U
702
#define PI07 7U
703
#define PI08 8U
704
#define PI09 9U
705
#define PI10 10U
706
#define PI11 11U
707
#define PI12 12U
708
#define PI13 13U
709
#define PI14 14U
710
#define PI15 15U
711
712
#define PJ00 0U
713
#define PJ01 1U
714
#define PJ02 2U
715
#define PJ03 3U
716
#define PJ04 4U
717
#define PJ05 5U
718
#define PJ06 6U
719
#define PJ07 7U
720
#define PJ08 8U
721
#define PJ09 9U
722
#define PJ10 10U
723
#define PJ11 11U
724
#define PJ12 12U
725
#define PJ13 13U
726
#define PJ14 14U
727
#define PJ15 15U
728
729
#define PK00 0U
730
#define PK01 1U
731
#define PK02 2U
732
#define PK03 3U
733
#define PK04 4U
734
#define PK05 5U
735
#define PK06 6U
736
#define PK07 7U
737
#define PK08 8U
738
#define PK09 9U
739
#define PK10 10U
740
#define PK11 11U
741
#define PK12 12U
742
#define PK13 13U
743
#define PK14 14U
744
#define PK15 15U
745
746
/*
747
* IO lines assignments.
748
*/
749
#define LINE_UART4_TX PAL_LINE(GPIOA, 0U)
750
#define LINE_UART4_RX PAL_LINE(GPIOA, 1U)
751
#define LINE_SERVO1 PAL_LINE(GPIOA, 2U)
752
#define LINE_UART2_RX PAL_LINE(GPIOA, 3U)
753
#define LINE_ADC1_IN4 PAL_LINE(GPIOA, 4U)
754
#define LINE_SPI1_SCK PAL_LINE(GPIOA, 5U)
755
#define LINE_SPI1_MISO PAL_LINE(GPIOA, 6U)
756
#define LINE_SPI1_MOSI PAL_LINE(GPIOA, 7U)
757
#define LINE_CU1_CH1 PAL_LINE(GPIOA, 8U)
758
#define LINE_OTG_FS_VBUS PAL_LINE(GPIOA, 9U)
759
#define LINE_USART1_RX PAL_LINE(GPIOA, 10U)
760
#define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
761
#define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
762
#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
763
#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
764
#define LINE_SERVO5 PAL_LINE(GPIOA, 15U)
765
766
#define LINE_SERVO0 PAL_LINE(GPIOB, 0U)
767
#define LINE_SERVO6 PAL_LINE(GPIOB, 1U)
768
#define LINE_BOOT1 PAL_LINE(GPIOB, 2U)
769
#define LINE_SERVO4 PAL_LINE(GPIOB, 3U)
770
#define LINE_SERVO3 PAL_LINE(GPIOB, 4U)
771
#define LINE_SERVO2 PAL_LINE(GPIOB, 5U)
772
#define LINE_USART1_TX PAL_LINE(GPIOB, 6U)
773
#define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
774
#define LINE_I2C1_SCL PAL_LINE(GPIOB, 8U)
775
#define LINE_SPI1_CS PAL_LINE(GPIOB, 9U)
776
#define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U)
777
#define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U)
778
#define LINE_POWER_SWITCH PAL_LINE(GPIOB, 12U)
779
#define LINE_RX2_POL PAL_LINE(GPIOB, 13U)
780
#define LINE_SDIO_DETECT PAL_LINE(GPIOB, 14U)
781
#define LINE_AUX4 PAL_LINE(GPIOB, 15U)
782
783
#define LINE_LED1 PAL_LINE(GPIOC, 0U)
784
#define LINE_LED3 PAL_LINE(GPIOC, 1U)
785
#define LINE_LED4 PAL_LINE(GPIOC, 3U)
786
#define LINE_AUX3 PAL_LINE(GPIOC, 4U)
787
#define LINE_AUX2 PAL_LINE(GPIOC, 5U)
788
#define LINE_USART6_TX PAL_LINE(GPIOC, 6U)
789
#define LINE_USART6_RX PAL_LINE(GPIOC, 7U)
790
#define LINE_SDIO_D0 PAL_LINE(GPIOC, 8U)
791
#define LINE_SDIO_D1 PAL_LINE(GPIOC, 9U)
792
#define LINE_SDIO_D2 PAL_LINE(GPIOC, 10U)
793
#define LINE_SDIO_D3 PAL_LINE(GPIOC, 11U)
794
#define LINE_SDIO_CK PAL_LINE(GPIOC, 12U)
795
#define LINE_LED2 PAL_LINE(GPIOC, 13U)
796
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
797
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
798
799
#define LINE_SDIO_CMD PAL_LINE(GPIOD, 2U)
800
801
#define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
802
#define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
803
804
805
/*
806
* I/O ports initial setup, this configuration is established soon after reset
807
* in the initialization code.
808
* Please refer to the STM32 Reference Manual for details.
809
*/
810
#define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
811
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
812
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
813
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
814
#define PIN_ODR_LEVEL_LOW(n) (0U << (n))
815
#define PIN_ODR_LEVEL_HIGH(n) (1U << (n))
816
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
817
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
818
#define PIN_OSPEED_SPEED_VERYLOW(n) (0U << ((n) * 2U))
819
#define PIN_OSPEED_SPEED_LOW(n) (1U << ((n) * 2U))
820
#define PIN_OSPEED_SPEED_MEDIUM(n) (2U << ((n) * 2U))
821
#define PIN_OSPEED_SPEED_HIGH(n) (3U << ((n) * 2U))
822
#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
823
#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
824
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
825
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
826
827
#define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(UART4_TX) | \
828
PIN_MODE_ALTERNATE(UART4_RX) | \
829
PIN_MODE_ALTERNATE(SERVO1) | \
830
PIN_MODE_ALTERNATE(UART2_RX) | \
831
PIN_MODE_ANALOG(ADC1_IN4) | \
832
PIN_MODE_ALTERNATE(SPI1_SCK) | \
833
PIN_MODE_ALTERNATE(SPI1_MISO) | \
834
PIN_MODE_ALTERNATE(SPI1_MOSI) | \
835
PIN_MODE_ALTERNATE(CU1_CH1) | \
836
PIN_MODE_INPUT(OTG_FS_VBUS) | \
837
PIN_MODE_ALTERNATE(USART1_RX) | \
838
PIN_MODE_ALTERNATE(OTG_FS_DM) | \
839
PIN_MODE_ALTERNATE(OTG_FS_DP) | \
840
PIN_MODE_ALTERNATE(SWDIO) | \
841
PIN_MODE_ALTERNATE(SWCLK) | \
842
PIN_MODE_ALTERNATE(SERVO5))
843
844
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(UART4_TX) | \
845
PIN_OTYPE_PUSHPULL(UART4_RX) | \
846
PIN_OTYPE_PUSHPULL(SERVO1) | \
847
PIN_OTYPE_PUSHPULL(UART2_RX) | \
848
PIN_OTYPE_PUSHPULL(ADC1_IN4) | \
849
PIN_OTYPE_PUSHPULL(SPI1_SCK) | \
850
PIN_OTYPE_PUSHPULL(SPI1_MISO) | \
851
PIN_OTYPE_PUSHPULL(SPI1_MOSI) | \
852
PIN_OTYPE_PUSHPULL(CU1_CH1) | \
853
PIN_OTYPE_OPENDRAIN(OTG_FS_VBUS) | \
854
PIN_OTYPE_PUSHPULL(USART1_RX) | \
855
PIN_OTYPE_PUSHPULL(OTG_FS_DM) | \
856
PIN_OTYPE_PUSHPULL(OTG_FS_DP) | \
857
PIN_OTYPE_PUSHPULL(SWDIO) | \
858
PIN_OTYPE_PUSHPULL(SWCLK) | \
859
PIN_OTYPE_PUSHPULL(SERVO5))
860
861
#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_SPEED_HIGH(UART4_TX) | \
862
PIN_OSPEED_SPEED_HIGH(UART4_RX) | \
863
PIN_OSPEED_SPEED_HIGH(SERVO1) | \
864
PIN_OSPEED_SPEED_HIGH(UART2_RX) | \
865
PIN_OSPEED_SPEED_VERYLOW(ADC1_IN4) | \
866
PIN_OSPEED_SPEED_HIGH(SPI1_SCK) | \
867
PIN_OSPEED_SPEED_HIGH(SPI1_MISO) | \
868
PIN_OSPEED_SPEED_HIGH(SPI1_MOSI) | \
869
PIN_OSPEED_SPEED_HIGH(CU1_CH1) | \
870
PIN_OSPEED_SPEED_VERYLOW(OTG_FS_VBUS) | \
871
PIN_OSPEED_SPEED_HIGH(USART1_RX) | \
872
PIN_OSPEED_SPEED_HIGH(OTG_FS_DM) | \
873
PIN_OSPEED_SPEED_HIGH(OTG_FS_DP) | \
874
PIN_OSPEED_SPEED_HIGH(SWDIO) | \
875
PIN_OSPEED_SPEED_HIGH(SWCLK) | \
876
PIN_OSPEED_SPEED_HIGH(SERVO5))
877
878
#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(UART4_TX) | \
879
PIN_PUPDR_FLOATING(UART4_RX) | \
880
PIN_PUPDR_FLOATING(SERVO1) | \
881
PIN_PUPDR_FLOATING(UART2_RX) | \
882
PIN_PUPDR_FLOATING(ADC1_IN4) | \
883
PIN_PUPDR_FLOATING(SPI1_SCK) | \
884
PIN_PUPDR_FLOATING(SPI1_MISO) | \
885
PIN_PUPDR_FLOATING(SPI1_MOSI) | \
886
PIN_PUPDR_FLOATING(CU1_CH1) | \
887
PIN_PUPDR_PULLDOWN(OTG_FS_VBUS) | \
888
PIN_PUPDR_FLOATING(USART1_RX) | \
889
PIN_PUPDR_FLOATING(OTG_FS_DM) | \
890
PIN_PUPDR_FLOATING(OTG_FS_DP) | \
891
PIN_PUPDR_FLOATING(SWDIO) | \
892
PIN_PUPDR_FLOATING(SWCLK) | \
893
PIN_PUPDR_FLOATING(SERVO5))
894
895
#define VAL_GPIOA_ODR (PIN_ODR_LEVEL_HIGH(UART4_TX) | \
896
PIN_ODR_LEVEL_HIGH(UART4_RX) | \
897
PIN_ODR_LEVEL_LOW(SERVO1) | \
898
PIN_ODR_LEVEL_HIGH(UART2_RX) | \
899
PIN_ODR_LEVEL_LOW(ADC1_IN4) | \
900
PIN_ODR_LEVEL_HIGH(SPI1_SCK) | \
901
PIN_ODR_LEVEL_HIGH(SPI1_MISO) | \
902
PIN_ODR_LEVEL_HIGH(SPI1_MOSI) | \
903
PIN_ODR_LEVEL_HIGH(CU1_CH1) | \
904
PIN_ODR_LEVEL_LOW(OTG_FS_VBUS) | \
905
PIN_ODR_LEVEL_HIGH(USART1_RX) | \
906
PIN_ODR_LEVEL_HIGH(OTG_FS_DM) | \
907
PIN_ODR_LEVEL_HIGH(OTG_FS_DP) | \
908
PIN_ODR_LEVEL_HIGH(SWDIO) | \
909
PIN_ODR_LEVEL_HIGH(SWCLK) | \
910
PIN_ODR_LEVEL_LOW(SERVO5))
911
912
#define VAL_GPIOA_AFRL (PIN_AFIO_AF(UART4_TX, 8) | \
913
PIN_AFIO_AF(UART4_RX, 8) | \
914
PIN_AFIO_AF(SERVO1, 1) | \
915
PIN_AFIO_AF(UART2_RX, 7) | \
916
PIN_AFIO_AF(ADC1_IN4, 0) | \
917
PIN_AFIO_AF(SPI1_SCK, 5) | \
918
PIN_AFIO_AF(SPI1_MISO, 5) | \
919
PIN_AFIO_AF(SPI1_MOSI, 5))
920
921
#define VAL_GPIOA_AFRH (PIN_AFIO_AF(CU1_CH1, 1) | \
922
PIN_AFIO_AF(OTG_FS_VBUS, 0) | \
923
PIN_AFIO_AF(USART1_RX, 7) | \
924
PIN_AFIO_AF(OTG_FS_DM, 10) | \
925
PIN_AFIO_AF(OTG_FS_DP, 10) | \
926
PIN_AFIO_AF(SWDIO, 0) | \
927
PIN_AFIO_AF(SWCLK, 0) | \
928
PIN_AFIO_AF(SERVO5, 1))
929
930
#define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(SERVO0) | \
931
PIN_MODE_ALTERNATE(SERVO6) | \
932
PIN_MODE_INPUT(BOOT1) | \
933
PIN_MODE_ALTERNATE(SERVO4) | \
934
PIN_MODE_ALTERNATE(SERVO3) | \
935
PIN_MODE_ALTERNATE(SERVO2) | \
936
PIN_MODE_ALTERNATE(USART1_TX) | \
937
PIN_MODE_ALTERNATE(I2C1_SDA) | \
938
PIN_MODE_ALTERNATE(I2C1_SCL) | \
939
PIN_MODE_OUTPUT(SPI1_CS) | \
940
PIN_MODE_ALTERNATE(I2C2_SCL) | \
941
PIN_MODE_ALTERNATE(I2C2_SDA) | \
942
PIN_MODE_OUTPUT(POWER_SWITCH) | \
943
PIN_MODE_OUTPUT(RX2_POL) | \
944
PIN_MODE_INPUT(SDIO_DETECT) | \
945
PIN_MODE_INPUT(AUX4))
946
947
#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(SERVO0) | \
948
PIN_OTYPE_PUSHPULL(SERVO6) | \
949
PIN_OTYPE_OPENDRAIN(BOOT1) | \
950
PIN_OTYPE_PUSHPULL(SERVO4) | \
951
PIN_OTYPE_PUSHPULL(SERVO3) | \
952
PIN_OTYPE_PUSHPULL(SERVO2) | \
953
PIN_OTYPE_PUSHPULL(USART1_TX) | \
954
PIN_OTYPE_OPENDRAIN(I2C1_SDA) | \
955
PIN_OTYPE_OPENDRAIN(I2C1_SCL) | \
956
PIN_OTYPE_PUSHPULL(SPI1_CS) | \
957
PIN_OTYPE_OPENDRAIN(I2C2_SCL) | \
958
PIN_OTYPE_OPENDRAIN(I2C2_SDA) | \
959
PIN_OTYPE_PUSHPULL(POWER_SWITCH) | \
960
PIN_OTYPE_PUSHPULL(RX2_POL) | \
961
PIN_OTYPE_OPENDRAIN(SDIO_DETECT) | \
962
PIN_OTYPE_OPENDRAIN(AUX4))
963
964
#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_SPEED_HIGH(SERVO0) | \
965
PIN_OSPEED_SPEED_HIGH(SERVO6) | \
966
PIN_OSPEED_SPEED_VERYLOW(BOOT1) | \
967
PIN_OSPEED_SPEED_HIGH(SERVO4) | \
968
PIN_OSPEED_SPEED_HIGH(SERVO3) | \
969
PIN_OSPEED_SPEED_HIGH(SERVO2) | \
970
PIN_OSPEED_SPEED_HIGH(USART1_TX) | \
971
PIN_OSPEED_SPEED_HIGH(I2C1_SDA) | \
972
PIN_OSPEED_SPEED_HIGH(I2C1_SCL) | \
973
PIN_OSPEED_SPEED_HIGH(SPI1_CS) | \
974
PIN_OSPEED_SPEED_HIGH(I2C2_SCL) | \
975
PIN_OSPEED_SPEED_HIGH(I2C2_SDA) | \
976
PIN_OSPEED_SPEED_HIGH(POWER_SWITCH) | \
977
PIN_OSPEED_SPEED_HIGH(RX2_POL) | \
978
PIN_OSPEED_SPEED_VERYLOW(SDIO_DETECT) | \
979
PIN_OSPEED_SPEED_VERYLOW(AUX4))
980
981
#define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(SERVO0) | \
982
PIN_PUPDR_FLOATING(SERVO6) | \
983
PIN_PUPDR_FLOATING(BOOT1) | \
984
PIN_PUPDR_FLOATING(SERVO4) | \
985
PIN_PUPDR_FLOATING(SERVO3) | \
986
PIN_PUPDR_FLOATING(SERVO2) | \
987
PIN_PUPDR_FLOATING(USART1_TX) | \
988
PIN_PUPDR_PULLUP(I2C1_SDA) | \
989
PIN_PUPDR_PULLUP(I2C1_SCL) | \
990
PIN_PUPDR_FLOATING(SPI1_CS) | \
991
PIN_PUPDR_PULLUP(I2C2_SCL) | \
992
PIN_PUPDR_PULLUP(I2C2_SDA) | \
993
PIN_PUPDR_FLOATING(POWER_SWITCH) | \
994
PIN_PUPDR_FLOATING(RX2_POL) | \
995
PIN_PUPDR_PULLUP(SDIO_DETECT) | \
996
PIN_PUPDR_FLOATING(AUX4))
997
998
#define VAL_GPIOB_ODR (PIN_ODR_LEVEL_LOW(SERVO0) | \
999
PIN_ODR_LEVEL_LOW(SERVO6) | \
1000
PIN_ODR_LEVEL_LOW(BOOT1) | \
1001
PIN_ODR_LEVEL_LOW(SERVO4) | \
1002
PIN_ODR_LEVEL_LOW(SERVO3) | \
1003
PIN_ODR_LEVEL_LOW(SERVO2) | \
1004
PIN_ODR_LEVEL_HIGH(USART1_TX) | \
1005
PIN_ODR_LEVEL_HIGH(I2C1_SDA) | \
1006
PIN_ODR_LEVEL_HIGH(I2C1_SCL) | \
1007
PIN_ODR_LEVEL_HIGH(SPI1_CS) | \
1008
PIN_ODR_LEVEL_HIGH(I2C2_SCL) | \
1009
PIN_ODR_LEVEL_HIGH(I2C2_SDA) | \
1010
PIN_ODR_LEVEL_HIGH(POWER_SWITCH) | \
1011
PIN_ODR_LEVEL_HIGH(RX2_POL) | \
1012
PIN_ODR_LEVEL_LOW(SDIO_DETECT) | \
1013
PIN_ODR_LEVEL_LOW(AUX4))
1014
1015
#define VAL_GPIOB_AFRL (PIN_AFIO_AF(SERVO0, 2) | \
1016
PIN_AFIO_AF(SERVO6, 2) | \
1017
PIN_AFIO_AF(BOOT1, 0) | \
1018
PIN_AFIO_AF(SERVO4, 1) | \
1019
PIN_AFIO_AF(SERVO3, 2) | \
1020
PIN_AFIO_AF(SERVO2, 2) | \
1021
PIN_AFIO_AF(USART1_TX, 7) | \
1022
PIN_AFIO_AF(I2C1_SDA, 4))
1023
1024
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(I2C1_SCL, 4) | \
1025
PIN_AFIO_AF(SPI1_CS, 0) | \
1026
PIN_AFIO_AF(I2C2_SCL, 4) | \
1027
PIN_AFIO_AF(I2C2_SDA, 4) | \
1028
PIN_AFIO_AF(POWER_SWITCH, 0) | \
1029
PIN_AFIO_AF(RX2_POL, 0) | \
1030
PIN_AFIO_AF(SDIO_DETECT, 0) | \
1031
PIN_AFIO_AF(AUX4, 0))
1032
1033
#define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(LED1) | \
1034
PIN_MODE_OUTPUT(LED3) | \
1035
PIN_MODE_INPUT(PC02) | \
1036
PIN_MODE_OUTPUT(LED4) | \
1037
PIN_MODE_INPUT(AUX3) | \
1038
PIN_MODE_INPUT(AUX2) | \
1039
PIN_MODE_ALTERNATE(USART6_TX) | \
1040
PIN_MODE_ALTERNATE(USART6_RX) | \
1041
PIN_MODE_ALTERNATE(SDIO_D0) | \
1042
PIN_MODE_ALTERNATE(SDIO_D1) | \
1043
PIN_MODE_ALTERNATE(SDIO_D2) | \
1044
PIN_MODE_ALTERNATE(SDIO_D3) | \
1045
PIN_MODE_ALTERNATE(SDIO_CK) | \
1046
PIN_MODE_OUTPUT(LED2) | \
1047
PIN_MODE_ALTERNATE(OSC32_IN) | \
1048
PIN_MODE_ALTERNATE(OSC32_OUT))
1049
1050
#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(LED1) | \
1051
PIN_OTYPE_PUSHPULL(LED3) | \
1052
PIN_OTYPE_PUSHPULL(PC02) | \
1053
PIN_OTYPE_PUSHPULL(LED4) | \
1054
PIN_OTYPE_OPENDRAIN(AUX3) | \
1055
PIN_OTYPE_OPENDRAIN(AUX2) | \
1056
PIN_OTYPE_PUSHPULL(USART6_TX) | \
1057
PIN_OTYPE_PUSHPULL(USART6_RX) | \
1058
PIN_OTYPE_PUSHPULL(SDIO_D0) | \
1059
PIN_OTYPE_PUSHPULL(SDIO_D1) | \
1060
PIN_OTYPE_PUSHPULL(SDIO_D2) | \
1061
PIN_OTYPE_PUSHPULL(SDIO_D3) | \
1062
PIN_OTYPE_PUSHPULL(SDIO_CK) | \
1063
PIN_OTYPE_PUSHPULL(LED2) | \
1064
PIN_OTYPE_PUSHPULL(OSC32_IN) | \
1065
PIN_OTYPE_PUSHPULL(OSC32_OUT))
1066
1067
#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(LED1) | \
1068
PIN_OSPEED_SPEED_VERYLOW(LED3) | \
1069
PIN_OSPEED_SPEED_VERYLOW(PC02) | \
1070
PIN_OSPEED_SPEED_VERYLOW(LED4) | \
1071
PIN_OSPEED_SPEED_VERYLOW(AUX3) | \
1072
PIN_OSPEED_SPEED_VERYLOW(AUX2) | \
1073
PIN_OSPEED_SPEED_HIGH(USART6_TX) | \
1074
PIN_OSPEED_SPEED_HIGH(USART6_RX) | \
1075
PIN_OSPEED_SPEED_HIGH(SDIO_D0) | \
1076
PIN_OSPEED_SPEED_HIGH(SDIO_D1) | \
1077
PIN_OSPEED_SPEED_HIGH(SDIO_D2) | \
1078
PIN_OSPEED_SPEED_HIGH(SDIO_D3) | \
1079
PIN_OSPEED_SPEED_HIGH(SDIO_CK) | \
1080
PIN_OSPEED_SPEED_VERYLOW(LED2) | \
1081
PIN_OSPEED_SPEED_HIGH(OSC32_IN) | \
1082
PIN_OSPEED_SPEED_HIGH(OSC32_OUT))
1083
1084
#define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(LED1) | \
1085
PIN_PUPDR_FLOATING(LED3) | \
1086
PIN_PUPDR_PULLDOWN(PC02) | \
1087
PIN_PUPDR_FLOATING(LED4) | \
1088
PIN_PUPDR_FLOATING(AUX3) | \
1089
PIN_PUPDR_FLOATING(AUX2) | \
1090
PIN_PUPDR_FLOATING(USART6_TX) | \
1091
PIN_PUPDR_FLOATING(USART6_RX) | \
1092
PIN_PUPDR_PULLUP(SDIO_D0) | \
1093
PIN_PUPDR_PULLUP(SDIO_D1) | \
1094
PIN_PUPDR_PULLUP(SDIO_D2) | \
1095
PIN_PUPDR_PULLUP(SDIO_D3) | \
1096
PIN_PUPDR_FLOATING(SDIO_CK) | \
1097
PIN_PUPDR_FLOATING(LED2) | \
1098
PIN_PUPDR_FLOATING(OSC32_IN) | \
1099
PIN_PUPDR_FLOATING(OSC32_OUT))
1100
1101
#define VAL_GPIOC_ODR (PIN_ODR_LEVEL_LOW(LED1) | \
1102
PIN_ODR_LEVEL_LOW(LED3) | \
1103
PIN_ODR_LEVEL_LOW(PC02) | \
1104
PIN_ODR_LEVEL_LOW(LED4) | \
1105
PIN_ODR_LEVEL_LOW(AUX3) | \
1106
PIN_ODR_LEVEL_LOW(AUX2) | \
1107
PIN_ODR_LEVEL_HIGH(USART6_TX) | \
1108
PIN_ODR_LEVEL_HIGH(USART6_RX) | \
1109
PIN_ODR_LEVEL_HIGH(SDIO_D0) | \
1110
PIN_ODR_LEVEL_HIGH(SDIO_D1) | \
1111
PIN_ODR_LEVEL_HIGH(SDIO_D2) | \
1112
PIN_ODR_LEVEL_HIGH(SDIO_D3) | \
1113
PIN_ODR_LEVEL_HIGH(SDIO_CK) | \
1114
PIN_ODR_LEVEL_LOW(LED2) | \
1115
PIN_ODR_LEVEL_HIGH(OSC32_IN) | \
1116
PIN_ODR_LEVEL_HIGH(OSC32_OUT))
1117
1118
#define VAL_GPIOC_AFRL (PIN_AFIO_AF(LED1, 0) | \
1119
PIN_AFIO_AF(LED3, 0) | \
1120
PIN_AFIO_AF(PC02, 0) | \
1121
PIN_AFIO_AF(LED4, 0) | \
1122
PIN_AFIO_AF(AUX3, 0) | \
1123
PIN_AFIO_AF(AUX2, 0) | \
1124
PIN_AFIO_AF(USART6_TX, 8) | \
1125
PIN_AFIO_AF(USART6_RX, 8))
1126
1127
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(SDIO_D0, 12) | \
1128
PIN_AFIO_AF(SDIO_D1, 12) | \
1129
PIN_AFIO_AF(SDIO_D2, 12) | \
1130
PIN_AFIO_AF(SDIO_D3, 12) | \
1131
PIN_AFIO_AF(SDIO_CK, 12) | \
1132
PIN_AFIO_AF(LED2, 0) | \
1133
PIN_AFIO_AF(OSC32_IN, 0) | \
1134
PIN_AFIO_AF(OSC32_OUT, 0))
1135
1136
#define VAL_GPIOD_MODER (PIN_MODE_INPUT(PD00) | \
1137
PIN_MODE_INPUT(PD01) | \
1138
PIN_MODE_ALTERNATE(SDIO_CMD) | \
1139
PIN_MODE_INPUT(PD03) | \
1140
PIN_MODE_INPUT(PD04) | \
1141
PIN_MODE_INPUT(PD05) | \
1142
PIN_MODE_INPUT(PD06) | \
1143
PIN_MODE_INPUT(PD07) | \
1144
PIN_MODE_INPUT(PD08) | \
1145
PIN_MODE_INPUT(PD09) | \
1146
PIN_MODE_INPUT(PD10) | \
1147
PIN_MODE_INPUT(PD11) | \
1148
PIN_MODE_INPUT(PD12) | \
1149
PIN_MODE_INPUT(PD13) | \
1150
PIN_MODE_INPUT(PD14) | \
1151
PIN_MODE_INPUT(PD15))
1152
1153
#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(PD00) | \
1154
PIN_OTYPE_PUSHPULL(PD01) | \
1155
PIN_OTYPE_PUSHPULL(SDIO_CMD) | \
1156
PIN_OTYPE_PUSHPULL(PD03) | \
1157
PIN_OTYPE_PUSHPULL(PD04) | \
1158
PIN_OTYPE_PUSHPULL(PD05) | \
1159
PIN_OTYPE_PUSHPULL(PD06) | \
1160
PIN_OTYPE_PUSHPULL(PD07) | \
1161
PIN_OTYPE_PUSHPULL(PD08) | \
1162
PIN_OTYPE_PUSHPULL(PD09) | \
1163
PIN_OTYPE_PUSHPULL(PD10) | \
1164
PIN_OTYPE_PUSHPULL(PD11) | \
1165
PIN_OTYPE_PUSHPULL(PD12) | \
1166
PIN_OTYPE_PUSHPULL(PD13) | \
1167
PIN_OTYPE_PUSHPULL(PD14) | \
1168
PIN_OTYPE_PUSHPULL(PD15))
1169
1170
#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PD00) | \
1171
PIN_OSPEED_SPEED_VERYLOW(PD01) | \
1172
PIN_OSPEED_SPEED_HIGH(SDIO_CMD) | \
1173
PIN_OSPEED_SPEED_VERYLOW(PD03) | \
1174
PIN_OSPEED_SPEED_VERYLOW(PD04) | \
1175
PIN_OSPEED_SPEED_VERYLOW(PD05) | \
1176
PIN_OSPEED_SPEED_VERYLOW(PD06) | \
1177
PIN_OSPEED_SPEED_VERYLOW(PD07) | \
1178
PIN_OSPEED_SPEED_VERYLOW(PD08) | \
1179
PIN_OSPEED_SPEED_VERYLOW(PD09) | \
1180
PIN_OSPEED_SPEED_VERYLOW(PD10) | \
1181
PIN_OSPEED_SPEED_VERYLOW(PD11) | \
1182
PIN_OSPEED_SPEED_VERYLOW(PD12) | \
1183
PIN_OSPEED_SPEED_VERYLOW(PD13) | \
1184
PIN_OSPEED_SPEED_VERYLOW(PD14) | \
1185
PIN_OSPEED_SPEED_VERYLOW(PD15))
1186
1187
#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLDOWN(PD00) | \
1188
PIN_PUPDR_PULLDOWN(PD01) | \
1189
PIN_PUPDR_PULLUP(SDIO_CMD) | \
1190
PIN_PUPDR_PULLDOWN(PD03) | \
1191
PIN_PUPDR_PULLDOWN(PD04) | \
1192
PIN_PUPDR_PULLDOWN(PD05) | \
1193
PIN_PUPDR_PULLDOWN(PD06) | \
1194
PIN_PUPDR_PULLDOWN(PD07) | \
1195
PIN_PUPDR_PULLDOWN(PD08) | \
1196
PIN_PUPDR_PULLDOWN(PD09) | \
1197
PIN_PUPDR_PULLDOWN(PD10) | \
1198
PIN_PUPDR_PULLDOWN(PD11) | \
1199
PIN_PUPDR_PULLDOWN(PD12) | \
1200
PIN_PUPDR_PULLDOWN(PD13) | \
1201
PIN_PUPDR_PULLDOWN(PD14) | \
1202
PIN_PUPDR_PULLDOWN(PD15))
1203
1204
#define VAL_GPIOD_ODR (PIN_ODR_LEVEL_LOW(PD00) | \
1205
PIN_ODR_LEVEL_LOW(PD01) | \
1206
PIN_ODR_LEVEL_HIGH(SDIO_CMD) | \
1207
PIN_ODR_LEVEL_LOW(PD03) | \
1208
PIN_ODR_LEVEL_LOW(PD04) | \
1209
PIN_ODR_LEVEL_LOW(PD05) | \
1210
PIN_ODR_LEVEL_LOW(PD06) | \
1211
PIN_ODR_LEVEL_LOW(PD07) | \
1212
PIN_ODR_LEVEL_LOW(PD08) | \
1213
PIN_ODR_LEVEL_LOW(PD09) | \
1214
PIN_ODR_LEVEL_LOW(PD10) | \
1215
PIN_ODR_LEVEL_LOW(PD11) | \
1216
PIN_ODR_LEVEL_LOW(PD12) | \
1217
PIN_ODR_LEVEL_LOW(PD13) | \
1218
PIN_ODR_LEVEL_LOW(PD14) | \
1219
PIN_ODR_LEVEL_LOW(PD15))
1220
1221
#define VAL_GPIOD_AFRL (PIN_AFIO_AF(PD00, 0) | \
1222
PIN_AFIO_AF(PD01, 0) | \
1223
PIN_AFIO_AF(SDIO_CMD, 12) | \
1224
PIN_AFIO_AF(PD03, 0) | \
1225
PIN_AFIO_AF(PD04, 0) | \
1226
PIN_AFIO_AF(PD05, 0) | \
1227
PIN_AFIO_AF(PD06, 0) | \
1228
PIN_AFIO_AF(PD07, 0))
1229
1230
#define VAL_GPIOD_AFRH (PIN_AFIO_AF(PD08, 0) | \
1231
PIN_AFIO_AF(PD09, 0) | \
1232
PIN_AFIO_AF(PD10, 0) | \
1233
PIN_AFIO_AF(PD11, 0) | \
1234
PIN_AFIO_AF(PD12, 0) | \
1235
PIN_AFIO_AF(PD13, 0) | \
1236
PIN_AFIO_AF(PD14, 0) | \
1237
PIN_AFIO_AF(PD15, 0))
1238
1239
#define VAL_GPIOE_MODER (PIN_MODE_INPUT(PE00) | \
1240
PIN_MODE_INPUT(PE01) | \
1241
PIN_MODE_INPUT(PE02) | \
1242
PIN_MODE_INPUT(PE03) | \
1243
PIN_MODE_INPUT(PE04) | \
1244
PIN_MODE_INPUT(PE05) | \
1245
PIN_MODE_INPUT(PE06) | \
1246
PIN_MODE_INPUT(PE07) | \
1247
PIN_MODE_INPUT(PE08) | \
1248
PIN_MODE_INPUT(PE09) | \
1249
PIN_MODE_INPUT(PE10) | \
1250
PIN_MODE_INPUT(PE11) | \
1251
PIN_MODE_INPUT(PE12) | \
1252
PIN_MODE_INPUT(PE13) | \
1253
PIN_MODE_INPUT(PE14) | \
1254
PIN_MODE_INPUT(PE15))
1255
1256
#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(PE00) | \
1257
PIN_OTYPE_PUSHPULL(PE01) | \
1258
PIN_OTYPE_PUSHPULL(PE02) | \
1259
PIN_OTYPE_PUSHPULL(PE03) | \
1260
PIN_OTYPE_PUSHPULL(PE04) | \
1261
PIN_OTYPE_PUSHPULL(PE05) | \
1262
PIN_OTYPE_PUSHPULL(PE06) | \
1263
PIN_OTYPE_PUSHPULL(PE07) | \
1264
PIN_OTYPE_PUSHPULL(PE08) | \
1265
PIN_OTYPE_PUSHPULL(PE09) | \
1266
PIN_OTYPE_PUSHPULL(PE10) | \
1267
PIN_OTYPE_PUSHPULL(PE11) | \
1268
PIN_OTYPE_PUSHPULL(PE12) | \
1269
PIN_OTYPE_PUSHPULL(PE13) | \
1270
PIN_OTYPE_PUSHPULL(PE14) | \
1271
PIN_OTYPE_PUSHPULL(PE15))
1272
1273
#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PE00) | \
1274
PIN_OSPEED_SPEED_VERYLOW(PE01) | \
1275
PIN_OSPEED_SPEED_VERYLOW(PE02) | \
1276
PIN_OSPEED_SPEED_VERYLOW(PE03) | \
1277
PIN_OSPEED_SPEED_VERYLOW(PE04) | \
1278
PIN_OSPEED_SPEED_VERYLOW(PE05) | \
1279
PIN_OSPEED_SPEED_VERYLOW(PE06) | \
1280
PIN_OSPEED_SPEED_VERYLOW(PE07) | \
1281
PIN_OSPEED_SPEED_VERYLOW(PE08) | \
1282
PIN_OSPEED_SPEED_VERYLOW(PE09) | \
1283
PIN_OSPEED_SPEED_VERYLOW(PE10) | \
1284
PIN_OSPEED_SPEED_VERYLOW(PE11) | \
1285
PIN_OSPEED_SPEED_VERYLOW(PE12) | \
1286
PIN_OSPEED_SPEED_VERYLOW(PE13) | \
1287
PIN_OSPEED_SPEED_VERYLOW(PE14) | \
1288
PIN_OSPEED_SPEED_VERYLOW(PE15))
1289
1290
#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLDOWN(PE00) | \
1291
PIN_PUPDR_PULLDOWN(PE01) | \
1292
PIN_PUPDR_PULLDOWN(PE02) | \
1293
PIN_PUPDR_PULLDOWN(PE03) | \
1294
PIN_PUPDR_PULLDOWN(PE04) | \
1295
PIN_PUPDR_PULLDOWN(PE05) | \
1296
PIN_PUPDR_PULLDOWN(PE06) | \
1297
PIN_PUPDR_PULLDOWN(PE07) | \
1298
PIN_PUPDR_PULLDOWN(PE08) | \
1299
PIN_PUPDR_PULLDOWN(PE09) | \
1300
PIN_PUPDR_PULLDOWN(PE10) | \
1301
PIN_PUPDR_PULLDOWN(PE11) | \
1302
PIN_PUPDR_PULLDOWN(PE12) | \
1303
PIN_PUPDR_PULLDOWN(PE13) | \
1304
PIN_PUPDR_PULLDOWN(PE14) | \
1305
PIN_PUPDR_PULLDOWN(PE15))
1306
1307
#define VAL_GPIOE_ODR (PIN_ODR_LEVEL_LOW(PE00) | \
1308
PIN_ODR_LEVEL_LOW(PE01) | \
1309
PIN_ODR_LEVEL_LOW(PE02) | \
1310
PIN_ODR_LEVEL_LOW(PE03) | \
1311
PIN_ODR_LEVEL_LOW(PE04) | \
1312
PIN_ODR_LEVEL_LOW(PE05) | \
1313
PIN_ODR_LEVEL_LOW(PE06) | \
1314
PIN_ODR_LEVEL_LOW(PE07) | \
1315
PIN_ODR_LEVEL_LOW(PE08) | \
1316
PIN_ODR_LEVEL_LOW(PE09) | \
1317
PIN_ODR_LEVEL_LOW(PE10) | \
1318
PIN_ODR_LEVEL_LOW(PE11) | \
1319
PIN_ODR_LEVEL_LOW(PE12) | \
1320
PIN_ODR_LEVEL_LOW(PE13) | \
1321
PIN_ODR_LEVEL_LOW(PE14) | \
1322
PIN_ODR_LEVEL_LOW(PE15))
1323
1324
#define VAL_GPIOE_AFRL (PIN_AFIO_AF(PE00, 0) | \
1325
PIN_AFIO_AF(PE01, 0) | \
1326
PIN_AFIO_AF(PE02, 0) | \
1327
PIN_AFIO_AF(PE03, 0) | \
1328
PIN_AFIO_AF(PE04, 0) | \
1329
PIN_AFIO_AF(PE05, 0) | \
1330
PIN_AFIO_AF(PE06, 0) | \
1331
PIN_AFIO_AF(PE07, 0))
1332
1333
#define VAL_GPIOE_AFRH (PIN_AFIO_AF(PE08, 0) | \
1334
PIN_AFIO_AF(PE09, 0) | \
1335
PIN_AFIO_AF(PE10, 0) | \
1336
PIN_AFIO_AF(PE11, 0) | \
1337
PIN_AFIO_AF(PE12, 0) | \
1338
PIN_AFIO_AF(PE13, 0) | \
1339
PIN_AFIO_AF(PE14, 0) | \
1340
PIN_AFIO_AF(PE15, 0))
1341
1342
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(PF00) | \
1343
PIN_MODE_INPUT(PF01) | \
1344
PIN_MODE_INPUT(PF02) | \
1345
PIN_MODE_INPUT(PF03) | \
1346
PIN_MODE_INPUT(PF04) | \
1347
PIN_MODE_INPUT(PF05) | \
1348
PIN_MODE_INPUT(PF06) | \
1349
PIN_MODE_INPUT(PF07) | \
1350
PIN_MODE_INPUT(PF08) | \
1351
PIN_MODE_INPUT(PF09) | \
1352
PIN_MODE_INPUT(PF10) | \
1353
PIN_MODE_INPUT(PF11) | \
1354
PIN_MODE_INPUT(PF12) | \
1355
PIN_MODE_INPUT(PF13) | \
1356
PIN_MODE_INPUT(PF14) | \
1357
PIN_MODE_INPUT(PF15))
1358
1359
#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(PF00) | \
1360
PIN_OTYPE_PUSHPULL(PF01) | \
1361
PIN_OTYPE_PUSHPULL(PF02) | \
1362
PIN_OTYPE_PUSHPULL(PF03) | \
1363
PIN_OTYPE_PUSHPULL(PF04) | \
1364
PIN_OTYPE_PUSHPULL(PF05) | \
1365
PIN_OTYPE_PUSHPULL(PF06) | \
1366
PIN_OTYPE_PUSHPULL(PF07) | \
1367
PIN_OTYPE_PUSHPULL(PF08) | \
1368
PIN_OTYPE_PUSHPULL(PF09) | \
1369
PIN_OTYPE_PUSHPULL(PF10) | \
1370
PIN_OTYPE_PUSHPULL(PF11) | \
1371
PIN_OTYPE_PUSHPULL(PF12) | \
1372
PIN_OTYPE_PUSHPULL(PF13) | \
1373
PIN_OTYPE_PUSHPULL(PF14) | \
1374
PIN_OTYPE_PUSHPULL(PF15))
1375
1376
#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PF00) | \
1377
PIN_OSPEED_SPEED_VERYLOW(PF01) | \
1378
PIN_OSPEED_SPEED_VERYLOW(PF02) | \
1379
PIN_OSPEED_SPEED_VERYLOW(PF03) | \
1380
PIN_OSPEED_SPEED_VERYLOW(PF04) | \
1381
PIN_OSPEED_SPEED_VERYLOW(PF05) | \
1382
PIN_OSPEED_SPEED_VERYLOW(PF06) | \
1383
PIN_OSPEED_SPEED_VERYLOW(PF07) | \
1384
PIN_OSPEED_SPEED_VERYLOW(PF08) | \
1385
PIN_OSPEED_SPEED_VERYLOW(PF09) | \
1386
PIN_OSPEED_SPEED_VERYLOW(PF10) | \
1387
PIN_OSPEED_SPEED_VERYLOW(PF11) | \
1388
PIN_OSPEED_SPEED_VERYLOW(PF12) | \
1389
PIN_OSPEED_SPEED_VERYLOW(PF13) | \
1390
PIN_OSPEED_SPEED_VERYLOW(PF14) | \
1391
PIN_OSPEED_SPEED_VERYLOW(PF15))
1392
1393
#define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLDOWN(PF00) | \
1394
PIN_PUPDR_PULLDOWN(PF01) | \
1395
PIN_PUPDR_PULLDOWN(PF02) | \
1396
PIN_PUPDR_PULLDOWN(PF03) | \
1397
PIN_PUPDR_PULLDOWN(PF04) | \
1398
PIN_PUPDR_PULLDOWN(PF05) | \
1399
PIN_PUPDR_PULLDOWN(PF06) | \
1400
PIN_PUPDR_PULLDOWN(PF07) | \
1401
PIN_PUPDR_PULLDOWN(PF08) | \
1402
PIN_PUPDR_PULLDOWN(PF09) | \
1403
PIN_PUPDR_PULLDOWN(PF10) | \
1404
PIN_PUPDR_PULLDOWN(PF11) | \
1405
PIN_PUPDR_PULLDOWN(PF12) | \
1406
PIN_PUPDR_PULLDOWN(PF13) | \
1407
PIN_PUPDR_PULLDOWN(PF14) | \
1408
PIN_PUPDR_PULLDOWN(PF15))
1409
1410
#define VAL_GPIOF_ODR (PIN_ODR_LEVEL_LOW(PF00) | \
1411
PIN_ODR_LEVEL_LOW(PF01) | \
1412
PIN_ODR_LEVEL_LOW(PF02) | \
1413
PIN_ODR_LEVEL_LOW(PF03) | \
1414
PIN_ODR_LEVEL_LOW(PF04) | \
1415
PIN_ODR_LEVEL_LOW(PF05) | \
1416
PIN_ODR_LEVEL_LOW(PF06) | \
1417
PIN_ODR_LEVEL_LOW(PF07) | \
1418
PIN_ODR_LEVEL_LOW(PF08) | \
1419
PIN_ODR_LEVEL_LOW(PF09) | \
1420
PIN_ODR_LEVEL_LOW(PF10) | \
1421
PIN_ODR_LEVEL_LOW(PF11) | \
1422
PIN_ODR_LEVEL_LOW(PF12) | \
1423
PIN_ODR_LEVEL_LOW(PF13) | \
1424
PIN_ODR_LEVEL_LOW(PF14) | \
1425
PIN_ODR_LEVEL_LOW(PF15))
1426
1427
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(PF00, 0) | \
1428
PIN_AFIO_AF(PF01, 0) | \
1429
PIN_AFIO_AF(PF02, 0) | \
1430
PIN_AFIO_AF(PF03, 0) | \
1431
PIN_AFIO_AF(PF04, 0) | \
1432
PIN_AFIO_AF(PF05, 0) | \
1433
PIN_AFIO_AF(PF06, 0) | \
1434
PIN_AFIO_AF(PF07, 0))
1435
1436
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(PF08, 0) | \
1437
PIN_AFIO_AF(PF09, 0) | \
1438
PIN_AFIO_AF(PF10, 0) | \
1439
PIN_AFIO_AF(PF11, 0) | \
1440
PIN_AFIO_AF(PF12, 0) | \
1441
PIN_AFIO_AF(PF13, 0) | \
1442
PIN_AFIO_AF(PF14, 0) | \
1443
PIN_AFIO_AF(PF15, 0))
1444
1445
#define VAL_GPIOG_MODER (PIN_MODE_INPUT(PG00) | \
1446
PIN_MODE_INPUT(PG01) | \
1447
PIN_MODE_INPUT(PG02) | \
1448
PIN_MODE_INPUT(PG03) | \
1449
PIN_MODE_INPUT(PG04) | \
1450
PIN_MODE_INPUT(PG05) | \
1451
PIN_MODE_INPUT(PG06) | \
1452
PIN_MODE_INPUT(PG07) | \
1453
PIN_MODE_INPUT(PG08) | \
1454
PIN_MODE_INPUT(PG09) | \
1455
PIN_MODE_INPUT(PG10) | \
1456
PIN_MODE_INPUT(PG11) | \
1457
PIN_MODE_INPUT(PG12) | \
1458
PIN_MODE_INPUT(PG13) | \
1459
PIN_MODE_INPUT(PG14) | \
1460
PIN_MODE_INPUT(PG15))
1461
1462
#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(PG00) | \
1463
PIN_OTYPE_PUSHPULL(PG01) | \
1464
PIN_OTYPE_PUSHPULL(PG02) | \
1465
PIN_OTYPE_PUSHPULL(PG03) | \
1466
PIN_OTYPE_PUSHPULL(PG04) | \
1467
PIN_OTYPE_PUSHPULL(PG05) | \
1468
PIN_OTYPE_PUSHPULL(PG06) | \
1469
PIN_OTYPE_PUSHPULL(PG07) | \
1470
PIN_OTYPE_PUSHPULL(PG08) | \
1471
PIN_OTYPE_PUSHPULL(PG09) | \
1472
PIN_OTYPE_PUSHPULL(PG10) | \
1473
PIN_OTYPE_PUSHPULL(PG11) | \
1474
PIN_OTYPE_PUSHPULL(PG12) | \
1475
PIN_OTYPE_PUSHPULL(PG13) | \
1476
PIN_OTYPE_PUSHPULL(PG14) | \
1477
PIN_OTYPE_PUSHPULL(PG15))
1478
1479
#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PG00) | \
1480
PIN_OSPEED_SPEED_VERYLOW(PG01) | \
1481
PIN_OSPEED_SPEED_VERYLOW(PG02) | \
1482
PIN_OSPEED_SPEED_VERYLOW(PG03) | \
1483
PIN_OSPEED_SPEED_VERYLOW(PG04) | \
1484
PIN_OSPEED_SPEED_VERYLOW(PG05) | \
1485
PIN_OSPEED_SPEED_VERYLOW(PG06) | \
1486
PIN_OSPEED_SPEED_VERYLOW(PG07) | \
1487
PIN_OSPEED_SPEED_VERYLOW(PG08) | \
1488
PIN_OSPEED_SPEED_VERYLOW(PG09) | \
1489
PIN_OSPEED_SPEED_VERYLOW(PG10) | \
1490
PIN_OSPEED_SPEED_VERYLOW(PG11) | \
1491
PIN_OSPEED_SPEED_VERYLOW(PG12) | \
1492
PIN_OSPEED_SPEED_VERYLOW(PG13) | \
1493
PIN_OSPEED_SPEED_VERYLOW(PG14) | \
1494
PIN_OSPEED_SPEED_VERYLOW(PG15))
1495
1496
#define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLDOWN(PG00) | \
1497
PIN_PUPDR_PULLDOWN(PG01) | \
1498
PIN_PUPDR_PULLDOWN(PG02) | \
1499
PIN_PUPDR_PULLDOWN(PG03) | \
1500
PIN_PUPDR_PULLDOWN(PG04) | \
1501
PIN_PUPDR_PULLDOWN(PG05) | \
1502
PIN_PUPDR_PULLDOWN(PG06) | \
1503
PIN_PUPDR_PULLDOWN(PG07) | \
1504
PIN_PUPDR_PULLDOWN(PG08) | \
1505
PIN_PUPDR_PULLDOWN(PG09) | \
1506
PIN_PUPDR_PULLDOWN(PG10) | \
1507
PIN_PUPDR_PULLDOWN(PG11) | \
1508
PIN_PUPDR_PULLDOWN(PG12) | \
1509
PIN_PUPDR_PULLDOWN(PG13) | \
1510
PIN_PUPDR_PULLDOWN(PG14) | \
1511
PIN_PUPDR_PULLDOWN(PG15))
1512
1513
#define VAL_GPIOG_ODR (PIN_ODR_LEVEL_LOW(PG00) | \
1514
PIN_ODR_LEVEL_LOW(PG01) | \
1515
PIN_ODR_LEVEL_LOW(PG02) | \
1516
PIN_ODR_LEVEL_LOW(PG03) | \
1517
PIN_ODR_LEVEL_LOW(PG04) | \
1518
PIN_ODR_LEVEL_LOW(PG05) | \
1519
PIN_ODR_LEVEL_LOW(PG06) | \
1520
PIN_ODR_LEVEL_LOW(PG07) | \
1521
PIN_ODR_LEVEL_LOW(PG08) | \
1522
PIN_ODR_LEVEL_LOW(PG09) | \
1523
PIN_ODR_LEVEL_LOW(PG10) | \
1524
PIN_ODR_LEVEL_LOW(PG11) | \
1525
PIN_ODR_LEVEL_LOW(PG12) | \
1526
PIN_ODR_LEVEL_LOW(PG13) | \
1527
PIN_ODR_LEVEL_LOW(PG14) | \
1528
PIN_ODR_LEVEL_LOW(PG15))
1529
1530
#define VAL_GPIOG_AFRL (PIN_AFIO_AF(PG00, 0) | \
1531
PIN_AFIO_AF(PG01, 0) | \
1532
PIN_AFIO_AF(PG02, 0) | \
1533
PIN_AFIO_AF(PG03, 0) | \
1534
PIN_AFIO_AF(PG04, 0) | \
1535
PIN_AFIO_AF(PG05, 0) | \
1536
PIN_AFIO_AF(PG06, 0) | \
1537
PIN_AFIO_AF(PG07, 0))
1538
1539
#define VAL_GPIOG_AFRH (PIN_AFIO_AF(PG08, 0) | \
1540
PIN_AFIO_AF(PG09, 0) | \
1541
PIN_AFIO_AF(PG10, 0) | \
1542
PIN_AFIO_AF(PG11, 0) | \
1543
PIN_AFIO_AF(PG12, 0) | \
1544
PIN_AFIO_AF(PG13, 0) | \
1545
PIN_AFIO_AF(PG14, 0) | \
1546
PIN_AFIO_AF(PG15, 0))
1547
1548
#define VAL_GPIOH_MODER (PIN_MODE_ALTERNATE(OSC_IN) | \
1549
PIN_MODE_ALTERNATE(OSC_OUT) | \
1550
PIN_MODE_INPUT(PH02) | \
1551
PIN_MODE_INPUT(PH03) | \
1552
PIN_MODE_INPUT(PH04) | \
1553
PIN_MODE_INPUT(PH05) | \
1554
PIN_MODE_INPUT(PH06) | \
1555
PIN_MODE_INPUT(PH07) | \
1556
PIN_MODE_INPUT(PH08) | \
1557
PIN_MODE_INPUT(PH09) | \
1558
PIN_MODE_INPUT(PH10) | \
1559
PIN_MODE_INPUT(PH11) | \
1560
PIN_MODE_INPUT(PH12) | \
1561
PIN_MODE_INPUT(PH13) | \
1562
PIN_MODE_INPUT(PH14) | \
1563
PIN_MODE_INPUT(PH15))
1564
1565
#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(OSC_IN) | \
1566
PIN_OTYPE_PUSHPULL(OSC_OUT) | \
1567
PIN_OTYPE_PUSHPULL(PH02) | \
1568
PIN_OTYPE_PUSHPULL(PH03) | \
1569
PIN_OTYPE_PUSHPULL(PH04) | \
1570
PIN_OTYPE_PUSHPULL(PH05) | \
1571
PIN_OTYPE_PUSHPULL(PH06) | \
1572
PIN_OTYPE_PUSHPULL(PH07) | \
1573
PIN_OTYPE_PUSHPULL(PH08) | \
1574
PIN_OTYPE_PUSHPULL(PH09) | \
1575
PIN_OTYPE_PUSHPULL(PH10) | \
1576
PIN_OTYPE_PUSHPULL(PH11) | \
1577
PIN_OTYPE_PUSHPULL(PH12) | \
1578
PIN_OTYPE_PUSHPULL(PH13) | \
1579
PIN_OTYPE_PUSHPULL(PH14) | \
1580
PIN_OTYPE_PUSHPULL(PH15))
1581
1582
#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_SPEED_HIGH(OSC_IN) | \
1583
PIN_OSPEED_SPEED_HIGH(OSC_OUT) | \
1584
PIN_OSPEED_SPEED_VERYLOW(PH02) | \
1585
PIN_OSPEED_SPEED_VERYLOW(PH03) | \
1586
PIN_OSPEED_SPEED_VERYLOW(PH04) | \
1587
PIN_OSPEED_SPEED_VERYLOW(PH05) | \
1588
PIN_OSPEED_SPEED_VERYLOW(PH06) | \
1589
PIN_OSPEED_SPEED_VERYLOW(PH07) | \
1590
PIN_OSPEED_SPEED_VERYLOW(PH08) | \
1591
PIN_OSPEED_SPEED_VERYLOW(PH09) | \
1592
PIN_OSPEED_SPEED_VERYLOW(PH10) | \
1593
PIN_OSPEED_SPEED_VERYLOW(PH11) | \
1594
PIN_OSPEED_SPEED_VERYLOW(PH12) | \
1595
PIN_OSPEED_SPEED_VERYLOW(PH13) | \
1596
PIN_OSPEED_SPEED_VERYLOW(PH14) | \
1597
PIN_OSPEED_SPEED_VERYLOW(PH15))
1598
1599
#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(OSC_IN) | \
1600
PIN_PUPDR_FLOATING(OSC_OUT) | \
1601
PIN_PUPDR_PULLDOWN(PH02) | \
1602
PIN_PUPDR_PULLDOWN(PH03) | \
1603
PIN_PUPDR_PULLDOWN(PH04) | \
1604
PIN_PUPDR_PULLDOWN(PH05) | \
1605
PIN_PUPDR_PULLDOWN(PH06) | \
1606
PIN_PUPDR_PULLDOWN(PH07) | \
1607
PIN_PUPDR_PULLDOWN(PH08) | \
1608
PIN_PUPDR_PULLDOWN(PH09) | \
1609
PIN_PUPDR_PULLDOWN(PH10) | \
1610
PIN_PUPDR_PULLDOWN(PH11) | \
1611
PIN_PUPDR_PULLDOWN(PH12) | \
1612
PIN_PUPDR_PULLDOWN(PH13) | \
1613
PIN_PUPDR_PULLDOWN(PH14) | \
1614
PIN_PUPDR_PULLDOWN(PH15))
1615
1616
#define VAL_GPIOH_ODR (PIN_ODR_LEVEL_HIGH(OSC_IN) | \
1617
PIN_ODR_LEVEL_HIGH(OSC_OUT) | \
1618
PIN_ODR_LEVEL_LOW(PH02) | \
1619
PIN_ODR_LEVEL_LOW(PH03) | \
1620
PIN_ODR_LEVEL_LOW(PH04) | \
1621
PIN_ODR_LEVEL_LOW(PH05) | \
1622
PIN_ODR_LEVEL_LOW(PH06) | \
1623
PIN_ODR_LEVEL_LOW(PH07) | \
1624
PIN_ODR_LEVEL_LOW(PH08) | \
1625
PIN_ODR_LEVEL_LOW(PH09) | \
1626
PIN_ODR_LEVEL_LOW(PH10) | \
1627
PIN_ODR_LEVEL_LOW(PH11) | \
1628
PIN_ODR_LEVEL_LOW(PH12) | \
1629
PIN_ODR_LEVEL_LOW(PH13) | \
1630
PIN_ODR_LEVEL_LOW(PH14) | \
1631
PIN_ODR_LEVEL_LOW(PH15))
1632
1633
#define VAL_GPIOH_AFRL (PIN_AFIO_AF(OSC_IN, 0) | \
1634
PIN_AFIO_AF(OSC_OUT, 0) | \
1635
PIN_AFIO_AF(PH02, 0) | \
1636
PIN_AFIO_AF(PH03, 0) | \
1637
PIN_AFIO_AF(PH04, 0) | \
1638
PIN_AFIO_AF(PH05, 0) | \
1639
PIN_AFIO_AF(PH06, 0) | \
1640
PIN_AFIO_AF(PH07, 0))
1641
1642
#define VAL_GPIOH_AFRH (PIN_AFIO_AF(PH08, 0) | \
1643
PIN_AFIO_AF(PH09, 0) | \
1644
PIN_AFIO_AF(PH10, 0) | \
1645
PIN_AFIO_AF(PH11, 0) | \
1646
PIN_AFIO_AF(PH12, 0) | \
1647
PIN_AFIO_AF(PH13, 0) | \
1648
PIN_AFIO_AF(PH14, 0) | \
1649
PIN_AFIO_AF(PH15, 0))
1650
1651
#define VAL_GPIOI_MODER (PIN_MODE_INPUT(PI00) | \
1652
PIN_MODE_INPUT(PI01) | \
1653
PIN_MODE_INPUT(PI02) | \
1654
PIN_MODE_INPUT(PI03) | \
1655
PIN_MODE_INPUT(PI04) | \
1656
PIN_MODE_INPUT(PI05) | \
1657
PIN_MODE_INPUT(PI06) | \
1658
PIN_MODE_INPUT(PI07) | \
1659
PIN_MODE_INPUT(PI08) | \
1660
PIN_MODE_INPUT(PI09) | \
1661
PIN_MODE_INPUT(PI10) | \
1662
PIN_MODE_INPUT(PI11) | \
1663
PIN_MODE_INPUT(PI12) | \
1664
PIN_MODE_INPUT(PI13) | \
1665
PIN_MODE_INPUT(PI14) | \
1666
PIN_MODE_INPUT(PI15))
1667
1668
#define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(PI00) | \
1669
PIN_OTYPE_PUSHPULL(PI01) | \
1670
PIN_OTYPE_PUSHPULL(PI02) | \
1671
PIN_OTYPE_PUSHPULL(PI03) | \
1672
PIN_OTYPE_PUSHPULL(PI04) | \
1673
PIN_OTYPE_PUSHPULL(PI05) | \
1674
PIN_OTYPE_PUSHPULL(PI06) | \
1675
PIN_OTYPE_PUSHPULL(PI07) | \
1676
PIN_OTYPE_PUSHPULL(PI08) | \
1677
PIN_OTYPE_PUSHPULL(PI09) | \
1678
PIN_OTYPE_PUSHPULL(PI10) | \
1679
PIN_OTYPE_PUSHPULL(PI11) | \
1680
PIN_OTYPE_PUSHPULL(PI12) | \
1681
PIN_OTYPE_PUSHPULL(PI13) | \
1682
PIN_OTYPE_PUSHPULL(PI14) | \
1683
PIN_OTYPE_PUSHPULL(PI15))
1684
1685
#define VAL_GPIOI_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PI00) | \
1686
PIN_OSPEED_SPEED_VERYLOW(PI01) | \
1687
PIN_OSPEED_SPEED_VERYLOW(PI02) | \
1688
PIN_OSPEED_SPEED_VERYLOW(PI03) | \
1689
PIN_OSPEED_SPEED_VERYLOW(PI04) | \
1690
PIN_OSPEED_SPEED_VERYLOW(PI05) | \
1691
PIN_OSPEED_SPEED_VERYLOW(PI06) | \
1692
PIN_OSPEED_SPEED_VERYLOW(PI07) | \
1693
PIN_OSPEED_SPEED_VERYLOW(PI08) | \
1694
PIN_OSPEED_SPEED_VERYLOW(PI09) | \
1695
PIN_OSPEED_SPEED_VERYLOW(PI10) | \
1696
PIN_OSPEED_SPEED_VERYLOW(PI11) | \
1697
PIN_OSPEED_SPEED_VERYLOW(PI12) | \
1698
PIN_OSPEED_SPEED_VERYLOW(PI13) | \
1699
PIN_OSPEED_SPEED_VERYLOW(PI14) | \
1700
PIN_OSPEED_SPEED_VERYLOW(PI15))
1701
1702
#define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLDOWN(PI00) | \
1703
PIN_PUPDR_PULLDOWN(PI01) | \
1704
PIN_PUPDR_PULLDOWN(PI02) | \
1705
PIN_PUPDR_PULLDOWN(PI03) | \
1706
PIN_PUPDR_PULLDOWN(PI04) | \
1707
PIN_PUPDR_PULLDOWN(PI05) | \
1708
PIN_PUPDR_PULLDOWN(PI06) | \
1709
PIN_PUPDR_PULLDOWN(PI07) | \
1710
PIN_PUPDR_PULLDOWN(PI08) | \
1711
PIN_PUPDR_PULLDOWN(PI09) | \
1712
PIN_PUPDR_PULLDOWN(PI10) | \
1713
PIN_PUPDR_PULLDOWN(PI11) | \
1714
PIN_PUPDR_PULLDOWN(PI12) | \
1715
PIN_PUPDR_PULLDOWN(PI13) | \
1716
PIN_PUPDR_PULLDOWN(PI14) | \
1717
PIN_PUPDR_PULLDOWN(PI15))
1718
1719
#define VAL_GPIOI_ODR (PIN_ODR_LEVEL_LOW(PI00) | \
1720
PIN_ODR_LEVEL_LOW(PI01) | \
1721
PIN_ODR_LEVEL_LOW(PI02) | \
1722
PIN_ODR_LEVEL_LOW(PI03) | \
1723
PIN_ODR_LEVEL_LOW(PI04) | \
1724
PIN_ODR_LEVEL_LOW(PI05) | \
1725
PIN_ODR_LEVEL_LOW(PI06) | \
1726
PIN_ODR_LEVEL_LOW(PI07) | \
1727
PIN_ODR_LEVEL_LOW(PI08) | \
1728
PIN_ODR_LEVEL_LOW(PI09) | \
1729
PIN_ODR_LEVEL_LOW(PI10) | \
1730
PIN_ODR_LEVEL_LOW(PI11) | \
1731
PIN_ODR_LEVEL_LOW(PI12) | \
1732
PIN_ODR_LEVEL_LOW(PI13) | \
1733
PIN_ODR_LEVEL_LOW(PI14) | \
1734
PIN_ODR_LEVEL_LOW(PI15))
1735
1736
#define VAL_GPIOI_AFRL (PIN_AFIO_AF(PI00, 0) | \
1737
PIN_AFIO_AF(PI01, 0) | \
1738
PIN_AFIO_AF(PI02, 0) | \
1739
PIN_AFIO_AF(PI03, 0) | \
1740
PIN_AFIO_AF(PI04, 0) | \
1741
PIN_AFIO_AF(PI05, 0) | \
1742
PIN_AFIO_AF(PI06, 0) | \
1743
PIN_AFIO_AF(PI07, 0))
1744
1745
#define VAL_GPIOI_AFRH (PIN_AFIO_AF(PI08, 0) | \
1746
PIN_AFIO_AF(PI09, 0) | \
1747
PIN_AFIO_AF(PI10, 0) | \
1748
PIN_AFIO_AF(PI11, 0) | \
1749
PIN_AFIO_AF(PI12, 0) | \
1750
PIN_AFIO_AF(PI13, 0) | \
1751
PIN_AFIO_AF(PI14, 0) | \
1752
PIN_AFIO_AF(PI15, 0))
1753
1754
#define VAL_GPIOJ_MODER (PIN_MODE_INPUT(PJ00) | \
1755
PIN_MODE_INPUT(PJ01) | \
1756
PIN_MODE_INPUT(PJ02) | \
1757
PIN_MODE_INPUT(PJ03) | \
1758
PIN_MODE_INPUT(PJ04) | \
1759
PIN_MODE_INPUT(PJ05) | \
1760
PIN_MODE_INPUT(PJ06) | \
1761
PIN_MODE_INPUT(PJ07) | \
1762
PIN_MODE_INPUT(PJ08) | \
1763
PIN_MODE_INPUT(PJ09) | \
1764
PIN_MODE_INPUT(PJ10) | \
1765
PIN_MODE_INPUT(PJ11) | \
1766
PIN_MODE_INPUT(PJ12) | \
1767
PIN_MODE_INPUT(PJ13) | \
1768
PIN_MODE_INPUT(PJ14) | \
1769
PIN_MODE_INPUT(PJ15))
1770
1771
#define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(PJ00) | \
1772
PIN_OTYPE_PUSHPULL(PJ01) | \
1773
PIN_OTYPE_PUSHPULL(PJ02) | \
1774
PIN_OTYPE_PUSHPULL(PJ03) | \
1775
PIN_OTYPE_PUSHPULL(PJ04) | \
1776
PIN_OTYPE_PUSHPULL(PJ05) | \
1777
PIN_OTYPE_PUSHPULL(PJ06) | \
1778
PIN_OTYPE_PUSHPULL(PJ07) | \
1779
PIN_OTYPE_PUSHPULL(PJ08) | \
1780
PIN_OTYPE_PUSHPULL(PJ09) | \
1781
PIN_OTYPE_PUSHPULL(PJ10) | \
1782
PIN_OTYPE_PUSHPULL(PJ11) | \
1783
PIN_OTYPE_PUSHPULL(PJ12) | \
1784
PIN_OTYPE_PUSHPULL(PJ13) | \
1785
PIN_OTYPE_PUSHPULL(PJ14) | \
1786
PIN_OTYPE_PUSHPULL(PJ15))
1787
1788
#define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PJ00) | \
1789
PIN_OSPEED_SPEED_VERYLOW(PJ01) | \
1790
PIN_OSPEED_SPEED_VERYLOW(PJ02) | \
1791
PIN_OSPEED_SPEED_VERYLOW(PJ03) | \
1792
PIN_OSPEED_SPEED_VERYLOW(PJ04) | \
1793
PIN_OSPEED_SPEED_VERYLOW(PJ05) | \
1794
PIN_OSPEED_SPEED_VERYLOW(PJ06) | \
1795
PIN_OSPEED_SPEED_VERYLOW(PJ07) | \
1796
PIN_OSPEED_SPEED_VERYLOW(PJ08) | \
1797
PIN_OSPEED_SPEED_VERYLOW(PJ09) | \
1798
PIN_OSPEED_SPEED_VERYLOW(PJ10) | \
1799
PIN_OSPEED_SPEED_VERYLOW(PJ11) | \
1800
PIN_OSPEED_SPEED_VERYLOW(PJ12) | \
1801
PIN_OSPEED_SPEED_VERYLOW(PJ13) | \
1802
PIN_OSPEED_SPEED_VERYLOW(PJ14) | \
1803
PIN_OSPEED_SPEED_VERYLOW(PJ15))
1804
1805
#define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLDOWN(PJ00) | \
1806
PIN_PUPDR_PULLDOWN(PJ01) | \
1807
PIN_PUPDR_PULLDOWN(PJ02) | \
1808
PIN_PUPDR_PULLDOWN(PJ03) | \
1809
PIN_PUPDR_PULLDOWN(PJ04) | \
1810
PIN_PUPDR_PULLDOWN(PJ05) | \
1811
PIN_PUPDR_PULLDOWN(PJ06) | \
1812
PIN_PUPDR_PULLDOWN(PJ07) | \
1813
PIN_PUPDR_PULLDOWN(PJ08) | \
1814
PIN_PUPDR_PULLDOWN(PJ09) | \
1815
PIN_PUPDR_PULLDOWN(PJ10) | \
1816
PIN_PUPDR_PULLDOWN(PJ11) | \
1817
PIN_PUPDR_PULLDOWN(PJ12) | \
1818
PIN_PUPDR_PULLDOWN(PJ13) | \
1819
PIN_PUPDR_PULLDOWN(PJ14) | \
1820
PIN_PUPDR_PULLDOWN(PJ15))
1821
1822
#define VAL_GPIOJ_ODR (PIN_ODR_LEVEL_LOW(PJ00) | \
1823
PIN_ODR_LEVEL_LOW(PJ01) | \
1824
PIN_ODR_LEVEL_LOW(PJ02) | \
1825
PIN_ODR_LEVEL_LOW(PJ03) | \
1826
PIN_ODR_LEVEL_LOW(PJ04) | \
1827
PIN_ODR_LEVEL_LOW(PJ05) | \
1828
PIN_ODR_LEVEL_LOW(PJ06) | \
1829
PIN_ODR_LEVEL_LOW(PJ07) | \
1830
PIN_ODR_LEVEL_LOW(PJ08) | \
1831
PIN_ODR_LEVEL_LOW(PJ09) | \
1832
PIN_ODR_LEVEL_LOW(PJ10) | \
1833
PIN_ODR_LEVEL_LOW(PJ11) | \
1834
PIN_ODR_LEVEL_LOW(PJ12) | \
1835
PIN_ODR_LEVEL_LOW(PJ13) | \
1836
PIN_ODR_LEVEL_LOW(PJ14) | \
1837
PIN_ODR_LEVEL_LOW(PJ15))
1838
1839
#define VAL_GPIOJ_AFRL (PIN_AFIO_AF(PJ00, 0) | \
1840
PIN_AFIO_AF(PJ01, 0) | \
1841
PIN_AFIO_AF(PJ02, 0) | \
1842
PIN_AFIO_AF(PJ03, 0) | \
1843
PIN_AFIO_AF(PJ04, 0) | \
1844
PIN_AFIO_AF(PJ05, 0) | \
1845
PIN_AFIO_AF(PJ06, 0) | \
1846
PIN_AFIO_AF(PJ07, 0))
1847
1848
#define VAL_GPIOJ_AFRH (PIN_AFIO_AF(PJ08, 0) | \
1849
PIN_AFIO_AF(PJ09, 0) | \
1850
PIN_AFIO_AF(PJ10, 0) | \
1851
PIN_AFIO_AF(PJ11, 0) | \
1852
PIN_AFIO_AF(PJ12, 0) | \
1853
PIN_AFIO_AF(PJ13, 0) | \
1854
PIN_AFIO_AF(PJ14, 0) | \
1855
PIN_AFIO_AF(PJ15, 0))
1856
1857
#define VAL_GPIOK_MODER (PIN_MODE_INPUT(PK00) | \
1858
PIN_MODE_INPUT(PK01) | \
1859
PIN_MODE_INPUT(PK02) | \
1860
PIN_MODE_INPUT(PK03) | \
1861
PIN_MODE_INPUT(PK04) | \
1862
PIN_MODE_INPUT(PK05) | \
1863
PIN_MODE_INPUT(PK06) | \
1864
PIN_MODE_INPUT(PK07) | \
1865
PIN_MODE_INPUT(PK08) | \
1866
PIN_MODE_INPUT(PK09) | \
1867
PIN_MODE_INPUT(PK10) | \
1868
PIN_MODE_INPUT(PK11) | \
1869
PIN_MODE_INPUT(PK12) | \
1870
PIN_MODE_INPUT(PK13) | \
1871
PIN_MODE_INPUT(PK14) | \
1872
PIN_MODE_INPUT(PK15))
1873
1874
#define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(PK00) | \
1875
PIN_OTYPE_PUSHPULL(PK01) | \
1876
PIN_OTYPE_PUSHPULL(PK02) | \
1877
PIN_OTYPE_PUSHPULL(PK03) | \
1878
PIN_OTYPE_PUSHPULL(PK04) | \
1879
PIN_OTYPE_PUSHPULL(PK05) | \
1880
PIN_OTYPE_PUSHPULL(PK06) | \
1881
PIN_OTYPE_PUSHPULL(PK07) | \
1882
PIN_OTYPE_PUSHPULL(PK08) | \
1883
PIN_OTYPE_PUSHPULL(PK09) | \
1884
PIN_OTYPE_PUSHPULL(PK10) | \
1885
PIN_OTYPE_PUSHPULL(PK11) | \
1886
PIN_OTYPE_PUSHPULL(PK12) | \
1887
PIN_OTYPE_PUSHPULL(PK13) | \
1888
PIN_OTYPE_PUSHPULL(PK14) | \
1889
PIN_OTYPE_PUSHPULL(PK15))
1890
1891
#define VAL_GPIOK_OSPEEDR (PIN_OSPEED_SPEED_VERYLOW(PK00) | \
1892
PIN_OSPEED_SPEED_VERYLOW(PK01) | \
1893
PIN_OSPEED_SPEED_VERYLOW(PK02) | \
1894
PIN_OSPEED_SPEED_VERYLOW(PK03) | \
1895
PIN_OSPEED_SPEED_VERYLOW(PK04) | \
1896
PIN_OSPEED_SPEED_VERYLOW(PK05) | \
1897
PIN_OSPEED_SPEED_VERYLOW(PK06) | \
1898
PIN_OSPEED_SPEED_VERYLOW(PK07) | \
1899
PIN_OSPEED_SPEED_VERYLOW(PK08) | \
1900
PIN_OSPEED_SPEED_VERYLOW(PK09) | \
1901
PIN_OSPEED_SPEED_VERYLOW(PK10) | \
1902
PIN_OSPEED_SPEED_VERYLOW(PK11) | \
1903
PIN_OSPEED_SPEED_VERYLOW(PK12) | \
1904
PIN_OSPEED_SPEED_VERYLOW(PK13) | \
1905
PIN_OSPEED_SPEED_VERYLOW(PK14) | \
1906
PIN_OSPEED_SPEED_VERYLOW(PK15))
1907
1908
#define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLDOWN(PK00) | \
1909
PIN_PUPDR_PULLDOWN(PK01) | \
1910
PIN_PUPDR_PULLDOWN(PK02) | \
1911
PIN_PUPDR_PULLDOWN(PK03) | \
1912
PIN_PUPDR_PULLDOWN(PK04) | \
1913
PIN_PUPDR_PULLDOWN(PK05) | \
1914
PIN_PUPDR_PULLDOWN(PK06) | \
1915
PIN_PUPDR_PULLDOWN(PK07) | \
1916
PIN_PUPDR_PULLDOWN(PK08) | \
1917
PIN_PUPDR_PULLDOWN(PK09) | \
1918
PIN_PUPDR_PULLDOWN(PK10) | \
1919
PIN_PUPDR_PULLDOWN(PK11) | \
1920
PIN_PUPDR_PULLDOWN(PK12) | \
1921
PIN_PUPDR_PULLDOWN(PK13) | \
1922
PIN_PUPDR_PULLDOWN(PK14) | \
1923
PIN_PUPDR_PULLDOWN(PK15))
1924
1925
#define VAL_GPIOK_ODR (PIN_ODR_LEVEL_LOW(PK00) | \
1926
PIN_ODR_LEVEL_LOW(PK01) | \
1927
PIN_ODR_LEVEL_LOW(PK02) | \
1928
PIN_ODR_LEVEL_LOW(PK03) | \
1929
PIN_ODR_LEVEL_LOW(PK04) | \
1930
PIN_ODR_LEVEL_LOW(PK05) | \
1931
PIN_ODR_LEVEL_LOW(PK06) | \
1932
PIN_ODR_LEVEL_LOW(PK07) | \
1933
PIN_ODR_LEVEL_LOW(PK08) | \
1934
PIN_ODR_LEVEL_LOW(PK09) | \
1935
PIN_ODR_LEVEL_LOW(PK10) | \
1936
PIN_ODR_LEVEL_LOW(PK11) | \
1937
PIN_ODR_LEVEL_LOW(PK12) | \
1938
PIN_ODR_LEVEL_LOW(PK13) | \
1939
PIN_ODR_LEVEL_LOW(PK14) | \
1940
PIN_ODR_LEVEL_LOW(PK15))
1941
1942
#define VAL_GPIOK_AFRL (PIN_AFIO_AF(PK00, 0) | \
1943
PIN_AFIO_AF(PK01, 0) | \
1944
PIN_AFIO_AF(PK02, 0) | \
1945
PIN_AFIO_AF(PK03, 0) | \
1946
PIN_AFIO_AF(PK04, 0) | \
1947
PIN_AFIO_AF(PK05, 0) | \
1948
PIN_AFIO_AF(PK06, 0) | \
1949
PIN_AFIO_AF(PK07, 0))
1950
1951
#define VAL_GPIOK_AFRH (PIN_AFIO_AF(PK08, 0) | \
1952
PIN_AFIO_AF(PK09, 0) | \
1953
PIN_AFIO_AF(PK10, 0) | \
1954
PIN_AFIO_AF(PK11, 0) | \
1955
PIN_AFIO_AF(PK12, 0) | \
1956
PIN_AFIO_AF(PK13, 0) | \
1957
PIN_AFIO_AF(PK14, 0) | \
1958
PIN_AFIO_AF(PK15, 0))
1959
1960
#define AF_UART4_TX 8U
1961
#define AF_LINE_UART4_TX 8U
1962
#define AF_UART4_RX 8U
1963
#define AF_LINE_UART4_RX 8U
1964
#define AF_SERVO1 1U
1965
#define AF_LINE_SERVO1 1U
1966
#define AF_UART2_RX 7U
1967
#define AF_LINE_UART2_RX 7U
1968
#define AF_SPI1_SCK 5U
1969
#define AF_LINE_SPI1_SCK 5U
1970
#define AF_SPI1_MISO 5U
1971
#define AF_LINE_SPI1_MISO 5U
1972
#define AF_SPI1_MOSI 5U
1973
#define AF_LINE_SPI1_MOSI 5U
1974
#define AF_CU1_CH1 1U
1975
#define AF_LINE_CU1_CH1 1U
1976
#define AF_USART1_RX 7U
1977
#define AF_LINE_USART1_RX 7U
1978
#define AF_OTG_FS_DM 10U
1979
#define AF_LINE_OTG_FS_DM 10U
1980
#define AF_OTG_FS_DP 10U
1981
#define AF_LINE_OTG_FS_DP 10U
1982
#define AF_SWDIO 0U
1983
#define AF_LINE_SWDIO 0U
1984
#define AF_SWCLK 0U
1985
#define AF_LINE_SWCLK 0U
1986
#define AF_SERVO5 1U
1987
#define AF_LINE_SERVO5 1U
1988
#define AF_SERVO0 2U
1989
#define AF_LINE_SERVO0 2U
1990
#define AF_SERVO6 2U
1991
#define AF_LINE_SERVO6 2U
1992
#define AF_SERVO4 1U
1993
#define AF_LINE_SERVO4 1U
1994
#define AF_SERVO3 2U
1995
#define AF_LINE_SERVO3 2U
1996
#define AF_SERVO2 2U
1997
#define AF_LINE_SERVO2 2U
1998
#define AF_USART1_TX 7U
1999
#define AF_LINE_USART1_TX 7U
2000
#define AF_I2C1_SDA 4U
2001
#define AF_LINE_I2C1_SDA 4U
2002
#define AF_I2C1_SCL 4U
2003
#define AF_LINE_I2C1_SCL 4U
2004
#define AF_I2C2_SCL 4U
2005
#define AF_LINE_I2C2_SCL 4U
2006
#define AF_I2C2_SDA 4U
2007
#define AF_LINE_I2C2_SDA 4U
2008
#define AF_USART6_TX 8U
2009
#define AF_LINE_USART6_TX 8U
2010
#define AF_USART6_RX 8U
2011
#define AF_LINE_USART6_RX 8U
2012
#define AF_SDIO_D0 12U
2013
#define AF_LINE_SDIO_D0 12U
2014
#define AF_SDIO_D1 12U
2015
#define AF_LINE_SDIO_D1 12U
2016
#define AF_SDIO_D2 12U
2017
#define AF_LINE_SDIO_D2 12U
2018
#define AF_SDIO_D3 12U
2019
#define AF_LINE_SDIO_D3 12U
2020
#define AF_SDIO_CK 12U
2021
#define AF_LINE_SDIO_CK 12U
2022
#define AF_OSC32_IN 0U
2023
#define AF_LINE_OSC32_IN 0U
2024
#define AF_OSC32_OUT 0U
2025
#define AF_LINE_OSC32_OUT 0U
2026
#define AF_SDIO_CMD 12U
2027
#define AF_LINE_SDIO_CMD 12U
2028
#define AF_OSC_IN 0U
2029
#define AF_LINE_OSC_IN 0U
2030
#define AF_OSC_OUT 0U
2031
#define AF_LINE_OSC_OUT 0U
2032
2033
2034
#define SERVO1_TIM 2
2035
#define SERVO1_TIM_FN CH
2036
#define SERVO1_TIM_CH 3
2037
#define SERVO1_TIM_AF 1
2038
#define SERVO5_TIM 2
2039
#define SERVO5_TIM_FN CH
2040
#define SERVO5_TIM_CH 1
2041
#define SERVO5_TIM_AF 1
2042
#define SERVO0_TIM 3
2043
#define SERVO0_TIM_FN CH
2044
#define SERVO0_TIM_CH 3
2045
#define SERVO0_TIM_AF 2
2046
#define SERVO6_TIM 3
2047
#define SERVO6_TIM_FN CH
2048
#define SERVO6_TIM_CH 4
2049
#define SERVO6_TIM_AF 2
2050
#define SERVO4_TIM 2
2051
#define SERVO4_TIM_FN CH
2052
#define SERVO4_TIM_CH 2
2053
#define SERVO4_TIM_AF 1
2054
#define SERVO3_TIM 3
2055
#define SERVO3_TIM_FN CH
2056
#define SERVO3_TIM_CH 1
2057
#define SERVO3_TIM_AF 2
2058
#define SERVO2_TIM 3
2059
#define SERVO2_TIM_FN CH
2060
#define SERVO2_TIM_CH 2
2061
#define SERVO2_TIM_AF 2
2062
2063
#define BOARD_GROUP_DECLFOREACH(line, group) \
2064
static const ioline_t group ## _ARRAY[] = {group}; \
2065
for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
2066
2067
#define BOARD_GROUP_FOREACH(line, group) \
2068
for (ioline_t i=0, line = group ## _ARRAY[i]; (i < group ## _SIZE) && (line = group ## _ARRAY[i]); i++)
2069
2070
2071
#define BOARD_GROUP_DECLFOR(array, index, group) \
2072
static const ioline_t group ## _ARRAY[] = {group}; \
2073
for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
2074
2075
#define BOARD_GROUP_FOR(array, index, group) \
2076
for (ioline_t index=0, *array = (ioline_t *) group ## _ARRAY; index < group ## _SIZE; index++)
2077
2078
#define ENERGY_SAVE_INPUT \
2079
LINE_SERVO1, \
2080
LINE_SERVO5, \
2081
LINE_SERVO0, \
2082
LINE_SERVO6, \
2083
LINE_SERVO4, \
2084
LINE_SERVO3, \
2085
LINE_SERVO2, \
2086
LINE_SPI1_CS, \
2087
LINE_AUX4, \
2088
LINE_LED1, \
2089
LINE_LED3, \
2090
LINE_LED4, \
2091
LINE_AUX3, \
2092
LINE_AUX2, \
2093
LINE_LED2
2094
#define ENERGY_SAVE_INPUT_SIZE 15
2095
2096
#if !defined(_FROM_ASM_)
2097
#ifdef __cplusplus
2098
extern
"C"
{
2099
#endif
2100
void
boardInit
(
void
);
2101
#ifdef __cplusplus
2102
}
2103
#endif
2104
#endif
/* _FROM_ASM_ */
2105
boardInit
void boardInit(void)
Board-specific initialization code.
Definition:
board.c:317
sw
airborne
boards
apogee
chibios
v1.0
board.h
Generated on Fri Nov 8 2024 14:10:44 for Paparazzi UAS by
1.9.1