Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Data Structures
Data Structure Index
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
ppm_arch.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2013 AggieAir, A Remote Sensing Unmanned Aerial System for Scientific Applications
3
* Utah State University, http://aggieair.usu.edu/
4
*
5
* Michal Podhradsky (michal.podhradsky@aggiemail.usu.edu)
6
* Calvin Coopmans (c.r.coopmans@ieee.org)
7
*
8
*
9
* This file is part of paparazzi.
10
*
11
* paparazzi is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2, or (at your option)
14
* any later version.
15
*
16
* paparazzi is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
20
*
21
* You should have received a copy of the GNU General Public License
22
* along with paparazzi; see the file COPYING. If not, write to
23
* the Free Software Foundation, 59 Temple Place - Suite 330,
24
* Boston, MA 02111-1307, USA.
25
*/
32
#include "
subsystems/radio_control.h
"
33
#include "
subsystems/radio_control/ppm.h
"
34
35
uint8_t
ppm_cur_pulse
;
36
uint32_t
ppm_last_pulse_time
;
37
bool
ppm_data_valid
;
38
static
uint32_t
timer_rollover_cnt
;
39
40
#ifndef PPM_TIMER_FREQUENCY
41
#error "Undefined PPM_TIMER_FREQUENCY"
42
#endif
43
44
#ifndef PPM_CHANNEL
45
#error "PPM channel undefined"
46
#endif
47
48
52
static
void
icuperiodcb
(ICUDriver *icup)
53
{
54
ppm_decode_frame_width
(icuGetPeriodX(icup));
55
}
56
60
static
void
icuoverflowcb
(ICUDriver *icup)
61
{
62
(void)icup;
63
// TODO do something with this ?
64
}
65
73
static
ICUConfig
ppm_icucfg
= {
74
#if defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_POSITIVE
75
ICU_INPUT_ACTIVE_HIGH,
76
#elif defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_NEGATIVE
77
ICU_INPUT_ACTIVE_LOW,
78
#else
79
#error "Unknown PPM_PULSE_TYPE"
80
#endif
81
PPM_TIMER_FREQUENCY
,
82
NULL,
83
icuperiodcb
,
84
icuoverflowcb
,
85
PPM_CHANNEL
,
86
0,
87
0xFFFFFFFFU
88
};
89
90
void
ppm_arch_init
(
void
)
91
{
92
ppm_last_pulse_time
= 0;
93
ppm_cur_pulse
=
RADIO_CONTROL_NB_CHANNEL
;
94
timer_rollover_cnt
= 0;
95
96
icuStart(&
PPM_TIMER
, &
ppm_icucfg
);
97
icuStartCapture(&
PPM_TIMER
);
98
icuEnableNotifications(&
PPM_TIMER
);
99
}
radio_control.h
ppm_data_valid
bool ppm_data_valid
Definition:
ppm_arch.c:37
PPM_CHANNEL
#define PPM_CHANNEL
Definition:
board.h:447
PPM_TIMER
#define PPM_TIMER
Definition:
board.h:448
uint32_t
unsigned long uint32_t
Definition:
types.h:18
icuoverflowcb
static void icuoverflowcb(ICUDriver *icup)
PPM Overflow callback.
Definition:
ppm_arch.c:60
ppm_cur_pulse
uint8_t ppm_cur_pulse
Definition:
ppm_arch.c:35
ppm_last_pulse_time
uint32_t ppm_last_pulse_time
Definition:
ppm_arch.c:36
icuperiodcb
static void icuperiodcb(ICUDriver *icup)
PPM Pulse period callback.
Definition:
ppm_arch.c:52
timer_rollover_cnt
static uint32_t timer_rollover_cnt
Definition:
ppm_arch.c:38
uint8_t
unsigned char uint8_t
Definition:
types.h:14
RADIO_CONTROL_NB_CHANNEL
#define RADIO_CONTROL_NB_CHANNEL
Definition:
intermcu_ap.h:49
PPM_TIMER_FREQUENCY
#define PPM_TIMER_FREQUENCY
Definition:
board.h:446
ppm.h
ppm_arch_init
void ppm_arch_init(void)
Architecture dependant code.
Definition:
ppm_arch.c:90
ppm_decode_frame_width
void ppm_decode_frame_width(uint32_t ppm_width)
Decode a PPM frame from last width.
Definition:
ppm.c:114
ppm_icucfg
static ICUConfig ppm_icucfg
ICU timer configuration.
Definition:
ppm_arch.c:73
sw
airborne
arch
chibios
subsystems
radio_control
ppm_arch.c
Generated on Tue Feb 1 2022 13:51:12 for Paparazzi UAS by
1.8.17