Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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
35
uint8_t
servos_PPM_idx
;
36
uint8_t
ppm_pulse
;
37
uint32_t
servos_delay
;
38
39
#define START_TIMEOUT 0xFFFF;
40
41
void
actuators_ppm_init
(
void
)
42
{
43
/* select ppm output pin as MAT0.1 output */
44
SERVO_CLOCK_PINSEL
|=
SERVO_CLOCK_PINSEL_VAL
<<
SERVO_CLOCK_PINSEL_BIT
;
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 */
55
T0MR1
=
START_TIMEOUT
;
56
servos_PPM_idx
=
_PPM_NB_CHANNELS
;
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++) {
61
servos_values
[i] =
SERVOS_TICS_OF_USEC
(1500);
62
}
63
64
servos_delay
=
SERVO_REFRESH_TICS
;
65
}
66
uint16_t
servos_values
[
_PPM_NB_CHANNELS
];
67
uint16_t
unsigned short uint16_t
Definition:
types.h:16
servos_values
uint16_t servos_values[_PPM_NB_CHANNELS]
Definition:
servos_ppm_hw.c:66
T0MCR
#define T0MCR
Definition:
LPC21xx.h:55
uint32_t
unsigned long uint32_t
Definition:
types.h:18
paparazzi.h
TEMR_EMC1_2
#define TEMR_EMC1_2
Definition:
lpcTMR.h:159
START_TIMEOUT
#define START_TIMEOUT
Definition:
servos_ppm_hw.c:39
TMCR_MR1_I
#define TMCR_MR1_I
Definition:
lpcTMR.h:62
T0MR1
#define T0MR1
Definition:
LPC21xx.h:57
SERVO_CLOCK_PINSEL
#define SERVO_CLOCK_PINSEL
Definition:
hb_1.1.h:30
SERVOS_TICS_OF_USEC
#define SERVOS_TICS_OF_USEC(s)
Definition:
actuators_pwm_arch.h:41
SERVO_CLOCK_PINSEL_VAL
#define SERVO_CLOCK_PINSEL_VAL
Definition:
hb_1.1.h:31
TEMR_EM1
#define TEMR_EM1
Definition:
lpcTMR.h:150
SERVO_CLOCK_PINSEL_BIT
#define SERVO_CLOCK_PINSEL_BIT
Definition:
hb_1.1.h:32
uint8_t
unsigned char uint8_t
Definition:
types.h:14
servos_PPM_idx
uint8_t servos_PPM_idx
Definition:
servos_ppm_hw.c:35
_PPM_NB_CHANNELS
#define _PPM_NB_CHANNELS
Definition:
servos_ppm_hw.h:43
actuators_ppm_init
void actuators_ppm_init(void)
Definition:
servos_ppm_hw.c:41
T0EMR
#define T0EMR
Definition:
LPC21xx.h:65
ppm_pulse
uint8_t ppm_pulse
Definition:
servos_ppm_hw.c:36
servos_delay
uint32_t servos_delay
Definition:
servos_ppm_hw.c:37
SERVO_REFRESH_TICS
#define SERVO_REFRESH_TICS
Definition:
servos_4015_hw.c:98
actuators.h
sw
airborne
arch
lpc21
subsystems
actuators
servos_ppm_hw.c
Generated on Tue Feb 1 2022 13:51:13 for Paparazzi UAS by
1.8.17