Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures 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 
54 void actuators_pwm_arch_init ( void ) {
55 
56  /* configure pins for PWM */
57 #if defined PWM_SERVO_0
58  PWM_SERVO_0_PINSEL = (PWM_SERVO_0_PINSEL & PWM_SERVO_0_PINSEL_MASK) | PWM_SERVO_0_PINSEL_VAL << PWM_SERVO_0_PINSEL_BIT;
59 #endif
60 #if defined PWM_SERVO_1
62 #endif
63 #if defined PWM_SERVO_2
65 #endif
66 #if defined PWM_SERVO_3
68 #endif
69 #if defined PWM_SERVO_4
71 #endif
72 #if defined PWM_SERVO_5
74 #endif
75 
76  /* set servo refresh rate */
78 
79  /* FIXME: For now, this prescaler needs to match the TIMER0 prescaler, as the
80  higher level code treats them the same */
81  PWMPR = 1;
82 
83  /* enable all 6 PWM outputs in single edge mode*/
84  PWMPCR = 0
85 #if defined PWM_SERVO_0
86  | PWM_SERVO_0_ENA
87 #endif
88 #if defined PWM_SERVO_1
90 #endif
91 #if defined PWM_SERVO_2
93 #endif
94 #if defined PWM_SERVO_3
96 #endif
97 #if defined PWM_SERVO_4
99 #endif
100 #if defined PWM_SERVO_5
102 #endif
103  ;
104 
105  /* commit PWMMRx changes */
107 
108  /* enable PWM timer in PWM mode */
110 
111 
112 }
#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
#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
void actuators_pwm_arch_init(void)
Arch dependent init file.
#define PWM_SERVO_3_PINSEL_BIT
#define PWM_SERVO_1_LATCH
#define PWM_SERVO_4_PINSEL_BIT
#define PWM_SERVO_1_PINSEL