Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ppm.c
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 
24 
26 volatile bool_t ppm_frame_available;
27 
28 #if PERIODIC_TELEMETRY
29 #ifdef FBW
30 #define DOWNLINK_TELEMETRY &telemetry_Fbw
31 #else
32 #define DOWNLINK_TELEMETRY DefaultPeriodic
33 #endif
34 
36 
37 static void send_ppm(void) {
38  uint16_t ppm_pulses_usec[RADIO_CONTROL_NB_CHANNEL];
39  for (int i=0;i<RADIO_CONTROL_NB_CHANNEL;i++)
40  ppm_pulses_usec[i] = USEC_OF_RC_PPM_TICKS(ppm_pulses[i]);
41  DOWNLINK_SEND_PPM(DefaultChannel, DefaultDevice,
42  &radio_control.frame_rate, PPM_NB_CHANNEL, ppm_pulses_usec);
43 }
44 #endif
45 
48  ppm_arch_init();
49 
50 #if PERIODIC_TELEMETRY
51  register_periodic_telemetry(DOWNLINK_TELEMETRY, "PPM", send_ppm);
52 #endif
53 }
unsigned short uint16_t
Definition: types.h:16
void radio_control_impl_init(void)
Definition: ppm.c:46
Periodic telemetry system header (includes downlink utility and generated code).
void ppm_arch_init(void)
Architecture dependant code.
Definition: ppm_arch.c:29
value send_ppm(value unit)
Definition: ppm_arch.c:84
bool_t register_periodic_telemetry(struct pprz_telemetry *_pt, const char *_msg, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:38
#define FALSE
Definition: imu_chimu.h:141
volatile bool_t ppm_frame_available
Definition: ppm.c:26
#define PPM_NB_CHANNEL
Definition: ppm_arch.h:41
struct RadioControl radio_control
Definition: radio_control.c:25
#define USEC_OF_RC_PPM_TICKS(_v)
Definition: ppm_arch.h:39
uint8_t frame_rate
Definition: radio_control.h:53
uint16_t ppm_pulses[PPM_NB_CHANNEL]
Definition: ppm.c:25
#define RADIO_CONTROL_NB_CHANNEL
Definition: spektrum_arch.h:34