Paparazzi UAS  v6.2_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 }
radio_control.h
RadioControl::radio_ok_cpt
uint8_t radio_ok_cpt
Definition: radio_control.h:63
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
RC_LOST
#define RC_LOST
Definition: radio_control.h:50
radio_control_periodic_task
void radio_control_periodic_task(void)
Definition: radio_control.c:62
LED_OFF
#define LED_OFF(i)
Definition: led_hw.h:52
RC_OK_CPT
#define RC_OK_CPT
Definition: radio_control.h:46
RC_LOST_TIME
#define RC_LOST_TIME
Definition: radio_control.h:39
RadioControl::time_since_last_frame
uint8_t time_since_last_frame
Definition: radio_control.h:62
LED_ON
#define LED_ON(i)
Definition: led_hw.h:51
RadioControl::nb_channel
uint8_t nb_channel
Definition: radio_control.h:66
RADIO_CONTROL_NB_CHANNEL
#define RADIO_CONTROL_NB_CHANNEL
Definition: cc2500_paparazzi.h:33
RadioControl::frame_rate
uint8_t frame_rate
Definition: radio_control.h:64
telemetry.h
dev
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
register_periodic_telemetry
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:51
RadioControl::status
uint8_t status
Definition: radio_control.h:61
RadioControl::frame_cpt
uint8_t frame_cpt
Definition: radio_control.h:65
RadioControl
Definition: radio_control.h:60
led.h
arch independent LED (Light Emitting Diodes) API
radio_control_init
void radio_control_init(void)
Definition: radio_control.c:44
RC_REALLY_LOST_TIME
#define RC_REALLY_LOST_TIME
Definition: radio_control.h:42
RC_OK
#define RC_OK
Definition: radio_control.h:49
send_rc
static void send_rc(struct transport_tx *trans, struct link_device *dev)
Definition: radio_control.c:38
RC_REALLY_LOST
#define RC_REALLY_LOST
Definition: radio_control.h:51
DefaultPeriodic
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
radio_control
struct RadioControl radio_control
Definition: radio_control.c:33
RadioControl::values
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:67