Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
my_debug_servo.h
Go to the documentation of this file.
1 #ifndef MY_DEBUG_SERVO_H
2 #define MY_DEBUG_SERVO_H
3 
4 #include <libopencm3/stm32/gpio.h>
5 #include <libopencm3/stm32/rcc.h>
6 
7 /* using servo 2 connector as debug */
8 
9 #define DEBUG_S1_TOGGLE() { GPIOC_ODR ^= GPIO6; }
10 #define DEBUG_S1_ON() { GPIOC_BSRR = GPIO6; }
11 #define DEBUG_S1_OFF() { GPIOC_BRR = GPIO6; }
12 
13 #define DEBUG_S2_TOGGLE() { GPIOC_ODR ^= GPIO7; }
14 #define DEBUG_S2_ON() { GPIOC_BSRR = GPIO7; }
15 #define DEBUG_S2_OFF() { GPIOC_BRR = GPIO7; }
16 
17 #define DEBUG_S3_TOGGLE() { GPIOC_ODR ^= GPIO8; }
18 #define DEBUG_S3_ON() { GPIOC_BSRR = GPIO8; }
19 #define DEBUG_S3_OFF() { GPIOC_BRR = GPIO8; }
20 
21 #define DEBUG_S4_TOGGLE() { GPIOC_ODR ^= GPIO9; }
22 #define DEBUG_S4_ON() { GPIOC_BSRR = GPIO9; }
23 #define DEBUG_S4_OFF() { GPIOC_BRR = GPIO9; }
24 
25 #define DEBUG_S5_TOGGLE() { GPIOB_ODR ^= GPIO8; }
26 #define DEBUG_S5_ON() { GPIOB_BSRR = GPIO8; }
27 #define DEBUG_S5_OFF() { GPIOB_BRR = GPIO8; }
28 
29 #define DEBUG_S6_TOGGLE() { GPIOB_ODR ^= GPIO9; }
30 #define DEBUG_S6_ON() { GPIOB_BSRR = GPIO9; }
31 #define DEBUG_S6_OFF() { GPIOB_BRR = GPIO9; }
32 
33 
34 
35 #define DEBUG_SERVO1_INIT() { \
36  /* S1: PC6 S2: PC7 S3: PC8 */ \
37  GPIOC_BSRR = GPIO6 | GPIO7 | GPIO8 ; \
38  rcc_periph_clock_enable(RCC_GPIOC); \
39  gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, \
40  GPIO_CNF_OUTPUT_PUSHPULL, GPIO6 | GPIO7 | GPIO8); \
41  DEBUG_S1_OFF(); \
42  DEBUG_S2_OFF(); \
43  DEBUG_S3_OFF(); \
44  }
45 
46 #define DEBUG_SERVO2_INIT() { \
47  /* S4: PC9 */ \
48  GPIOC_BSRR = GPIO9; \
49  rcc_periph_clock_enable(RCC_GPIOC); \
50  gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, \
51  GPIO_CNF_OUTPUT_PUSHPULL, GPIO9); \
52  /* S5: PB8 and S6: PB9 */ \
53  GPIOB_BSRR = GPIO8 | GPIO9; \
54  rcc_periph_clock_enable(RCC_GPIOB); \
55  gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, \
56  GPIO_CNF_OUTPUT_PUSHPULL, GPIO8 | GPIO9); \
57  DEBUG_S4_OFF(); \
58  DEBUG_S5_OFF(); \
59  DEBUG_S6_OFF(); \
60  }
61 
62 
63 #endif /* MY_DEBUG_SERVO_H */