Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ppm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 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 #ifndef RC_PPM_H
23 #define RC_PPM_H
24 
25 #include "std.h"
26 
27 /* in case you want to override RADIO_CONTROL_NB_CHANNEL */
28 #include "generated/airframe.h"
29 
33 #include "subsystems/radio_control/ppm_arch.h"
34 /* must be implemented by arch dependant code */
35 extern void ppm_arch_init(void);
36 
41 #include "generated/radio.h"
42 
46 #ifndef RADIO_CONTROL_NB_CHANNEL
47 #define RADIO_CONTROL_NB_CHANNEL RADIO_CTL_NB
48 #endif
49 
50 #if RADIO_CONTROL_NB_CHANNEL > RADIO_CTL_NB
51 #error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than number of channels in radio file."
52 #endif
53 
57 #define PPM_PULSE_TYPE_POSITIVE 0
58 #define PPM_PULSE_TYPE_NEGATIVE 1
59 
60 extern uint16_t ppm_pulses[RADIO_CTL_NB];
61 extern volatile bool ppm_frame_available;
62 
67 extern void radio_control_impl_event(void (* _received_frame_handler)(void));
68 
69 #define RadioControlEvent(_received_frame_handler) radio_control_impl_event(_received_frame_handler)
70 
71 
79 extern void ppm_decode_frame(uint32_t ppm_time);
80 
88 extern void ppm_decode_frame_width(uint32_t ppm_width);
89 
90 #endif /* RC_PPM_H */
void ppm_decode_frame(uint32_t ppm_time)
Decode a PPM frame from global timer value.
Definition: ppm.c:99
unsigned short uint16_t
Definition: types.h:16
uint16_t ppm_pulses[RADIO_CTL_NB]
Definition: ppm.c:31
volatile bool ppm_frame_available
Definition: ppm.c:32
void ppm_arch_init(void)
Architecture dependant code.
Definition: ppm_arch.c:89
void ppm_decode_frame_width(uint32_t ppm_width)
Decode a PPM frame from last width.
Definition: ppm.c:114
unsigned long uint32_t
Definition: types.h:18
void radio_control_impl_event(void(*_received_frame_handler)(void))
RC event function with handler callback.
Definition: hott.c:66