Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
actuators_pwm_arch.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010-2012 The Paparazzi Team
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #include "subsystems/actuators/actuators_pwm_arch.h"
24 #include "std.h"
25 #include BOARD_CONFIG
26 #include "generated/airframe.h"
27 
28 /* 40 Hz */
29 #ifndef SERVOS_PERIOD
30 #define SERVOS_PERIOD SERVOS_TICS_OF_USEC(25000)
31 #endif
32 
34 #if defined PWM_SERVO_0
35  | PWM_SERVO_0_LATCH
36 #endif
37 #if defined PWM_SERVO_1
39 #endif
40 #if defined PWM_SERVO_2
42 #endif
43 #if defined PWM_SERVO_3
45 #endif
46 #if defined PWM_SERVO_4
48 #endif
49 #if defined PWM_SERVO_5
51 #endif
52  ;
53 
55 {
56 
57  /* configure pins for PWM */
58 #if defined PWM_SERVO_0
59  PWM_SERVO_0_PINSEL = (PWM_SERVO_0_PINSEL & PWM_SERVO_0_PINSEL_MASK) | PWM_SERVO_0_PINSEL_VAL << PWM_SERVO_0_PINSEL_BIT;
60 #endif
61 #if defined PWM_SERVO_1
63 #endif
64 #if defined PWM_SERVO_2
66 #endif
67 #if defined PWM_SERVO_3
69 #endif
70 #if defined PWM_SERVO_4
72 #endif
73 #if defined PWM_SERVO_5
75 #endif
76 
77  /* set servo refresh rate */
79 
80  /* FIXME: For now, this prescaler needs to match the TIMER0 prescaler, as the
81  higher level code treats them the same */
82  PWMPR = 1;
83 
84  /* enable all 6 PWM outputs in single edge mode*/
85  PWMPCR = 0
86 #if defined PWM_SERVO_0
87  | PWM_SERVO_0_ENA
88 #endif
89 #if defined PWM_SERVO_1
91 #endif
92 #if defined PWM_SERVO_2
94 #endif
95 #if defined PWM_SERVO_3
97 #endif
98 #if defined PWM_SERVO_4
100 #endif
101 #if defined PWM_SERVO_5
103 #endif
104  ;
105 
106  /* commit PWMMRx changes */
108 
109  /* enable PWM timer in PWM mode */
111 
112 
113 }
#define PWM_SERVO_5_PINSEL_VAL
#define PWM_SERVO_4_PINSEL
#define SERVOS_PERIOD
#define PWM_SERVO_1_PINSEL_VAL
#define PWM_SERVO_4_PINSEL_MASK
void actuators_pwm_arch_init(void)
Arch dependent init file.
#define PWM_SERVO_3_PINSEL
#define PWMMR0
Definition: LPC21xx.h:100
#define PWM_SERVO_5_LATCH
const uint8_t pwm_latch_value
#define PWM_SERVO_1_ENA
#define PWM_SERVO_3_PINSEL_VAL
#define PWM_SERVO_2_PINSEL_VAL
#define PWMTCR
Definition: LPC21xx.h:95
#define PWMPCR
Definition: LPC21xx.h:107
#define PWM_SERVO_2_ENA
#define PWM_SERVO_5_PINSEL_BIT
#define PWMTCR_COUNTER_ENABLE
Definition: lpcTMR.h:83
#define PWM_SERVO_3_ENA
#define PWM_SERVO_5_PINSEL
#define PWM_SERVO_5_ENA
#define PWM_SERVO_2_PINSEL_BIT
#define PWM_SERVO_4_PINSEL_VAL
#define PWMLER
Definition: LPC21xx.h:108
#define PWM_SERVO_4_LATCH
#define PWM_SERVO_3_PINSEL_MASK
#define PWM_SERVO_4_ENA
#define PWM_SERVO_1_PINSEL_MASK
#define PWMPR
Definition: LPC21xx.h:97
#define PWMTCR_PWM_ENABLE
Definition: lpcTMR.h:85
unsigned char uint8_t
Definition: types.h:14
#define PWM_SERVO_2_PINSEL
#define PWMLER_LATCH0
Definition: lpcTMR.h:124
#define PWM_SERVO_3_LATCH
#define PWM_SERVO_1_PINSEL_BIT
#define PWM_SERVO_5_PINSEL_MASK
#define PWM_SERVO_2_PINSEL_MASK
#define PWM_SERVO_2_LATCH
#define PWM_SERVO_3_PINSEL_BIT
#define PWM_SERVO_1_LATCH
#define PWM_SERVO_4_PINSEL_BIT
#define PWM_SERVO_1_PINSEL