Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
servos_direct_hw.h
Go to the documentation of this file.
1 #ifndef SERVOS_DIRECT_HW_H
2 #define SERVOS_DIRECT_HW_H
3 
4 #include "LPC21xx.h"
5 #include "mcu_periph/sys_time.h"
6 
7 #define SERVOS_TICS_OF_USEC(s) CPU_TICKS_OF_USEC(s)
8 #define ChopServo(x,a,b) Chop(x, a, b)
9 
10 #define SERVO_REG_0 PWMMR5
11 #define SERVO_REG_1 PWMMR3
12 #define SERVO_REG_2 PWMMR1
13 #define SERVO_REG_3 PWMMR6
14 #define SERVO_REG_4 PWMMR4
15 #define SERVO_REG_5 PWMMR2
16 
17 #define COMMAND_(i) SERVO_REG_ ## i
18 #define Actuator(i) COMMAND_(i)
19 
20 
21 /*
22  wiring on classix PWM connector
23 connector LPC shared port
24 PWM1 PWM5 AD1_6 CAP1_3 P0.21
25 PWM2 PWM3 RXD0 EINT0 P0.1
26 PWM3 PWM1 TXD0 P0.0
27 PWM4 PWM6 RXD1 EINT3 P0.9
28 PWM5 PWM4 TXD1 AD1_1 P0.8
29 PWM6 PWM2 SSEL0 EINT2 P0.7
30 
31 */
32 
33 #define PWM_PINSEL_MASK_VAL 3
34 
35 #define PWM_SERVO_0_PINSEL PINSEL1
36 #define PWM_SERVO_0_PINSEL_VAL 1
37 #define PWM_SERVO_0_PINSEL_BIT 10
38 #define PWM_SERVO_0_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_0_PINSEL_BIT)
39 #define PWM_SERVO_0_ENA PWMPCR_ENA5
40 #define PWM_SERVO_0_LATCH PWMLER_LATCH5
41 
42 #define PWM_SERVO_1_PINSEL PINSEL0
43 #define PWM_SERVO_1_PINSEL_VAL 2
44 #define PWM_SERVO_1_PINSEL_BIT 2
45 #define PWM_SERVO_1_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_1_PINSEL_BIT)
46 #define PWM_SERVO_1_ENA PWMPCR_ENA3
47 #define PWM_SERVO_1_LATCH PWMLER_LATCH3
48 
49 #define PWM_SERVO_2_PINSEL PINSEL0
50 #define PWM_SERVO_2_PINSEL_VAL 2
51 #define PWM_SERVO_2_PINSEL_BIT 0
52 #define PWM_SERVO_2_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_2_PINSEL_BIT)
53 #define PWM_SERVO_2_ENA PWMPCR_ENA1
54 #define PWM_SERVO_2_LATCH PWMLER_LATCH1
55 
56 #define PWM_SERVO_3_PINSEL PINSEL0
57 #define PWM_SERVO_3_PINSEL_VAL 2
58 #define PWM_SERVO_3_PINSEL_BIT 18
59 #define PWM_SERVO_3_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_3_PINSEL_BIT)
60 #define PWM_SERVO_3_ENA PWMPCR_ENA6
61 #define PWM_SERVO_3_LATCH PWMLER_LATCH6
62 
63 #define PWM_SERVO_4_PINSEL PINSEL0
64 #define PWM_SERVO_4_PINSEL_VAL 2
65 #define PWM_SERVO_4_PINSEL_BIT 16
66 #define PWM_SERVO_4_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_4_PINSEL_BIT)
67 #define PWM_SERVO_4_ENA PWMPCR_ENA4
68 #define PWM_SERVO_4_LATCH PWMLER_LATCH4
69 
70 #define PWM_SERVO_5_PINSEL PINSEL0
71 #define PWM_SERVO_5_PINSEL_VAL 2
72 #define PWM_SERVO_5_PINSEL_BIT 14
73 #define PWM_SERVO_5_PINSEL_MASK ~(PWM_PINSEL_MASK_VAL << PWM_SERVO_5_PINSEL_BIT)
74 #define PWM_SERVO_5_ENA PWMPCR_ENA2
75 #define PWM_SERVO_5_LATCH PWMLER_LATCH2
76 
77 extern const uint8_t pwm_latch_value;
78 
79 #define ActuatorsCommit() { \
80  PWMLER = pwm_latch_value; \
81  }
82 
83 #endif /* SERVOS_DIRECT_HW_H */
Architecture independent timing functions.
unsigned char uint8_t
Definition: types.h:14
const uint8_t pwm_latch_value