Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
servos_ppm_hw.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 Mark Griffin
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 
31 #include "subsystems/actuators.h"
32 #include "paparazzi.h"
33 #include "generated/airframe.h"
34 
38 
39 #define START_TIMEOUT 0xFFFF;
40 
42 {
43  /* select ppm output pin as MAT0.1 output */
45 
46  /* enable match 1 interrupt */
47  T0MCR |= TMCR_MR1_I;
48 
49  /* lower clock */
50  T0EMR &= ~TEMR_EM1;
51  /* set high on match 1 */
52  T0EMR |= TEMR_EMC1_2;
53 
54  /* set first pulse in a while */
57  /* Set all servos to their midpoints */
58  /* compulsory for unused servos */
59  uint8_t i;
60  for (i = 0 ; i < _PPM_NB_CHANNELS ; i++) {
62  }
63 
65 }
67 
unsigned short uint16_t
Definition: types.h:16
#define START_TIMEOUT
Definition: servos_ppm_hw.c:39
#define SERVO_CLOCK_PINSEL
Definition: hb_1.1.h:30
#define SERVOS_TICS_OF_USEC(s)
#define SERVO_CLOCK_PINSEL_BIT
Definition: hb_1.1.h:32
#define T0MCR
Definition: LPC21xx.h:55
#define TMCR_MR1_I
Definition: lpcTMR.h:62
uint8_t servos_PPM_idx
Definition: servos_ppm_hw.c:35
Hardware independent API for actuators (servos, motor controllers).
unsigned long uint32_t
Definition: types.h:18
void actuators_ppm_init(void)
Definition: servos_ppm_hw.c:41
#define T0EMR
Definition: LPC21xx.h:65
#define T0MR1
Definition: LPC21xx.h:57
#define SERVO_REFRESH_TICS
unsigned char uint8_t
Definition: types.h:14
uint32_t servos_delay
Definition: servos_ppm_hw.c:37
#define TEMR_EMC1_2
Definition: lpcTMR.h:159
#define TEMR_EM1
Definition: lpcTMR.h:150
uint8_t ppm_pulse
Definition: servos_ppm_hw.c:36
#define _PPM_NB_CHANNELS
Definition: servos_ppm_hw.h:43
#define SERVO_CLOCK_PINSEL_VAL
Definition: hb_1.1.h:31
uint16_t servos_values[_PPM_NB_CHANNELS]
Definition: servos_ppm_hw.c:66