Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
radio_control.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2014 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, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
29 #include "led.h"
30 
31 //PRINT_CONFIG_VAR(RADIO_CONTROL_NB_CHANNEL)
32 
34 
35 #if PERIODIC_TELEMETRY
37 
38 static void send_rc(struct transport_tx *trans, struct link_device *dev)
39 {
40  pprz_msg_send_RC(trans, dev, AC_ID, radio_control.nb_channel, radio_control.values);
41 }
42 #endif
43 
45 {
46  uint8_t i;
47  for (i = 0; i < RADIO_CONTROL_NB_CHANNEL; i++) {
48  radio_control.values[i] = 0;
49  }
55  radio_control.nb_channel = RADIO_CONTROL_NB_CHANNEL; // can be changed by selected RC module
56 
57 #if PERIODIC_TELEMETRY
59 #endif
60 }
61 
63 {
64  static uint8_t _1Hz;
65  _1Hz++;
66 
67  if (_1Hz >= 60) {
68  _1Hz = 0;
71  }
72 
75  } else {
79  }
81  }
82 
83 #if defined(RADIO_CONTROL_LED)
84  if (radio_control.status == RC_OK) {
85  LED_ON(RADIO_CONTROL_LED);
86  } else {
87  LED_OFF(RADIO_CONTROL_LED);
88  }
89 #endif
90 
91 }
#define RADIO_CONTROL_NB_CHANNEL
#define LED_ON(i)
Definition: led_hw.h:51
#define LED_OFF(i)
Definition: led_hw.h:52
arch independent LED (Light Emitting Diodes) API
void radio_control_periodic_task(void)
Definition: radio_control.c:62
struct RadioControl radio_control
Definition: radio_control.c:33
static void send_rc(struct transport_tx *trans, struct link_device *dev)
Definition: radio_control.c:38
void radio_control_init(void)
Definition: radio_control.c:44
Generic interface for radio control modules.
uint8_t time_since_last_frame
Definition: radio_control.h:62
#define RC_OK_CPT
Definition: radio_control.h:46
#define RC_LOST_TIME
Definition: radio_control.h:39
#define RC_REALLY_LOST
Definition: radio_control.h:51
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:67
uint8_t status
Definition: radio_control.h:61
uint8_t radio_ok_cpt
Definition: radio_control.h:63
uint8_t frame_rate
Definition: radio_control.h:64
uint8_t frame_cpt
Definition: radio_control.h:65
#define RC_REALLY_LOST_TIME
Definition: radio_control.h:42
#define RC_OK
Definition: radio_control.h:49
uint8_t nb_channel
Definition: radio_control.h:66
#define RC_LOST
Definition: radio_control.h:50
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98