Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
booz_pwm_arch.c
Go to the documentation of this file.
1 /*
2  * $Id: $
3  *
4  * Copyright (C) 2011 ENAC
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
25 #include "modules/core/booz_pwm_arch.h"
26 
27 #define PWM_PERIOD CPU_TICKS_OF_USEC(20000)
28 #define PWM_DUTY CPU_TICKS_OF_USEC(1500)
29 
30 void booz_pwm_init_arch( void ) {
31 
32  /* start PWM5 */
33  /* select P0.21 as PWM5 */
35  /* select pwm period */
37  /* select pwm value to 50% at init (1500 us) */
38  PWMMR5 = PWM_DUTY;
39  /* commit values */
41  /* prescle timer to match TIMER 0 (15MHz) */
42  PWMPR = T0_PCLK_DIV - 1;
43  /* enable counter and pwm mode */
45  /* enable PWM5 */
47 
48 #ifdef USE_PWM1
49  /* start PWM2 */
51  /* select pwm value to 50% at init (1500 us) */
52  PWMMR2 = PWM_DUTY;
53  /* commit values */
55  /* enable PWM2 */
57 #endif
58 
59 
60 }
#define PWM1_PINSEL_BIT
Definition: booz_1.0.h:160
#define PWM0_PINSEL_VAL
Definition: booz_1.0.h:153
#define PWMMR0
Definition: LPC21xx.h:100
#define PWM0_PINSEL_BIT
Definition: booz_1.0.h:154
#define PWMTCR
Definition: LPC21xx.h:95
#define PWMPCR
Definition: LPC21xx.h:107
#define PWM_DUTY
Definition: booz_pwm_arch.c:28
#define PWMMR2
Definition: LPC21xx.h:102
#define PWMTCR_COUNTER_ENABLE
Definition: lpcTMR.h:83
#define PWM1_PINSEL_VAL
Definition: booz_1.0.h:159
#define PWMPCR_ENA2
Definition: lpcTMR.h:117
#define PWMLER
Definition: LPC21xx.h:108
#define PWMLER_LATCH2
Definition: lpcTMR.h:126
#define PWMMR5
Definition: LPC21xx.h:105
#define PWMPR
Definition: LPC21xx.h:97
#define PWMTCR_PWM_ENABLE
Definition: lpcTMR.h:85
#define PWM1_PINSEL
Definition: booz_1.0.h:158
#define PWMLER_LATCH0
Definition: lpcTMR.h:124
#define PWM_PERIOD
Definition: booz_pwm_arch.c:27
#define PWMLER_LATCH5
Definition: lpcTMR.h:129
void booz_pwm_init_arch(void)
Definition: booz_pwm_arch.c:30
#define PWM0_PINSEL
Definition: booz_1.0.h:152
#define PWMPCR_ENA5
Definition: lpcTMR.h:120